catalog

package
v0.0.0-...-78f5a99 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages []language.Tag

Functions

This section is empty.

Types

type AlternateID

type AlternateID struct {
	Type  string `json:"Type,omitempty"`
	Value string `json:"Value,omitempty"`
}

type Content

type Content struct {
	ID               string   `json:"Id,omitempty"`
	MaxClientVersion string   `json:"MaxClientVersion,omitempty"`
	MinClientVersion string   `json:"MinClientVersion,omitempty"`
	Tags             []string `json:"Tags,omitempty"`
	Type             string   `json:"Type,omitempty"`
	URL              string   `json:"Url,omitempty"`
}
type DeepLink struct {
	Platform string `json:"Platform,omitempty"`
	URL      string `json:"Url,omitempty"`
}

type Dictionary

type Dictionary[T comparable] struct {
	// contains filtered or unexported fields
}

func (*Dictionary[T]) Lookup

func (dict *Dictionary[T]) Lookup(key string) (zero T, ok bool)

func (*Dictionary[T]) Map

func (dict *Dictionary[T]) Map() map[string]T

func (*Dictionary[T]) MarshalJSON

func (dict *Dictionary[T]) MarshalJSON() ([]byte, error)

func (*Dictionary[T]) Message

func (dict *Dictionary[T]) Message(tag language.Tag) (zero T)

func (*Dictionary[T]) Neutral

func (dict *Dictionary[T]) Neutral() (zero T)

func (*Dictionary[T]) UnmarshalJSON

func (dict *Dictionary[T]) UnmarshalJSON(b []byte) error

type Filter

type Filter struct {
	// Count is the number of returned items included in the SearchResult. The maximum value is 50 and is stored
	// to 10 service-side by default.
	Count int `json:"Count,omitempty"`
	// ContinuationToken is the opaque token used for continuing the query of Search, if any are available. It is
	// normally filled from SearchResult.ContinuationToken.
	ContinuationToken string `json:"ContinuationToken,omitempty"`
	// CustomTags is the optional properties associated with the request.
	CustomTags map[string]any `json:"CustomTags,omitempty"`
	// Entity is the nullable entity.Key to perform any actions.
	Entity *entity.Key `json:"Entity,omitempty"`
	// Filter is an OData query for filtering the SearchResult.
	Filter string `json:"Filter,omitempty"`
	// OrderBy is an OData sort query for sorting the index of SearchResult. Defaulted to relevance.
	OrderBy string `json:"OrderBy,omitempty"`
	// Term is the string terms to be searched.
	Term string `json:"Search,omitempty"`
	// Select is an OData selection query for filtering the fields of returned items included in the SearchResult.
	Select string `json:"Select,omitempty"`
	// Store ...
	Store *StoreReference `json:"Store,omitempty"`

	// Language is used as the `Accept-Language` header of the request and is generally used to display
	// a localized dictionaries catalog items. It must be one of the supported Languages, otherwise it
	// will be ignored by the request hook.
	Language language.Tag `json:"-"`
}

func (Filter) Search

func (f Filter) Search(t title.Title, tok *entity.Token) (*SearchResult, error)

Search will perform the search query in the catalog using the title. An authorization entity is optionally required in the service-side.

type FilterOptions

type FilterOptions struct {
	Filter          string `json:"Filter,omitempty"`
	IncludeAllItems bool   `json:"IncludeAllItems,omitempty"`
}

type Image

type Image struct {
	ID   string `json:"Id,omitempty"`
	Tag  string `json:"Tag,omitempty"`
	Type string `json:"Type,omitempty"`
	URL  string `json:"Url,omitempty"`
}

type Item

type Item struct {
	AlternateIDs      []AlternateID              `json:"AlternateIds,omitempty"`
	ContentType       string                     `json:"ContentType,omitempty"`
	Contents          []Content                  `json:"Contents,omitempty"`
	CreationDate      time.Time                  `json:"CreationDate,omitempty"`
	CreatorEntity     entity.Key                 `json:"CreatorEntity,omitempty"`
	DeepLinks         []DeepLink                 `json:"DeepLinks,omitempty"`
	DefaultStackID    string                     `json:"DefaultStackId,omitempty"` // new?
	Description       Dictionary[string]         `json:"Description,omitempty"`
	DisplayProperties map[string]json.RawMessage `json:"DisplayProperties,omitempty"`
	DisplayVersion    string                     `json:"DisplayVersion,omitempty"`
	ETag              string                     `json:"ETag,omitempty"`
	EndDate           time.Time                  `json:"EndDate,omitempty"`
	ID                string                     `json:"Id,omitempty"`
	Images            []Image                    `json:"Images,omitempty"`
	Hidden            *bool                      `json:"IsHidden,omitempty"`
	ItemReferences    []ItemReference            `json:"ItemReferences,omitempty"`
	Keywords          Dictionary[*Keyword]       `json:"Keywords,omitempty"`
	LastModifiedDate  time.Time                  `json:"LastModifiedDate,omitempty"`
	Moderation        ModerationState            `json:"Moderation,omitempty"`
	Platforms         []string                   `json:"Platforms,omitempty"`
	PriceOptions      PriceOptions               `json:"PriceOptions,omitempty"`
	Rating            Rating                     `json:"Rating,omitempty"`
	StartDate         time.Time                  `json:"StartDate,omitempty"`
	StoreDetails      StoreDetails               `json:"StoreDetails,omitempty"`
	Tags              []string                   `json:"Tags,omitempty"`
	Title             Dictionary[string]         `json:"Title,omitempty"`
	Type              ItemType                   `json:"Type,omitempty"`
}

type ItemReference

type ItemReference struct {
	Amount       int          `json:"Amount,omitempty"`
	ID           string       `json:"Id,omitempty"`
	PriceOptions PriceOptions `json:"PriceOptions,omitempty"`
}

type ItemType

type ItemType string
const (
	ItemTypeBundle      ItemType = "bundle"
	ItemTypeCatalogItem ItemType = "catalogItem"
	ItemTypeCurrency    ItemType = "currency"
	ItemTypeStore       ItemType = "store"
	ItemTypeUGC         ItemType = "ugc"
)

type Keyword

type Keyword []string

func (*Keyword) MarshalJSON

func (k *Keyword) MarshalJSON() ([]byte, error)

func (*Keyword) UnmarshalJSON

func (k *Keyword) UnmarshalJSON(b []byte) error

type ModerationState

type ModerationState struct {
	LastModifiedDate time.Time        `json:"LastModifiedDate,omitempty"`
	Reason           string           `json:"Reason,omitempty"`
	Status           ModerationStatus `json:"Status,omitempty"`
}

type ModerationStatus

type ModerationStatus string
const (
	ModerationStatusApproved           ModerationStatus = "Approved"
	ModerationStatusAwaitingModeration ModerationStatus = "AwaitingModeration"
	ModerationStatusRejected           ModerationStatus = "Rejected"
	ModerationStatusUnknown            ModerationStatus = "Unknown"
)

type Price

type Price struct {
	Amounts               []PriceAmount `json:"Amounts,omitempty"`
	UnitDurationInSeconds int           `json:"UnitDurationInSeconds,omitempty"`
}

type PriceAmount

type PriceAmount struct {
	Amount int    `json:"Amount,omitempty"`
	ItemID string `json:"ItemId,omitempty"`
}

type PriceAmountOverride

type PriceAmountOverride struct {
	FixedValue int    `json:"FixedValue,omitempty"`
	ItemID     string `json:"ItemId,omitempty"`
	Multiplier int    `json:"Multiplier,omitempty"`
}

type PriceOptions

type PriceOptions []Price

func (PriceOptions) MarshalJSON

func (opts PriceOptions) MarshalJSON() ([]byte, error)

func (*PriceOptions) UnmarshalJSON

func (opts *PriceOptions) UnmarshalJSON(b []byte) error

type PriceOptionsOverride

type PriceOptionsOverride []PriceOverride

func (PriceOptionsOverride) MarshalJSON

func (opts PriceOptionsOverride) MarshalJSON() ([]byte, error)

func (*PriceOptionsOverride) UnmarshalJSON

func (opts *PriceOptionsOverride) UnmarshalJSON(b []byte) error

type PriceOverride

type PriceOverride struct {
	Amounts []PriceAmountOverride `json:"Amounts,omitempty"`
}

type Query

type Query struct {
	AlternateID *AlternateID   `json:"AlternateId,omitempty"`
	CustomTags  map[string]any `json:"CustomTags,omitempty"`
	Entity      *entity.Key    `json:"Entity,omitempty"`
	ID          string         `json:"Id,omitempty"`
}

func (Query) Item

func (q Query) Item(t title.Title, tok *entity.Token) (zero Item, err error)

type Rating

type Rating struct {
	Average    float32 `json:"Average,omitempty"`
	Count1Star int     `json:"Count1Star,omitempty"`
	Count2Star int     `json:"Count2Star,omitempty"`
	Count3Star int     `json:"Count3Star,omitempty"`
	Count4Star int     `json:"Count4Star,omitempty"`
	Count5Star int     `json:"Count5Star,omitempty"`
	TotalCount int     `json:"TotalCount,omitempty"`
}

type SearchResult

type SearchResult struct {
	ContinuationToken string `json:"ContinuationToken,omitempty"`
	Items             []Item `json:"Items,omitempty"`
}

type StoreDetails

type StoreDetails struct {
	FilterOptions        FilterOptions        `json:"FilterOptions,omitempty"`
	PriceOptionsOverride PriceOptionsOverride `json:"PriceOptionsOverride,omitempty"`
}

type StoreReference

type StoreReference struct {
	AlternateID AlternateID `json:"AlternateId,omitempty"`
	ID          string      `json:"Id,omitempty"`
}

Jump to

Keyboard shortcuts

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