shared

package
v0.0.0-...-704e987 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any, S ~[]T](slice S, fn func(T) bool) S

func GetCountryHeader

func GetCountryHeader(country, separator string) string

func In

func In[K comparable](entry K, items ...K) bool

func Keys

func Keys[K comparable, V any, M ~map[K]V](m M) []K

func Map

func Map[I, O any, S ~[]I](slice S, fn func(I) O) []O

func MapCheck

func MapCheck[I, O any, S ~[]I](slice S, fn func(I) (O, bool)) []O

Types

type App

type App struct {
	ID                    int64     `json:"trackId"`
	AppID                 string    `json:"bundleId"`
	Title                 string    `json:"trackName"`
	URL                   string    `json:"trackViewUrl"`
	Description           string    `json:"description"`
	Genres                []string  `json:"genres"`
	GenreIDs              []string  `json:"genreIds"`
	PrimaryGenre          string    `json:"primaryGenreName"`
	PrimaryGenreID        int64     `json:"primaryGenreId"`
	ContentRating         string    `json:"contentAdvisoryRating"`
	Languages             []string  `json:"languageCodesISO2A"`
	Size                  string    `json:"fileSizeBytes"`
	RequiredOsVersion     string    `json:"minimumOsVersion"`
	Released              time.Time `json:"releaseDate"`
	Updated               time.Time `json:"currentVersionReleaseDate"`
	ReleaseNotes          string    `json:"releaseNotes"`
	Version               string    `json:"version"`
	Price                 float64   `json:"price"`
	Currency              string    `json:"currency"`
	Free                  bool      `json:"free"`
	DeveloperID           int64     `json:"artistId"`
	Developer             string    `json:"artistName"`
	DeveloperURL          string    `json:"artistViewUrl"`
	DeveloperWebsite      string    `json:"sellerUrl"`
	Score                 float64   `json:"averageUserRating"`
	Reviews               int64     `json:"userRatingCount"`
	CurrentVersionScore   float64   `json:"averageUserRatingForCurrentVersion"`
	CurrentVersionReviews int64     `json:"userRatingCountForCurrentVersion"`
	Screenshots           []string  `json:"screenshotUrls"`
	IpadScreenshots       []string  `json:"ipadScreenshotUrls"`
	AppleTVScreenshots    []string  `json:"appletvScreenshotUrls"`
	SupportedDevices      []string  `json:"supportedDevices"`
	// Icon
	Icon          string
	ArtworkURL512 string `json:"artworkUrl512"`
	ArtworkURL100 string `json:"artworkUrl100"`
	ArtworkURL60  string `json:"artworkUrl60"`

	// Tech fields
	WrapperType string  `json:"wrapperType"`
	Ratings     Ratings `json:"-"`
}

func (*App) Sanitize

func (app *App) Sanitize()

type AppSpec

type AppSpec struct {
	ID      int64
	AppID   string
	Lang    string
	Country string
	Ratings bool
}

func (AppSpec) Encode

func (spec AppSpec) Encode() string

func (*AppSpec) Validate

func (spec *AppSpec) Validate() error

type DataCategory

type DataCategory struct {
	Category   string   `json:"category"`
	Types      []string `json:"types"`
	Identifier string   `json:"identifier"`
}

type DeveloperSpec

type DeveloperSpec struct {
	ID      int64
	Lang    string
	Country string
}

func (DeveloperSpec) Encode

func (spec DeveloperSpec) Encode() string

func (*DeveloperSpec) Validate

func (spec *DeveloperSpec) Validate() error

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type ListSpec

type ListSpec struct {
	Count      int
	Country    string
	Collection string
	Category   string
}

func (ListSpec) Path

func (spec ListSpec) Path(path string) string

func (*ListSpec) Validate

func (spec *ListSpec) Validate() error

type Privacy

type Privacy struct {
	Categories  []DataCategory `json:"categories"`
	Description string         `json:"description"`
	Identifier  string         `json:"identifier"`
	Type        string         `json:"type"`
	Purposes    []Purpose      `json:"purposes"`
}

type Purpose

type Purpose struct {
	Categories []DataCategory `json:"categories"`
	Identifier string         `json:"identifier"`
	Purpose    string         `json:"purpose"`
}

type QueryParams

type QueryParams interface {
	Encode() string
}

type Ratings

type Ratings struct {
	Total     int64         `json:"total,omitempty"`
	Histogram map[int]int64 `json:"histogram,omitempty"`
}

type RatingsSpec

type RatingsSpec struct {
	ID      int64
	Country string
}

func (*RatingsSpec) Validate

func (spec *RatingsSpec) Validate() error

type Review

type Review struct {
	ID       string    `json:"id"`
	Title    string    `json:"title"`
	Content  string    `json:"content"`
	UserName string    `json:"user_name"`
	UserURL  string    `json:"user_url"`
	Version  string    `json:"version"`
	Score    string    `json:"score"`
	URL      string    `json:"url"`
	Updated  time.Time `json:"updated"`
}

type ReviewsSpec

type ReviewsSpec struct {
	ID      int64
	AppID   string
	Page    int
	Sort    string
	Country string
}

func (ReviewsSpec) Path

func (spec ReviewsSpec) Path(path string) string

func (*ReviewsSpec) Validate

func (spec *ReviewsSpec) Validate() error

type SearchSpec

type SearchSpec struct {
	Query   string
	Lang    string
	Country string
	Count   int
	Page    int
	IDsOnly bool // if true apps will not parsed.
}

func (SearchSpec) Encode

func (spec SearchSpec) Encode() string

func (*SearchSpec) Validate

func (spec *SearchSpec) Validate() error

type Suggest

type Suggest struct {
	Term string `json:"term"`
	URL  string `json:"url"`
}

type SuggestSpec

type SuggestSpec struct {
	Query   string
	Country string
}

func (SuggestSpec) Encode

func (spec SuggestSpec) Encode() string

func (*SuggestSpec) Validate

func (spec *SuggestSpec) Validate() error

Jump to

Keyboard shortcuts

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