itunes_search_go

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 11 Imported by: 0

README

iTunes-search-go

GitHub go.mod Go version GoDoc Go Report Card

Go client for iTunes search API. See more documentation here https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/

Documentation

Overview

Package itunes_search_go provides client for access to iTunes API. See https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoResults returned when itunes api response contains no results.
	ErrNoResults = errors.New("no results")
	// ErrImpreciseResults returned when itunes api response contains more than 1 result for exact app id.
	ErrImpreciseResults = errors.New("imprecise results")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// Lookup returns LookupResponse for application by it's id.
	Lookup(ctx context.Context, id int, opts ...option.LookupOption) (LookupResponse, error)
}

Client is an contract for itunes api.

func New

func New() Client

New returns itunes api client.

type LookupResponse

type LookupResponse struct {
	// ResultCount contains info about total found results number.
	ResultCount int64 `json:"resultCount"`
	// Results is an array with all found results.
	Results []Result `json:"results"`
}

LookupResponse represents response of itunes api lookup endpoint.

func UnmarshalLookupResponse

func UnmarshalLookupResponse(data []byte) (LookupResponse, error)

func (*LookupResponse) Marshal

func (l *LookupResponse) Marshal() ([]byte, error)

func (LookupResponse) Result

func (l LookupResponse) Result() (Result, error)

Result takes care of check the results count and shortcut to get the first result from array (lookup always contains 1 result in array).

type Result

type Result struct {
	ScreenshotURLs                     []string      `json:"screenshotUrls"`
	IpadScreenshotURLs                 []string      `json:"ipadScreenshotUrls"`
	AppletvScreenshotURLs              []interface{} `json:"appletvScreenshotUrls"`
	ArtworkURL60                       string        `json:"artworkUrl60"`
	ArtworkURL512                      string        `json:"artworkUrl512"`
	ArtworkURL100                      string        `json:"artworkUrl100"`
	ArtistViewURL                      string        `json:"artistViewUrl"`
	SupportedDevices                   []string      `json:"supportedDevices"`
	Advisories                         []string      `json:"advisories"`
	IsGameCenterEnabled                bool          `json:"isGameCenterEnabled"`
	Kind                               string        `json:"kind"`
	Features                           []string      `json:"features"`
	TrackCensoredName                  string        `json:"trackCensoredName"`
	LanguageCodesISO2A                 []string      `json:"languageCodesISO2A"`
	FileSizeBytes                      string        `json:"fileSizeBytes"`
	SellerURL                          string        `json:"sellerUrl"`
	ContentAdvisoryRating              string        `json:"contentAdvisoryRating"`
	AverageUserRatingForCurrentVersion float64       `json:"averageUserRatingForCurrentVersion"`
	UserRatingCountForCurrentVersion   int64         `json:"userRatingCountForCurrentVersion"`
	AverageUserRating                  float64       `json:"averageUserRating"`
	TrackViewURL                       string        `json:"trackViewUrl"`
	TrackContentRating                 string        `json:"trackContentRating"`
	TrackID                            int64         `json:"trackId"`
	TrackName                          string        `json:"trackName"`
	ReleaseDate                        string        `json:"releaseDate"`
	GenreIDS                           []string      `json:"genreIds"`
	FormattedPrice                     string        `json:"formattedPrice"`
	PrimaryGenreName                   string        `json:"primaryGenreName"`
	IsVppDeviceBasedLicensingEnabled   bool          `json:"isVppDeviceBasedLicensingEnabled"`
	MinimumOSVersion                   string        `json:"minimumOsVersion"`
	SellerName                         string        `json:"sellerName"`
	CurrentVersionReleaseDate          string        `json:"currentVersionReleaseDate"`
	ReleaseNotes                       string        `json:"releaseNotes"`
	PrimaryGenreID                     int64         `json:"primaryGenreId"`
	Version                            string        `json:"version"`
	WrapperType                        string        `json:"wrapperType"`
	Currency                           string        `json:"currency"`
	Description                        string        `json:"description"`
	ArtistID                           int64         `json:"artistId"`
	ArtistName                         string        `json:"artistName"`
	Genres                             []string      `json:"genres"`
	Price                              float64       `json:"price"`
	BundleID                           string        `json:"bundleId"`
	UserRatingCount                    int64         `json:"userRatingCount"`
}

Result represents result entity from itunes api lookup.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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