apple

package
v0.0.0-...-77573b0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyLoggedIn = errors.New("you are already logged in")
	ErrNotLoggedIn     = errors.New("you are not logged in")
	ErrHTTPError       = errors.New("http error occurred")
	ErrNoResults       = errors.New("no results found")
)

Functions

This section is empty.

Types

type AppItem

type AppItem struct {
	TrackID                   int        `json:"trackId"`
	TrackName                 string     `json:"trackName"`
	BundleID                  string     `json:"bundleId"`
	MinOS                     string     `json:"minimumOsVersion"`
	ArtistID                  int        `json:"artistId"`
	ArtistName                string     `json:"artistName"`
	Price                     float64    `json:"price"`
	Genres                    []string   `json:"genres"`
	PrimaryGenreID            int        `json:"primaryGenreId"`
	PrimaryGenre              string     `json:"primaryGenreName"`
	SellerName                string     `json:"sellerName"`
	Version                   string     `json:"version"`
	ReleaseNote               string     `json:"releaseNotes"`
	FileSizeBytes             string     `json:"fileSizeBytes"`
	ReleaseDate               *time.Time `json:"releaseDate"`
	CurrentVersionReleaseDate *time.Time `json:"currentVersionReleaseDate"`
}

AppItem represents an app in the Apple App Store

type AppleClient

type AppleClient struct {
	Cred *AppleCredentials
}

func NewAppleClient

func NewAppleClient() *AppleClient

func NewAppleClientWithCred

func NewAppleClientWithCred(cred *AppleCredentials) *AppleClient

func (*AppleClient) Download

func (c *AppleClient) Download(trackId, dest string) error

func (*AppleClient) LoadCredentials

func (c *AppleClient) LoadCredentials(credentialPath string) error

LoadCredentials loads the Apple credentials from a file

func (*AppleClient) Login

func (c *AppleClient) Login(opt LoginOptions) error

Login logs in to Apple services with the Apple ID and password

func (*AppleClient) SaveCredentials

func (c *AppleClient) SaveCredentials(credentialPath string) error

SaveCredentials saves the Apple credentials to a file

func (*AppleClient) Search

func (c *AppleClient) Search(opt SearchOptions) ([]AppItem, error)

Search searches for an app in the Apple App Store (login not required)

type AppleCredentials

type AppleCredentials struct {
	// AppleID is the Apple ID to login, usually an email address
	AppleID string `json:"apple_id"`
	// Password is the password for the Apple ID
	Password string `json:"password"`
	// PasswordToken is the access token for Apple services, this is returned after a successful login
	PasswordToken string `json:"password_token"`
	// DSID represents the user's Apple ID, this is returned after a successful login
	DSID string `json:"dsid"`
	// Region is the region of the Apple ID, ISO 3166-1 alpha-2 country code
	Region string `json:"region"`
	// GUID is the MAC address of the device, without colons
	GUID string `json:"guid"`
	// Cookies is the cookies for the Apple services
	Cookies []*http.Cookie `json:"cookies"`
}

func (*AppleCredentials) StoreFront

func (c *AppleCredentials) StoreFront() string

StoreFront returns the Apple StoreFront code for the region

type LoginOptions

type LoginOptions struct {
	AppleID    string
	Password   string
	MacAddress string // MAC address of the device, without colons. If empty, it will use the device's actual MAC address
	Region     string
}

type SearchOptions

type SearchOptions struct {
	Region string
	Query  string
	Limit  int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳