itunes

package
v1.261007.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package itunes provides a client for the iTunes Lookup API.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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 X-Apple-Store-Front requests such as ratings histograms and platform-specific storefront search.

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

func NormalizeCountryCode(country string) (string, error)

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

type Client struct {
	HTTPClient              *http.Client
	BaseURL                 string
	StorefrontSearchBaseURL string
}

Client is an iTunes public API client.

func NewClient

func NewClient() *Client

NewClient creates a new iTunes API client.

func (*Client) GetAllRatings

func (c *Client) GetAllRatings(
	ctx context.Context,
	appID string,
	workers int,
	newCountryContext func(context.Context) (context.Context, context.CancelFunc),
) (*GlobalRatings, error)

GetAllRatings fetches rating statistics for an app across all supported countries.

func (*Client) GetRatings

func (c *Client) GetRatings(ctx context.Context, appID, country string) (*AppRatings, error)

GetRatings fetches rating statistics for an app in a specific country.

func (*Client) LookupApp

func (c *Client) LookupApp(ctx context.Context, appID string, opts LookupOptions) (*App, error)

LookupApp fetches public App Store metadata for a single app ID.

func (*Client) LookupAppByBundleID added in v1.260701.0

func (c *Client) LookupAppByBundleID(ctx context.Context, bundleID string, opts LookupOptions) (*App, error)

LookupAppByBundleID fetches public App Store metadata for an exact bundle ID.

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) RankApp added in v1.260819.0

func (c *Client) RankApp(
	ctx context.Context,
	appID string,
	term string,
	country string,
	platform PublicSearchPlatform,
) (PublicRankResult, error)

RankApp reports an app's position in a public App Store search result window.

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

type LookupOptions struct {
	Country               string
	IncludeSoftwareEntity bool
}

LookupOptions controls /lookup behavior.

type PublicRankResult added in v1.260819.0

type PublicRankResult struct {
	Found       bool
	Rank        *int
	ResultCount int
}

PublicRankResult reports whether an app appears in an ordered result window.

type PublicSearchPlatform added in v1.260819.0

type PublicSearchPlatform string

PublicSearchPlatform identifies a public App Store software surface.

const (
	// PublicSearchPlatformIOS selects the iOS App Store software surface.
	PublicSearchPlatformIOS PublicSearchPlatform = "IOS"
	// PublicSearchPlatformTVOS selects the Apple TV App Store software surface.
	PublicSearchPlatformTVOS PublicSearchPlatform = "TV_OS"
)

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.

Jump to

Keyboard shortcuts

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