appstore

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FailureTypeInvalidCredentials     = "-5000"
	FailureTypePasswordTokenExpired   = "2034"
	FailureTypeLicenseNotFound        = "9610"
	FailureTypeTemporarilyUnavailable = "2059"
	FailureTypePasswordHasChanged     = "2002"

	CustomerMessageBadLogin             = "MZFinance.BadLogin.Configurator_message"
	CustomerMessageSubscriptionRequired = "Subscription Required"
	CustomerMessageAccountDisabled      = "Your account is disabled."

	PriavteAppStoreAPIDomainPrefixWithoutAuthCode = "p25"
	PriavteAppStoreAPIDomainPrefixWithAuthCode    = "p71"
	PrivateAppStoreAPIDomain                      = "buy." + iTunesAPIDomain
	PrivateAppStoreAPIPathAuthenticate            = "/WebObjects/MZFinance.woa/wa/authenticate"
	PrivateAppStoreAPIPathPurchase                = "/WebObjects/MZBuy.woa/wa/buyProduct"
	PrivateAppStoreAPIPathDownload                = "/WebObjects/MZFinance.woa/wa/volumeStoreDownloadProduct"

	HTTPHeaderStoreFront = "X-Set-Apple-Store-Front"

	PricingParameterAppStore    = "STDQ"
	PricingParameterAppleArcade = "GAME"
)

Variables

View Source
var (
	ErrPasswordTokenEmpty     = errors.New("password token is empty")
	ErrAccountDisabled        = errors.New("account is disabled")
	ErrAppLookup              = errors.New("failed to find app")
	ErrAppNotFound            = errors.New("failed to find app on the App Store")
	ErrApplyLegacyPatches     = errors.New("failed to apply legacy patches")
	ErrApplyPatches           = errors.New("failed to apply patches")
	ErrAuthCodeRequired       = errors.New("auth code is required")
	ErrCheckDirectory         = errors.New("failed to determine if the supplied path is a directory")
	ErrCreateDestinationFile  = errors.New("failed to create destination file")
	ErrCreateMetadataFile     = errors.New("failed to create metadata file")
	ErrCreateRequest          = errors.New("failed to create HTTP request")
	ErrCreateSinfFile         = errors.New("failed to create sinf file")
	ErrDecompressInfoFile     = errors.New("failed to open decompressed info file")
	ErrDecompressManifestFile = errors.New("failed to open decompressed manifest file")
	ErrDownloadFile           = errors.New("failed to download file")
	ErrEncodeMetadataFile     = errors.New("failed to encode metadata")
	ErrFileWrite              = errors.New("failed to write file")
	ErrGeneric                = errors.New("failed due to an unknown error")
	ErrGetAccount             = errors.New("failed to get account")
	ErrGetBundleName          = errors.New("failed to determine name of app bundle")
	ErrGetCurrentDirectory    = errors.New("failed to get current directory path")
	ErrGetData                = errors.New("failed to get data")
	ErrGetExecutablePath      = errors.New("failed to get executable path")
	ErrGetFileMetadata        = errors.New("failed to get file metadata")
	ErrGetInfoFile            = errors.New("failed to read info file")
	ErrGetKeychainItem        = errors.New("failed to read item from keychain")
	ErrGetMAC                 = errors.New("failed to get MAC address")
	ErrGetManifestFile        = errors.New("failed to read manifest file")
	ErrInvalidCountryCode     = errors.New("invalid country code")
	ErrInvalidResponse        = errors.New("received 0 items from the App Store; expected 1 or more")
	ErrInvalidStoreFront      = errors.New("could not infer country code from store front")
	ErrLicenseExists          = errors.New("account already has a license for this app")
	ErrLicenseRequired        = errors.New("license is required")
	ErrLogin                  = errors.New("failed to log in")
	ErrMarshal                = errors.New("failed to marshal data")
	ErrOpenFile               = errors.New("failed to open file")
	ErrOpenZipFile            = errors.New("failed to open zip file")
	ErrPaidApp                = errors.New("paid apps cannot be purchased")
	ErrPasswordRequired       = errors.New("password is required when not running in interactive mode; use the \"--password\" flag")
	ErrPasswordTokenExpired   = errors.New("password token is expired")
	ErrPatchApp               = errors.New("failed to patch app package")
	ErrPurchase               = errors.New("failed to purchase app")
	ErrRemoveKeychainItem     = errors.New("failed to remove item from keychain")
	ErrRemoveTempFile         = errors.New("failed to remove temporary file")
	ErrReplicateZip           = errors.New("failed to replicate zip")
	ErrRequest                = errors.New("failed to send request")
	ErrResolveDestinationPath = errors.New("failed to resolve destination path")
	ErrSetKeychainItem        = errors.New("failed to save item in keychain")
	ErrSubscriptionRequired   = errors.New("subscription required")
	ErrTemporarilyUnavailable = errors.New("item is temporarily unavailable")
	ErrUnmarshal              = errors.New("failed to unmarshal data")
	ErrWriteMetadataFile      = errors.New("failed to write metadata")
	ErrWriteSinfData          = errors.New("failed to write sinf data")
	ErrZipSinfs               = errors.New("failed to zip sinfs and sinf paths")
)
View Source
var StoreFronts = map[string]string{}/* 133 elements not displayed */

Functions

This section is empty.

Types

type Account

type Account struct {
	Email               string `json:"email,omitempty"`
	PasswordToken       string `json:"passwordToken,omitempty"`
	DirectoryServicesID string `json:"directoryServicesIdentifier,omitempty"`
	Name                string `json:"name,omitempty"`
	StoreFront          string `json:"storeFront,omitempty"`
	Password            string `json:"password,omitempty"`
}

type App

type App struct {
	ID       int64   `json:"trackId,omitempty"`
	BundleID string  `json:"bundleId,omitempty"`
	Name     string  `json:"trackName,omitempty"`
	Version  string  `json:"version,omitempty"`
	Price    float64 `json:"price,omitempty"`
}

func (App) MarshalZerologObject

func (a App) MarshalZerologObject(event *zerolog.Event)

type AppStore

type AppStore interface {
	Login(email, password, authCode string) (LoginOutput, error)
	Info() (InfoOutput, error)
	Revoke() error
	Lookup(bundleID string) (LookupOutput, error)
	Search(term string, limit int64) (SearchOutput, error)
	Purchase(bundleID string) error
	Download(bundleID string, outputPath string, acquireLicense bool) (DownloadOutput, error)
	DownloadV2(bundleID string, acquireLicense bool) (DownloadItemResult, error)
	LoginFirstMaybe(email, password string) error
	DownloadFileV2(dst, sourceURL string) (err error)
}

func NewAppStore

func NewAppStore(args AppStoreArgs) AppStore

type AppStoreArgs

type AppStoreArgs struct {
	Keychain        keychain.Keychain
	CookieJar       http.CookieJar
	Logger          log.Logger
	OperatingSystem util.OperatingSystem
	Machine         util.Machine
	Interactive     bool
}

type Apps

type Apps []App

func (Apps) MarshalZerologArray

func (apps Apps) MarshalZerologArray(a *zerolog.Array)

type DownloadItemResult

type DownloadItemResult struct {
	HashMD5  string                 `plist:"md5,omitempty"`
	URL      string                 `plist:"URL,omitempty"`
	Sinfs    []DownloadSinfResult   `plist:"sinfs,omitempty"`
	Metadata map[string]interface{} `plist:"metadata,omitempty"`
}

type DownloadOutput

type DownloadOutput struct {
	DestinationPath string
}

type DownloadResult

type DownloadResult struct {
	FailureType     string               `plist:"failureType,omitempty"`
	CustomerMessage string               `plist:"customerMessage,omitempty"`
	Items           []DownloadItemResult `plist:"songList,omitempty"`
}

type DownloadSinfResult

type DownloadSinfResult struct {
	ID   int64  `plist:"id,omitempty"`
	Data []byte `plist:"sinf,omitempty"`
}

type InfoOutput

type InfoOutput struct {
	Name  string
	Email string
}

type LoginAccountResult

type LoginAccountResult struct {
	Email   string             `plist:"appleId,omitempty"`
	Address LoginAddressResult `plist:"address,omitempty"`
}

type LoginAddressResult

type LoginAddressResult struct {
	FirstName string `plist:"firstName,omitempty"`
	LastName  string `plist:"lastName,omitempty"`
}

type LoginOutput

type LoginOutput struct {
	Name  string
	Email string
}

type LoginResult

type LoginResult struct {
	FailureType         string             `plist:"failureType,omitempty"`
	CustomerMessage     string             `plist:"customerMessage,omitempty"`
	Account             LoginAccountResult `plist:"accountInfo,omitempty"`
	DirectoryServicesID string             `plist:"dsPersonId,omitempty"`
	PasswordToken       string             `plist:"passwordToken,omitempty"`
}

type LookupOutput

type LookupOutput struct {
	App App
}

type PackageInfo

type PackageInfo struct {
	BundleExecutable string `plist:"CFBundleExecutable,omitempty"`
}

type PackageManifest

type PackageManifest struct {
	SinfPaths []string `plist:"SinfPaths,omitempty"`
}

type PurchaseResult

type PurchaseResult struct {
	FailureType     string `plist:"failureType,omitempty"`
	CustomerMessage string `plist:"customerMessage,omitempty"`
	JingleDocType   string `plist:"jingleDocType,omitempty"`
	Status          int    `plist:"status,omitempty"`
}

type SearchOutput

type SearchOutput = SearchResult

type SearchResult

type SearchResult struct {
	Count   int   `json:"resultCount,omitempty"`
	Results []App `json:"results,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL