Documentation
¶
Overview ¶
Package itunes provides a client for the iTunes Lookup API.
Index ¶
- Variables
- func AllCountries() []string
- func AllPublicCountries() []string
- func NormalizeCountryCode(country string) (string, error)
- type App
- type AppRatings
- type Client
- func (c *Client) GetAllRatings(ctx context.Context, appID string, workers int) (*GlobalRatings, error)
- func (c *Client) GetRatings(ctx context.Context, appID, country string) (*AppRatings, error)
- func (c *Client) LookupApp(ctx context.Context, appID string, opts LookupOptions) (*App, error)
- func (c *Client) LookupApps(ctx context.Context, ids []string, opts LookupOptions) (map[string]App, error)
- func (c *Client) SearchApps(ctx context.Context, term, country string, limit int) ([]SearchResult, error)
- type GlobalRatings
- type LookupOptions
- type SearchResult
- type Storefront
Constants ¶
This section is empty.
Variables ¶
var CountryNames = map[string]string{}/* 115 elements not displayed */
CountryNames maps country codes with custom display-name handling. Public-only countries not listed here fall back to CLDR English names.
var Storefronts = map[string]string{}/* 115 elements not displayed */
Storefronts maps a subset of public App Store country codes to Apple storefront IDs. These IDs are required for the X-Apple-Store-Front header when fetching ratings histograms.
Functions ¶
func AllCountries ¶
func AllCountries() []string
AllCountries returns a sorted list of the histogram storefront countries.
func AllPublicCountries ¶
func AllPublicCountries() []string
AllPublicCountries returns a sorted list of all public App Store country codes.
func NormalizeCountryCode ¶
NormalizeCountryCode validates and normalizes a storefront country code.
Types ¶
type App ¶
type App struct {
AppID int64 `json:"appId"`
Name string `json:"name"`
BundleID string `json:"bundleId"`
Country string `json:"country,omitempty"`
CountryName string `json:"countryName,omitempty"`
URL string `json:"url"`
ArtworkURL string `json:"artworkUrl"`
SellerName string `json:"sellerName"`
PrimaryGenreName string `json:"primaryGenreName"`
Genres []string `json:"genres,omitempty"`
Version string `json:"version"`
Description string `json:"description"`
Price float64 `json:"price"`
FormattedPrice string `json:"formattedPrice"`
Currency string `json:"currency"`
AverageRating float64 `json:"averageRating"`
RatingCount int64 `json:"ratingCount"`
CurrentVersionRating float64 `json:"currentVersionRating"`
CurrentVersionCount int64 `json:"currentVersionCount"`
}
App contains public App Store storefront metadata for a single app.
type AppRatings ¶
type AppRatings struct {
AppID int64 `json:"appId"`
AppName string `json:"appName"`
Country string `json:"country"`
CountryName string `json:"countryName,omitempty"`
AverageRating float64 `json:"averageRating"`
RatingCount int64 `json:"ratingCount"`
CurrentVersionRating float64 `json:"currentVersionRating,omitempty"`
CurrentVersionCount int64 `json:"currentVersionCount,omitempty"`
Histogram map[int]int64 `json:"histogram,omitempty"`
}
AppRatings contains rating statistics for an app in a single country.
type Client ¶
Client is an iTunes public API client.
func (*Client) GetAllRatings ¶
func (c *Client) GetAllRatings(ctx context.Context, appID string, workers int) (*GlobalRatings, error)
GetAllRatings fetches rating statistics for an app across all supported countries.
func (*Client) GetRatings ¶
GetRatings fetches rating statistics for an app in a specific country.
func (*Client) LookupApps ¶
func (c *Client) LookupApps(ctx context.Context, ids []string, opts LookupOptions) (map[string]App, error)
LookupApps fetches public App Store metadata for one or more app IDs.
func (*Client) SearchApps ¶
func (c *Client) SearchApps(ctx context.Context, term, country string, limit int) ([]SearchResult, error)
SearchApps searches the public App Store in a single storefront.
type GlobalRatings ¶
type GlobalRatings struct {
AppID int64 `json:"appId"`
AppName string `json:"appName"`
AverageRating float64 `json:"averageRating"`
TotalCount int64 `json:"totalCount"`
CountryCount int `json:"countryCount"`
Histogram map[int]int64 `json:"histogram,omitempty"`
ByCountry []AppRatings `json:"byCountry"`
}
GlobalRatings contains aggregated rating statistics across all countries.
type LookupOptions ¶
LookupOptions controls /lookup behavior.
type SearchResult ¶
type SearchResult struct {
AppID int64 `json:"appId"`
Name string `json:"name"`
BundleID string `json:"bundleId"`
SellerName string `json:"sellerName"`
Country string `json:"country"`
CountryName string `json:"countryName,omitempty"`
URL string `json:"url"`
ArtworkURL string `json:"artworkUrl"`
PrimaryGenreName string `json:"primaryGenreName"`
FormattedPrice string `json:"formattedPrice"`
Currency string `json:"currency"`
AverageRating float64 `json:"averageRating"`
RatingCount int64 `json:"ratingCount"`
}
SearchResult contains public App Store search data for a single app result.
type Storefront ¶
type Storefront struct {
Country string `json:"country"`
CountryName string `json:"countryName"`
StorefrontID string `json:"storefrontId"`
}
Storefront contains public storefront metadata for a single country.
func ListStorefronts ¶
func ListStorefronts() []Storefront
ListStorefronts returns storefront metadata in deterministic country order.