Documentation ¶
Overview ¶
Package trakt provides bindings for all of Trakt API calls.
Index ¶
- Constants
- Variables
- func FormatURLPath(format string, params ...interface{}) string
- func IDPath(id SearchID) string
- func Int64(v int64) *int64
- func Production()
- func Staging()
- func WithConfig(bk *BackendConfig)
- type AccountActivity
- type Action
- type ActivityType
- type AddRatingsParams
- type AddRatingsResult
- type AddReplyParams
- type AddToCollectionParams
- type AddToCollectionResult
- type AddToHistoryParams
- type AddToHistoryResult
- type AddToWatchListParams
- type AddToWatchListResult
- type Airs
- type Alias
- type AliasIterator
- type AnticipatedMovie
- type AnticipatedMovieIterator
- type AnticipatedShow
- type AnticipatedShowIterator
- type Audio
- type AuthorizationURLParams
- type BackendConfig
- type BaseClient
- type BasicCalendarParams
- type BasicIterator
- type BasicListParams
- type BasicParams
- type BoxOfficeListParams
- type BoxOfficeMovie
- type BoxOfficeMovieIterator
- type CalendarMovie
- type CalendarMovieIterator
- type CalendarParams
- type CalendarShow
- type CalendarShowIterator
- type CastAndCrew
- type CastCredit
- type CastEntry
- type Certification
- type CertificationIterator
- type ChangeSet
- type Checkin
- type CollectedEpisode
- type CollectedEpisodeProgress
- type CollectedMovie
- type CollectedProgress
- type CollectedSeason
- type CollectedSeasonProgress
- type CollectedShow
- type CollectionIterator
- type Comment
- type CommentActivity
- type CommentIterator
- type CommentListParams
- type CommentType
- type CommentWithMediaElement
- type CommentWithMediaElementIterator
- type Condition
- type Country
- type CountryIterator
- type Credits
- type CrewCredit
- type CrewEntry
- type Department
- type DeviceCode
- type Episode
- type EpisodeActivity
- type EpisodeCollectionParams
- type EpisodeHistoryParams
- type EpisodeIterator
- type EpisodeListParams
- type EpisodeRatingParams
- type EpisodeWithTranslations
- type EpisodeWithTranslationsIterator
- type Error
- type ErrorCode
- type ErrorHandler
- type Event
- type ExchangeCodeParams
- type ExtendedListParams
- type ExtendedParams
- type ExtendedType
- type FilterListParams
- type Filters
- type Gender
- type GenericElement
- type GenericElementParams
- type GenericMediaElement
- type GenericMediaElementIterator
- type Genre
- type GenreIterator
- type GetListParams
- type HDR
- type History
- type HistoryIterator
- type ID
- type IDLookupParams
- type IMDB
- type Iterator
- type Language
- type LanguageIterator
- type LastActivity
- type Level
- type LeveledLogger
- type LeveledLoggerInterface
- type List
- type ListActivity
- type ListByTypeParams
- type ListCollectionParams
- type ListHistoryParams
- type ListIterator
- type ListParams
- type ListParamsContainer
- type ListPlaybackParams
- type ListRatingParams
- type ListType
- type ListWatchListParams
- type ListWatchedParams
- type MediaCollectionParams
- type MediaHistoryParams
- type MediaIDs
- type MediaRatingParams
- type MediaRemovalParams
- type MediaType
- type MediaWatchListParams
- type Metadata
- type Movie
- type MovieActivity
- type MovieIterator
- type MovieWithStatistics
- type MovieWithStatisticsIterator
- type Network
- type NetworkIterator
- type NotFound
- type Params
- type ParamsContainer
- type Person
- type Playback
- type PlaybackIterator
- type PollCodeParams
- type PollResult
- type PostCommentParams
- type Privacy
- type ProgressParams
- type Range
- type Rating
- type RatingDistribution
- type RatingIterator
- type RecentCommentParams
- type RecentList
- type RecentListIterator
- type RecentlyUpdatedListParams
- type RecentlyUpdatedMovie
- type RecentlyUpdatedMovieIterator
- type RecentlyUpdatedShow
- type RecentlyUpdatedShowIterator
- type RecommendationListParams
- type RefreshTokenParams
- type Release
- type ReleaseIterator
- type ReleaseListParams
- type ReleaseType
- type RemoveFromCollectionParams
- type RemoveFromCollectionResult
- type RemoveFromHistoryParams
- type RemoveFromHistoryResult
- type RemoveFromWatchListParams
- type RemoveFromWatchListResult
- type RemovePlaybackParams
- type RemoveRatingsParams
- type RemoveRatingsResult
- type Resolution
- type RevokeTokenParams
- type Scrobble
- type ScrobbleParams
- type SearchField
- type SearchID
- type SearchQueryParams
- type SearchResult
- type SearchResultIterator
- type Season
- type SeasonActivity
- type SeasonCollectionParams
- type SeasonHistoryParams
- type SeasonIterator
- type SeasonRatingParams
- type SeasonRemovalParams
- type SeasonWatchListParams
- type SeasonWithEpisodes
- type SeasonWithEpisodesIterator
- type SharingParams
- type Show
- type ShowActivity
- type ShowCollectionParams
- type ShowHistoryParams
- type ShowIterator
- type ShowRatingParams
- type ShowRemovalParams
- type ShowWatchListParams
- type ShowWithStatistics
- type ShowWithStatisticsIterator
- type Slug
- type SortDirection
- type SortPreference
- type SortType
- type StartCheckinParams
- type Statistics
- type Status
- type TMDB
- type TVDB
- type TextQueryFilters
- type TimePeriod
- type TimePeriodListParams
- type Token
- type Translation
- type TranslationIterator
- type TranslationListParams
- type TrendingCommentParams
- type TrendingMovie
- type TrendingMovieIterator
- type TrendingShow
- type TrendingShowIterator
- type Type
- type UpdateCommentParams
- type UpdatedCommentParams
- type User
- type UserImages
- type UserIterator
- type UserLike
- type UserLikeIterator
- type VipStatus
- type WatchListEntry
- type WatchListEntryIterator
- type WatchedEpisode
- type WatchedEpisodeProgress
- type WatchedIterator
- type WatchedMovie
- type WatchedProgress
- type WatchedSeason
- type WatchedSeasonProgress
- type WatchedShow
Constants ¶
const APIVersion string = "2"
APIVersion is the currently supported API version
const All string = `all`
All the all constant, this is shared between different types so cant be allocated to a specific filter.
const NoLimit int64 = -1
NoLimit defines that we have no limit on the amount of pages to paginate through.
Variables ¶
var ( // key is the Trakt API key used globally in the binding. Key string )
Functions ¶
func FormatURLPath ¶
FormatURLPath takes a format string (of the kind used in the fmt package) representing a URL path with a number of parameters that belong in the path and returns a formatted string.
we perform a quick type comparison to handle some well-known types including a SearchID or a fmt.Stringer or string or any primitive int/uint type, it any of the parameters are not of these types, then we ignore the value as it should only be of of these three types. this would cause come very noticeable formatting errors.
func WithConfig ¶
func WithConfig(bk *BackendConfig)
WithConfig sets up the API with the supplied config.
Types ¶
type AccountActivity ¶
type ActivityType ¶
type ActivityType string
const ( ActivityTypeAired ActivityType = "aired" ActivityTypeWatched ActivityType = "watched" )
type AddRatingsParams ¶
type AddRatingsParams struct { Params Movies []*MediaRatingParams `json:"movies,omitempty" url:"-"` Seasons []*MediaRatingParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaRatingParams `json:"episodes,omitempty" url:"-"` Shows []*ShowRatingParams `json:"shows,omitempty" url:"-"` }
type AddRatingsResult ¶
type AddRatingsResult = AddToCollectionResult
type AddReplyParams ¶
type AddReplyParams = UpdateCommentParams
AddReplyParams represents parameters which are required to add a reply to a comment.
type AddToCollectionParams ¶
type AddToCollectionParams struct { Params Movies []*MediaCollectionParams `json:"movies,omitempty" url:"-"` Seasons []*MediaCollectionParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaCollectionParams `json:"episodes,omitempty" url:"-"` Shows []*ShowCollectionParams `json:"shows,omitempty" url:"-"` }
type AddToCollectionResult ¶
type AddToHistoryParams ¶
type AddToHistoryParams struct { Params Movies []*MediaHistoryParams `json:"movies,omitempty" url:"-"` Seasons []*MediaHistoryParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaHistoryParams `json:"episodes,omitempty" url:"-"` Shows []*ShowHistoryParams `json:"shows,omitempty" url:"-"` }
type AddToHistoryResult ¶
type AddToHistoryResult = AddToCollectionResult
type AddToWatchListParams ¶
type AddToWatchListParams struct { Params Movies []*MediaWatchListParams `json:"movies,omitempty" url:"-"` Seasons []*MediaWatchListParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaWatchListParams `json:"episodes,omitempty" url:"-"` Shows []*ShowWatchListParams `json:"shows,omitempty" url:"-"` }
type AddToWatchListResult ¶
type AddToWatchListResult = AddToCollectionResult
type Alias ¶
type Alias struct { // Name the aliased name of the show or movie. Name string `json:"name"` // Code the language code. Code string `json:"code"` }
Alias represents an alias for a show or movie this is where the name is different based on the language.
type AliasIterator ¶
type AliasIterator struct{ BasicIterator }
AliasIterator represents a list of alias entries which can be iterated.
func (*AliasIterator) Alias ¶
func (a *AliasIterator) Alias() (*Alias, error)
Alias attempts to return an Alias entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type AnticipatedMovie ¶
type AnticipatedMovieIterator ¶
type AnticipatedMovieIterator struct{ Iterator }
func (*AnticipatedMovieIterator) Movie ¶
func (a *AnticipatedMovieIterator) Movie() (*AnticipatedMovie, error)
type AnticipatedShow ¶
type AnticipatedShowIterator ¶
type AnticipatedShowIterator struct{ Iterator }
func (*AnticipatedShowIterator) Show ¶
func (a *AnticipatedShowIterator) Show() (*AnticipatedShow, error)
type Audio ¶
type Audio string
const ( AudioLPCM Audio = "lpcm" AudioMP3 Audio = "mp3" AudioAAC Audio = "acc" AudioOGG Audio = "ogg" AudioWMA Audio = "wma" AudioDTS Audio = "dts" AudioDTSMA Audio = "dts_ma" AudioDTSHR Audio = "dts_hr" AudioDTSX Audio = "dts_x" AudioAuro3D Audio = "auro_3d" AudioDolbyDigital Audio = "dolby_digital" AudioDolbyDigitalPlus Audio = "dolby_digital_plus" AudioDolbyAtmos Audio = "dolby_atmos" AudioDolbyTrueHD Audio = "dolby_truehd" AudioDolbyPrologic Audio = "dolby_prologic" )
type AuthorizationURLParams ¶
type AuthorizationURLParams struct { // BasicParams is the basic parameters which all requests can take. BasicParams // RedirectURI the URL to redirect to after the user accepts or denies // the request to allow access to your app. The access code is send to this // URL on a success. This has to match the URL set in the App settings // on Trakt. RedirectURI string `url:"redirect_uri" json:"-"` // State this should be a random unique string which is send with the request // to authenticate. When trakt redirects back to your app, this will be sent back // so you can perform a check to see if its the same that you sent originally. State string `url:"state" json:"-"` }
AuthorizationURLParams the parameters required to generate the authorization URL which is used to authenticate users via OAuth 2.
type BackendConfig ¶
type BackendConfig struct { // client is an HTTP client instance to use when making API requests. // // If left unset, it'll be set to a default HTTP client for the package. HTTPClient *http.Client // leveledLogger is the logger that the backend will use to log errors, // warnings, and informational messages. LeveledLogger LeveledLoggerInterface // maxNetworkRetries sets maximum number of times that the library will // retry requests that appear to have failed due to an intermittent // problem. // // Defaults to 0. MaxNetworkRetries int // URL is the base URL to use for API paths. URL string // contains filtered or unexported fields }
BackendConfig is used to configure a new Trakt backend.
type BaseClient ¶
type BaseClient interface { // NewIterator creates a new iterator which paginates through a list of results until the // end or the defined limit. the iterator uses the supplied method and path to create the URL // to use. NewIterator(method, path string, p ListParamsContainer) Iterator // NewIteratorWithCondition creates a new iterator which paginates through a list of results // but with a condition which is invokes before every frame is queried to see if the params // are still valid. NewIteratorWithCondition(method, path string, p ListParamsContainer, cnd Condition) Iterator // NewIterator creates a new iterator which paginates through a list of results until the // end or the defined limit. the iterator uses the supplied method and path to create the URL // to use. // A simulated iterator is an iterator instance which implements the standard Iterator interface // but only actually loads for the first page, because there are API endpoints which return a list // but dont require pagination, this allows us to have a standard interface for all lists. NewSimulatedIterator(method, path string, p ListParamsContainer) Iterator // NewIteratorWithCondition creates a new iterator which paginates through a list of results // but with a condition which is invokes before every frame is queried to see if the params // are still valid. // A simulated iterator is an iterator instance which implements the standard Iterator interface // but only actually loads for the first page, because there are API endpoints which return a list // but dont require pagination, this allows us to have a standard interface for all lists. NewSimulatedIteratorWithCondition(method, path string, p ListParamsContainer, cnd Condition) Iterator // Call performs a simple HTTP call and unmarshals the result into v. Call(method, path string, params ParamsContainer, v interface{}) error // key returns the assigned clientID, this is mainly used for authorization. Key() string // OAuthURL returns the OAuthURL assigned to the config. OAuthURL() string }
BaseClient the base implementation of a client. this gives access to methods all clients will use without giving the client access to any of the underlined HTTP handling code.
func NewClient ¶
func NewClient() BaseClient
NewClient generates a new client which all other clients should inherit from.
type BasicCalendarParams ¶
type BasicCalendarParams struct { // BasicListParams is the parameters which all requests can take for listing // based operations where no OAuth token is required. BasicListParams // Filters a optional set of filters to apply to a query. Filters // StartDate the time to start from. StartDate time.Time `url:"-"` // Days the number of days from the StartDate to query up to. Days int64 `url:"-"` // Extended the level of detail to return. Extended ExtendedType `url:"extended"` }
CalendarParams the parameters required to perform queries against a calendar where no authorization is required.
type BasicIterator ¶
type BasicIterator interface { // Err retrieves any error that occurred performing // an operation to get a "frame". A frame represents a single // paginated set of results (the results for a single page) Err() error // Next moves the cursor to the next point in the results // performing an operation to retrieve the next result frame // from the API if required. Next() bool // Scan scans the current data into the supplied receiver. Scan(rcv interface{}) error // contains filtered or unexported methods }
BasicIterator represents an iterator which does not deal with paging. this can be used where the iterator does not require a page limit be set.
type BasicListParams ¶
type BasicListParams struct { // Context used for request. It may carry deadlines, cancelation signals, // and other request-scoped values across API boundaries and between // processes. // // Note that a cancelled or timed out context does not provide any // guarantee whether the operation was or was not completed on Stripe's API // servers. For certainty, you must either retry with the same idempotency // key or queryFunc the state of the API. Context context.Context `url:"-" json:"-"` // Headers may be used to provide extra header lines on the HTTP request. Headers http.Header `url:"-" json:"-"` Page *int64 `url:"page,omitempty" json:"-"` Limit *int64 `url:"limit,omitempty" json:"-"` }
BasicListParams is the structure that contains the common properties of any *ListParams structure, it is used when no OAuth token is required.
type BasicParams ¶
type BasicParams struct { // Context used for request. It may carry deadlines, cancelation signals, // and other request-scoped values across API boundaries and between // processes. // // Note that a cancelled or timed out context does not provide any // guarantee whether the operation was or was not completed on Stripe's API // servers. For certainty, you must either retry with the same idempotency // key or queryFunc the state of the API. Context context.Context `url:"-" json:"-"` // Headers may be used to provide extra header lines on the HTTP request. Headers http.Header `url:"-" json:"-"` }
BasicParams parameters which do not require an OAuth token.
type BoxOfficeListParams ¶
type BoxOfficeListParams = ExtendedParams
type BoxOfficeMovie ¶
type BoxOfficeMovieIterator ¶
type BoxOfficeMovieIterator struct{ BasicIterator }
func (*BoxOfficeMovieIterator) Movie ¶
func (m *BoxOfficeMovieIterator) Movie() (*BoxOfficeMovie, error)
type CalendarMovie ¶
type CalendarMovie struct { // Movie the movie information. Movie `json:"movie"` // Released when this movie was released. Released time.Time `json:"-"` }
CalendarMovie represents a movie with additional information relating to a calendar entry.
func (*CalendarMovie) UnmarshalJSON ¶
func (c *CalendarMovie) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements the Unmarshaller interface. allows us to parse the released date into a time.
type CalendarMovieIterator ¶
type CalendarMovieIterator struct{ Iterator }
CalendarMovieIterator represents a list of calendar movies which can be iterated.
type CalendarParams ¶
type CalendarParams struct { // ListParams is the parameters which all requests can take for listing // based operations. ListParams // Filters a optional set of filters to apply to a query. Filters // StartDate the time to start from. StartDate time.Time `url:"-"` // Days the number of days from the StartDate to query up to. Days int64 `url:"-"` // Extended the level of detail to return. Extended ExtendedType `url:"extended"` }
CalendarParams the parameters required to perform queries against a calendar where an OAuth token is required.
type CalendarShow ¶
type CalendarShow struct { // Show the show information. Show `json:"show"` // Episode the episode which is airing. Episode *Episode `json:"episode"` // FirstAired when this episode was first aired. FirstAired time.Time `json:"first_aired"` }
CalendarShow represents a show with additional information relating to a calendar entry.
type CalendarShowIterator ¶
type CalendarShowIterator struct{ Iterator }
CalendarShowIterator represents a list of calendar shows which can be iterated.
func (*CalendarShowIterator) Entry ¶
func (li *CalendarShowIterator) Entry() (*CalendarShow, error)
Entry attempts to return an CalendarShow entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type CastAndCrew ¶
type CastAndCrew struct { Cast []*CastEntry `json:"cast"` Crew map[Department][]*CrewEntry `json:"crew"` }
type CastCredit ¶
type CastCredit struct { Characters []string `json:"characters"` // contains filtered or unexported fields }
func (*CastCredit) UnmarshalJSON ¶
func (b *CastCredit) UnmarshalJSON(bytes []byte) error
type Certification ¶
type Certification struct { // Name the name of the certification. Name string `json:"name"` // Slug the URL compatible version of the certification Slug Slug `json:"slug"` // Description a description for the certification, can be empty. Description string `json:"description"` }
Certification represents a movie or TV Show age certification.
type CertificationIterator ¶
type CertificationIterator struct{ BasicIterator }
CertificationIterator represents a list of certification entries which can be iterated.
func (*CertificationIterator) Certification ¶
func (c *CertificationIterator) Certification() (*Certification, error)
Certification attempts to return an Certification entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type Checkin ¶
type Checkin struct { // WatchedAt when the user started watching this item. WatchedAt time.Time `json:"watched_at"` // contains filtered or unexported fields }
Checkin represents a manual checkin entry.
func (*Checkin) UnmarshalJSON ¶
UnmarshalJSON implements Unmarshaller interface. allows us to determine the type of entry it is from the data retrieved.
type CollectedEpisode ¶
type CollectedMovie ¶
type CollectedProgress ¶
type CollectedProgress struct { Seasons []*CollectedSeasonProgress `json:"seasons"` CollectedAt time.Time `json:"last_collected_at"` // contains filtered or unexported fields }
type CollectedSeason ¶
type CollectedSeason struct { Episodes []*CollectedEpisode // contains filtered or unexported fields }
type CollectedSeasonProgress ¶
type CollectedSeasonProgress struct { Episodes []*CollectedEpisodeProgress `json:"episodes"` // contains filtered or unexported fields }
type CollectedShow ¶
type CollectionIterator ¶
type CollectionIterator interface { BasicIterator Type() Type Show() (*CollectedShow, error) Movie() (*CollectedMovie, error) }
type Comment ¶
type Comment struct { // ID the uuid of the comment. ID int `json:"id"` // Text the comment text or content. Text string `json:"comment"` // Spoiler whether this comment is a spoiler for // the item it is attached to. Spoiler bool `json:"spoiler"` // Review whether this comment is classed as a review. Review bool `json:"review"` // Parent the id of the parent comment if this is a reply. Parent int `json:"parent_id"` // CreatedAt when the comment was created CreatedAt time.Time `json:"created_at"` // UpdatedAt when the comment was last updated. UpdatedAt time.Time `json:"updated_at"` // Replies the number of replies this comment has. Replies int `json:"replies"` // Likes the number of likes. Likes int `json:"likes"` // User the user who wrote the comment. User *User `json:"user"` }
Comment represents a single comment or reply.
type CommentActivity ¶
type CommentIterator ¶
type CommentIterator struct{ Iterator }
CommentIterator represents a list of comments which can be iterated.
func (*CommentIterator) Comment ¶
func (li *CommentIterator) Comment() (*Comment, error)
Comment attempts to return an Comment entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
func (*CommentIterator) Entry ¶
func (li *CommentIterator) Entry() (*CalendarMovie, error)
Entry attempts to return an CalendarMovie entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type CommentListParams ¶
type CommentListParams struct { // BasicListParams is the parameters which all requests can take for listing // based operations where no OAuth token is required. BasicListParams // Sort how to sort the list of results. Sort SortType `json:"-" url:"-"` }
CommentListParams represents the parameters required to retrieve the comments against a single item.
type CommentType ¶
type CommentType string
CommentType represents the type of comment it is.
const ( // CommentTypeUnspecified where we dont know what the comment type is. CommentTypeUnspecified CommentType = `unspecified` // CommentTypeReview is where a review is more than 200 words long. CommentTypeReview CommentType = `review` // CommentTypeShout is where a review is less than 200 words. CommentTypeShout CommentType = `shout` // CommentTypeAll is used for filtering where we want to retrieve all // comment types. CommentTypeAll = CommentType(All) )
type CommentWithMediaElement ¶
type CommentWithMediaElement struct { // GenericMediaElement the media element the comment is attached to. GenericMediaElement // Comment the comment. Comment *Comment `json:"comment"` }
CommentWithMediaElement represents a comment with the media element its attached to
type CommentWithMediaElementIterator ¶
type CommentWithMediaElementIterator struct{ Iterator }
CommentWithMediaElementIterator represents a list of comments which can be iterated with the media element attached.
func (*CommentWithMediaElementIterator) CommentWithMediaElement ¶
func (li *CommentWithMediaElementIterator) CommentWithMediaElement() (*CommentWithMediaElement, error)
CommentWithMediaElement attempts to return an CommentWithMediaElement entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type Condition ¶
type Condition func() error
Condition a function which can be set prior to attempting to retrieve a frame to determine if the arguments are valid. If the response of this function returns an error, then the error on the iterator is set to the error, and no more paging is performed.
type Country ¶
type Country struct { // Name the name of the country Name string `json:"name"` // Code the ISO short code for the country. Code string `json:"code"` }
Country represents a country which includes the name and the ISO short code for that country.
type CountryIterator ¶
type CountryIterator struct{ BasicIterator }
CountryIterator represents a list of countries which can be iterated.
func (*CountryIterator) Country ¶
func (c *CountryIterator) Country() (*Country, error)
Country attempts to return an Country entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type Credits ¶
type Credits struct { Cast []*CastCredit `json:"cast"` Crew map[Department][]*CrewCredit `json:"crew"` }
type CrewCredit ¶
type CrewCredit struct { Jobs []string `json:"jobs"` // contains filtered or unexported fields }
func (*CrewCredit) UnmarshalJSON ¶
func (b *CrewCredit) UnmarshalJSON(bytes []byte) error
type Department ¶
type Department string
const ( DepartmentProduction Department = "production" DepartmentArt Department = "art" DepartmentCrew Department = "crew" DepartmentCostumeAndMakeUp Department = "costume & make-up" DepartmentDirecting Department = "directing" DepartmentWriting Department = "writing" DepartmentSound Department = "sound" DepartmentCamera Department = "camera" DepartmentVisualEffects Department = "visual effects" DepartmentLighting Department = "lighting" DepartmentEditing Department = "editing" )
type DeviceCode ¶
type DeviceCode struct { // Code this is the code the status of. Code string `json:"device_code"` // UserCode this is the code that the user needs to enter to // confirm authorization. UserCode string `json:"user_code"` // VerificationURL the URL the user should navigate to to // enter their code. VerificationURL string `json:"verification_url"` // ExpiresIn the length of time expressed as a Duration in which // the device code request expires from the time is was requested. ExpiresIn time.Duration `json:"-"` // Interval the length of time expressed as a Duration in which // the system should poll the status of the authorization. Interval time.Duration `json:"-"` }
DeviceCode a representation of a device code.
func (*DeviceCode) UnmarshalJSON ¶
func (d *DeviceCode) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements Unmarshaller interface. allows us to convert the interval | expires in into time.Duration.
type EpisodeActivity ¶
type EpisodeCollectionParams ¶
type EpisodeHistoryParams ¶
type EpisodeIterator ¶
type EpisodeIterator struct{ Iterator }
func (*EpisodeIterator) Episode ¶
func (e *EpisodeIterator) Episode() (*Episode, error)
type EpisodeListParams ¶
type EpisodeListParams struct { BasicParams TranslationLanguage string `url:"translations,omitempty" json:"-"` }
type EpisodeRatingParams ¶
type EpisodeWithTranslations ¶
type EpisodeWithTranslations struct { Episode Translations []*Translation `json:"translations"` }
type EpisodeWithTranslationsIterator ¶
type EpisodeWithTranslationsIterator struct{ BasicIterator }
func (*EpisodeWithTranslationsIterator) Episode ¶
func (e *EpisodeWithTranslationsIterator) Episode() (*EpisodeWithTranslations, error)
type Error ¶
type Error struct { // HTTPStatusCode the status code of the request. HTTPStatusCode int `json:"status,omitempty"` // RequestID the uuid of the request. RequestID string `json:"request_id,omitempty"` // Resource the path of the resource attempted to access. Resource string `json:"resource,omitempty"` // Body the request body. Body string `json:"body"` // Code the error code attached to the error. Code ErrorCode `json:"code"` }
type ErrorCode ¶
type ErrorCode string
const ( ErrorCodeUnknownError ErrorCode = "unknown_error" ErrorCodeInvalidRequest ErrorCode = "invalid_request" ErrorCodeForbidden ErrorCode = "forbidden" ErrorCodeNotFound ErrorCode = "not_found" ErrorCodeInvalidOperation ErrorCode = "invalid_operation" ErrorCodeConflict ErrorCode = "resource_conflict" ErrorCodeInvalidContentType ErrorCode = "invalid_content_type" ErrorCodeValidationError ErrorCode = "validation_error" ErrorCodeRateLimitExceeded ErrorCode = "rate_limit_exceeded" ErrorCodeServerError ErrorCode = "server_error" // Error codes specific to polling for a device code. ErrorCodePendingDeviceCode ErrorCode = "pending_device_code" ErrorCodeInvalidDeviceCode ErrorCode = "invalid_device_code" ErrorCodeDeviceCodeUsed ErrorCode = "device_code_used" ErrorCodeDeviceCodeExpired ErrorCode = "device_code_expired" ErrorCodeDeviceCodeDenied ErrorCode = "device_code_denied" // Error codes specific to posting a comment. ErrorCodePostInvalidUser ErrorCode = "invalid_or_banned_user" ErrorCodePostInvalidItem ErrorCode = "invalid_item_or_comments_disabled" ErrorCodeCommentCannotBeRemoved ErrorCode = "comment_cannot_be_removed" // Error codes specific to performing a checkin ErrorCodeCheckinInProgress ErrorCode = "checkin_in_progress" // Error codes for miscellaneous errors from within the SDK. ErrorCodeEmptyFrameData ErrorCode = "empty_frame_data" ErrorCodeEncodingError ErrorCode = "encoding_error" )
type ErrorHandler ¶
var DefaultErrorHandler ErrorHandler = &defaultErrorHandler{}
DefaultErrorHandler the default error handler which is used to determine the error code from a HTTP status code.
type ExchangeCodeParams ¶
type ExchangeCodeParams struct { // BasicParams is the basic parameters which all requests can take. BasicParams // RedirectURI the URL which was set in the original request to authenticate. RedirectURI string `url:"-" json:"redirect_uri"` // Code the code given to us after a successful authorization. Code string `url:"-" json:"code"` // ClientSecret the client secret generated by trakt which is unique to our app. // this can be found in app settings. DO NOT EXPOSE THIS VALUE. ClientSecret string `url:"-" json:"client_secret"` }
ExchangeCodeParams parameters required to exchange a authorization code for an access token.
type ExtendedListParams ¶
type ExtendedListParams struct { BasicListParams Extended ExtendedType `url:"extended" json:"-"` }
ExtendedParams params which can be used when a request supports asking for additional information.
type ExtendedParams ¶
type ExtendedParams struct { BasicParams Extended ExtendedType `url:"extended" json:"-"` }
ExtendedParams params which can be used when a request supports asking for additional information.
type ExtendedType ¶
type ExtendedType string
const ( ExtendedTypeGuestStars ExtendedType = `guest_stars` ExtendedTypeEpisodes ExtendedType = `episodes` ExtendedTypeCollectionMetadata ExtendedType = `metadata` ExtendedTypeNoSeasons ExtendedType = `noseasons` ExtendedTypeVip ExtendedType = `vip` ExtendedTypeFull ExtendedType = `full` )
func (ExtendedType) String ¶
func (e ExtendedType) String() string
type FilterListParams ¶
type FilterListParams struct { BasicListParams Filters Extended ExtendedType `url:"extended" json:"-"` }
FilterListParams params which can be used when a listing option accepts filters which can be applied.
type Filters ¶
type Filters struct { // Common filters. Query string `url:"query,omitempty" json:"-"` Years []int64 `url:"years,comma,omitempty" json:"-"` Genres []string `url:"genres,comma,omitempty" json:"-"` Languages []string `url:"languages,comma,omitempty" json:"-"` Countries []string `url:"countries,comma,omitempty" json:"-"` Runtime *Range `url:"runtimes,omitempty" json:"-"` Rating *Range `url:"ratings,comma,omitempty" json:"-"` // filters specific for movies and shows Certifications []string `url:"certifications,comma,omitempty" json:"-"` // filters specific for shows Networks []string `url:"networks,comma,omitempty" json:"-"` Statuses []Status `url:"statuses,comma,omitempty" json:"-"` }
Filters represents the set of filters which can be applied to certain API endpoints.
type GenericElement ¶
type GenericElement struct { GenericMediaElement List *List `json:"list"` }
type GenericElementParams ¶
type GenericMediaElement ¶
type GenericMediaElement struct { Episode *Episode `json:"episode"` // contains filtered or unexported fields }
type GenericMediaElementIterator ¶
type GenericMediaElementIterator struct { Iterator // contains filtered or unexported fields }
func (*GenericMediaElementIterator) Movie ¶
func (li *GenericMediaElementIterator) Movie() (*Movie, error)
func (*GenericMediaElementIterator) Show ¶
func (li *GenericMediaElementIterator) Show() (*Show, error)
func (*GenericMediaElementIterator) Type ¶
func (li *GenericMediaElementIterator) Type() (Type, error)
type GenreIterator ¶
type GenreIterator struct{ BasicIterator }
func (*GenreIterator) Genre ¶
func (c *GenreIterator) Genre() (*Genre, error)
type GetListParams ¶
type GetListParams struct { BasicListParams SortType SortType `json:"-" url:"-"` ListType ListType `json:"-" url:"-"` }
type History ¶
type History struct { GenericMediaElement ID int64 `json:"id"` Action Action `json:"action"` WatchedAt time.Time `json:"watched_at"` }
type HistoryIterator ¶
type HistoryIterator struct{ Iterator }
func (*HistoryIterator) History ¶
func (h *HistoryIterator) History() (*History, error)
type IDLookupParams ¶
type IDLookupParams struct { BasicListParams Type []Type `json:"-" url:"type,comma,omitempty"` Extended ExtendedType `json:"-" url:"extended,omitempty"` }
type Iterator ¶
type Iterator interface { BasicIterator // PageLimit sets an absolute limit on how many pages to iterate through. // if the result set has less pages than the limit, obviously it will // finish before that. PageLimit(page int64) }
Iterator a generic representation of an iterator.
type LanguageIterator ¶
type LanguageIterator struct{ BasicIterator }
func (*LanguageIterator) Language ¶
func (c *LanguageIterator) Language() (*Language, error)
type LastActivity ¶
type LastActivity struct { LastUpdated time.Time `json:"all"` Account *AccountActivity `json:"account"` Lists *ListActivity `json:"lists"` Comments *CommentActivity `json:"comments"` Seasons *SeasonActivity `json:"seasons"` Shows *ShowActivity `json:"shows"` Episodes *EpisodeActivity `json:"episodes"` Movies *MovieActivity `json:"movies"` }
type Level ¶
type Level uint32
Level represents a logging level.
const ( // LevelNone sets a logger so show no logging information. LevelNone Level = 0 // LevelError sets a logger to show error messages only. LevelError Level = 1 // LevelWarn sets a logger to show warning messages or anything more // severe. LevelWarn Level = 2 // LevelInfo sets a logger to show informational messages or anything more // severe. LevelInfo Level = 3 // LevelDebug sets a logger to show informational messages or anything more // severe. LevelDebug Level = 4 )
type LeveledLogger ¶
type LeveledLogger struct { // Level is the minimum logging level that will be emitted by this logger. // // For example, a Level set to LevelWarn will emit warnings and errors, but // not informational or debug messages. // // Always set this with a constant like LevelWarn because the individual // values are not guaranteed to be stable. Level Level // contains filtered or unexported fields }
leveledLogger is a leveled logger implementation.
It prints warnings and errors to `os.Stderr` and other messages to `os.Stdout`.
func (*LeveledLogger) Debugf ¶
func (l *LeveledLogger) Debugf(format string, v ...interface{})
Debugf logs a debug message using Printf conventions.
func (*LeveledLogger) Errorf ¶
func (l *LeveledLogger) Errorf(format string, v ...interface{})
Errorf logs a warning message using Printf conventions.
func (*LeveledLogger) Infof ¶
func (l *LeveledLogger) Infof(format string, v ...interface{})
Infof logs an informational message using Printf conventions.
func (*LeveledLogger) Warnf ¶
func (l *LeveledLogger) Warnf(format string, v ...interface{})
Warnf logs a warning message using Printf conventions.
type LeveledLoggerInterface ¶
type LeveledLoggerInterface interface { // Debugf logs a debug message using Printf conventions. Debugf(format string, v ...interface{}) // Errorf logs a warning message using Printf conventions. Errorf(format string, v ...interface{}) // Infof logs an informational message using Printf conventions. Infof(format string, v ...interface{}) // Warnf logs a warning message using Printf conventions. Warnf(format string, v ...interface{}) }
LeveledLoggerInterface provides a basic leveled logging interface for printing debug, informational, warning, and error messages.
It's implemented by leveledLogger and also provides out-of-the-box compatibility with a Logrus Logger, but may require a thin shim for use with other logging libraries that you use less standard conventions like Zap.
var DefaultLeveledLogger LeveledLoggerInterface = &LeveledLogger{Level: LevelNone}
DefaultLeveledLogger is the default logger that the library will use to log errors, warnings, and informational messages.
LeveledLoggerInterface is implemented by leveledLogger, and one can be initialized at the desired level of logging. LeveledLoggerInterface also provides out-of-the-box compatibility with a Logrus Logger, but may require a thin shim for use with other logging libraries that use less standard conventions like Zap.
This Logger will be inherited by any backends created by default, but will be overridden if a backend is created with getBackendWithConfig with a custom leveledLogger set.
type List ¶
type List struct { Name string `json:"name"` Description string `json:"description"` Privacy Privacy `json:"privacy"` DisplayNumbers bool `json:"display_numbers"` AllowComments bool `json:"allow_comments"` SortBy string `json:"sort_by"` SortDirection string `json:"sort_how"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Items int64 `json:"item_count"` Comments int64 `json:"comment_count"` User *User `json:"user"` // contains filtered or unexported fields }
type ListActivity ¶
type ListActivity struct { CommentActivity LastUpdated time.Time `json:"updated_at"` LastCommented time.Time `json:"commented_at"` }
type ListByTypeParams ¶
type ListByTypeParams struct { BasicParams Type Type `json:"type"` }
type ListCollectionParams ¶
type ListCollectionParams struct { ListParams Type Type `json:"-" url:"-"` Extended ExtendedType `url:"extended" json:"-"` }
type ListHistoryParams ¶
type ListHistoryParams struct { ListParams Type Type `json:"-" url:"-"` ID SearchID `json:"-" url:"-"` StartAt time.Time `url:"start_at" json:"-"` EndAt time.Time `url:"end_at" json:"-"` Extended ExtendedType `url:"extended" json:"-"` }
type ListIterator ¶
type ListIterator struct{ Iterator }
func (*ListIterator) List ¶
func (l *ListIterator) List() (*List, error)
type ListParams ¶
type ListParams struct { // Context used for request. It may carry deadlines, cancelation signals, // and other request-scoped values across API boundaries and between // processes. // // Note that a cancelled or timed out context does not provide any // guarantee whether the operation was or was not completed on Stripe's API // servers. For certainty, you must either retry with the same idempotency // key or queryFunc the state of the API. Context context.Context `url:"-" json:"-"` // Headers may be used to provide extra header lines on the HTTP request. Headers http.Header `url:"-" json:"-"` Page *int64 `url:"page,omitempty" json:"-"` Limit *int64 `url:"limit,omitempty" json:"-"` // OAuth token to use with the request. // this is passed as a header if supplied. OAuth string `url:"-" json:"-"` }
ListParams is the structure that contains the common properties of any *ListParams structure.
type ListParamsContainer ¶
type ListParamsContainer interface { ParamsContainer // contains filtered or unexported methods }
ListParamsContainer is a general interface for which all list parameter structs should comply. They achieve this by embedding a ListParams struct and inheriting its implementation of this interface.
type ListPlaybackParams ¶
type ListRatingParams ¶
type ListRatingParams struct { ListParams Type Type `json:"-" url:"-"` Ratings []int64 `json:"-" url:"-"` }
type ListWatchListParams ¶
type ListWatchListParams struct { ListParams Type Type `url:"-" json:"-"` Sort SortType `url:"-" json:"-"` Extended ExtendedType `url:"extended" json:"-"` }
type ListWatchedParams ¶
type ListWatchedParams = ListCollectionParams
type MediaCollectionParams ¶
type MediaHistoryParams ¶
type MediaRatingParams ¶
type MediaRemovalParams ¶
type MediaWatchListParams ¶
type Metadata ¶
type Metadata struct { Type MediaType `json:"media_type,omitempty"` Resolution Resolution `json:"resolution,omitempty"` HDR HDR `json:"hdr,omitempty"` Audio Audio `json:"audio,omitempty"` AudioChannels string `json:"audio_channels,omitempty"` ThreeD bool `json:"3d,omitempty"` }
Metadata to assign to the collection object.
type Movie ¶
type Movie struct { Year int64 `json:"-"` Tagline string `json:"tagline"` Released time.Time `json:"released"` Certification string `json:"certification"` Country string `json:"country"` TrailerURL string `json:"trailer"` HomepageURL string `json:"homepage"` Status Status `json:"status"` Genres []string `json:"genre"` Language string `json:"language"` // contains filtered or unexported fields }
func (*Movie) UnmarshalJSON ¶
type MovieActivity ¶
type MovieActivity struct { EpisodeActivity LastHidden time.Time `json:"hidden_at"` }
type MovieIterator ¶
type MovieIterator struct{ Iterator }
func (*MovieIterator) Movie ¶
func (m *MovieIterator) Movie() (*Movie, error)
type MovieWithStatistics ¶
type MovieWithStatistics struct { Movie `json:"movie"` // contains filtered or unexported fields }
type MovieWithStatisticsIterator ¶
type MovieWithStatisticsIterator struct{ Iterator }
func (*MovieWithStatisticsIterator) Movie ¶
func (m *MovieWithStatisticsIterator) Movie() (*MovieWithStatistics, error)
type NetworkIterator ¶
type NetworkIterator struct{ BasicIterator }
func (*NetworkIterator) Network ¶
func (n *NetworkIterator) Network() (*Network, error)
type NotFound ¶
type NotFound struct { Movies []*GenericElementParams `json:"movies"` Shows []*GenericElementParams `json:"shows"` Seasons []*GenericElementParams `json:"seasons"` Episodes []*GenericElementParams `json:"episodes"` }
type Params ¶
type Params struct { // Context used for request. It may carry deadlines, cancelation signals, // and other request-scoped values across API boundaries and between // processes. // // Note that a cancelled or timed out context does not provide any // guarantee whether the operation was or was not completed on Stripe's API // servers. For certainty, you must either retry with the same idempotency // key or queryFunc the state of the API. Context context.Context `url:"-" json:"-"` // Headers may be used to provide extra header lines on the HTTP request. Headers http.Header `url:"-" json:"-"` // OAuth token to use with the request. // this is passed as a header if supplied. OAuth string `url:"-" json:"-"` }
Params is the structure that contains the common properties of any *Params structure.
type ParamsContainer ¶
type ParamsContainer interface {
// contains filtered or unexported methods
}
ParamsContainer is a general interface for which all parameter structs should comply. They achieve this by embedding a Params struct and inheriting its implementation of this interface.
type Person ¶
type Person struct { MediaIDs `json:"ids"` Name string `json:"name"` Biography string `json:"biography"` Birthday time.Time `json:"-"` Death time.Time `json:"-"` Homepage string `json:"homepage"` Birthplace string `json:"birthplace"` }
func (*Person) UnmarshalJSON ¶
type PlaybackIterator ¶
type PlaybackIterator struct{ BasicIterator }
func (*PlaybackIterator) Playback ¶
func (p *PlaybackIterator) Playback() (*Playback, error)
type PollCodeParams ¶
type PollCodeParams struct { // BasicParams is the basic parameters which all requests can take. BasicParams // Code the generated code, retrieved from calling NewCode Code string `url:"-" json:"code"` // ClientSecret the client secret generated by trakt which is unique to our app. // this can be found in app settings. DO NOT EXPOSE THIS VALUE. ClientSecret string `url:"-" json:"client_secret"` // Interval the interval to poll on. This will be provided // in the response from NewCode, the API will throw errors // if you poll more frequently. Interval time.Duration `url:"-" json:"-"` // ExpiresIn the duration in which the code expires. // This will be provided in the response from NewCode. ExpiresIn time.Duration `url:"-" json:"-"` }
PollCodeParams parameters required to poll the status of a device code.
type PollResult ¶
type PollResult struct { // Token the access token. Token *Token // Err any error that occurred polling the status // of the device code. Err error }
PollResult the result from polling the status of a device code.
this will contain the completed token or an error if an error occurred which we could not recover from.
type PostCommentParams ¶
type PostCommentParams struct { // Params is the basic parameters which all requests can take where // OAuth is required. Params // Type the type of media element. Can either be TypeMovie or TypeEpisode. Type Type `json:"-"` // Element the actual element data. We can provide as much or as little as // we want about the item. The recommended values are either the trakt ID or slug. Element *GenericElementParams `json:"-"` // Text for the comment. This supports markdown and emojis. // Emojis are declared as short codes like :smiley: and :raised_hands:. Text string `json:"comment"` // Spoiler represents whether the comment is a spoiler to the attached item. Spoiler bool `json:"spoiler"` // The sharing object is optional and will apply the user's settings if not sent. // If sharing is sent, each key will override the user's setting for that social network. // Send true to post or false to not post on the indicated social network. You can see which // social networks a user has connected with the /users/settings method. Sharing *SharingParams `json:"sharing,omitempty"` }
PostCommentParams parameters in order to post a new comment.
func (*PostCommentParams) MarshalJSON ¶
func (p *PostCommentParams) MarshalJSON() ([]byte, error)
MarshalJSON implements the MarshalJSON interface.
type ProgressParams ¶
type ProgressParams struct { Params Hidden bool `json:"-" url:"hidden,omitempty"` Specials bool `json:"-" url:"specials,omitempty"` CountSpecials bool `json:"-" url:"count_specials,omitempty"` LastActivity ActivityType `json:"-" url:"last_activity,omitempty"` }
type Rating ¶
type Rating struct { GenericMediaElement Season *Season `json:"season"` Score float64 `json:"rating"` RatedAt time.Time `json:"rated_at"` }
type RatingDistribution ¶
type RatingIterator ¶
type RatingIterator struct{ Iterator }
func (*RatingIterator) Rating ¶
func (r *RatingIterator) Rating() (*Rating, error)
type RecentCommentParams ¶
type RecentCommentParams = TrendingCommentParams
RecentCommentParams represents parameters required to retrieve a list of the most recent comments.
type RecentList ¶
type RecentList struct { List `json:"list"` Likes int64 `json:"like_count"` Comments int64 `json:"comment_count"` }
RecentList represents a list with the most recent like and comment figures, usually over the last 7 days. The like and comment counts on the list are for all time.
type RecentListIterator ¶
type RecentListIterator struct{ Iterator }
func (*RecentListIterator) RecentList ¶
func (r *RecentListIterator) RecentList() (*RecentList, error)
type RecentlyUpdatedListParams ¶
type RecentlyUpdatedListParams struct { BasicListParams StartDate time.Time `json:"-" url:"-"` Extended ExtendedType `url:"extended" json:"-"` }
type RecentlyUpdatedMovie ¶
type RecentlyUpdatedMovieIterator ¶
type RecentlyUpdatedMovieIterator struct{ Iterator }
func (*RecentlyUpdatedMovieIterator) Movie ¶
func (m *RecentlyUpdatedMovieIterator) Movie() (*RecentlyUpdatedMovie, error)
type RecentlyUpdatedShow ¶
type RecentlyUpdatedShowIterator ¶
type RecentlyUpdatedShowIterator struct{ Iterator }
func (*RecentlyUpdatedShowIterator) Show ¶
func (r *RecentlyUpdatedShowIterator) Show() (*RecentlyUpdatedShow, error)
type RecommendationListParams ¶
type RecommendationListParams struct { ListParams IgnoreCollected bool `json:"-" url:"ignore_collected"` }
type RefreshTokenParams ¶
type RefreshTokenParams struct { // BasicParams is the basic parameters which all requests can take. BasicParams // RedirectURI the URL which was set in the original request to authenticate. RedirectURI string `url:"-" json:"redirect_uri"` // RefreshToken the refresh token supplied when we originally retrieved the access token. RefreshToken string `url:"-" json:"refresh_token"` // ClientSecret the client secret generated by trakt which is unique to our app. // this can be found in app settings. DO NOT EXPOSE THIS VALUE. ClientSecret string `url:"-" json:"client_secret"` }
RefreshTokenParams represents the parameters required in order to refresh an access token after it has expired.
type Release ¶
type Release struct { Country string `json:"country"` Certification string `json:"certification"` ReleaseDate time.Time `json:"-"` ReleaseType ReleaseType `json:"release_type"` Note string `json:"note"` }
func (*Release) UnmarshalJSON ¶
type ReleaseIterator ¶
type ReleaseIterator struct{ BasicIterator }
func (*ReleaseIterator) Release ¶
func (r *ReleaseIterator) Release() (*Release, error)
type ReleaseListParams ¶
type ReleaseListParams struct { BasicListParams Country string `json:"-" url:"-"` }
type ReleaseType ¶
type ReleaseType string
const ( ReleaseTypeUnknown ReleaseType = "unknown" ReleaseTypePremiere ReleaseType = "premiere" ReleaseTypeLimited ReleaseType = "limited" ReleaseTypeTheatrical ReleaseType = "theatrical" ReleaseTypeDigital ReleaseType = "digital" ReleaseTypePhysical ReleaseType = "physical" ReleaseTypeTV ReleaseType = "tv" )
type RemoveFromCollectionParams ¶
type RemoveFromCollectionParams struct { Params Movies []*MediaRemovalParams `json:"movies,omitempty" url:"-"` Seasons []*MediaRemovalParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaRemovalParams `json:"episodes,omitempty" url:"-"` Shows []*ShowRemovalParams `json:"shows,omitempty" url:"-"` }
type RemoveFromHistoryParams ¶
type RemoveFromHistoryParams struct { Params Movies []*MediaRemovalParams `json:"movies,omitempty" url:"-"` Seasons []*MediaRemovalParams `json:"seasons,omitempty" url:"-"` Episodes []*MediaRemovalParams `json:"episodes,omitempty" url:"-"` Shows []*ShowRemovalParams `json:"shows,omitempty" url:"-"` IDs []int64 `json:"ids,omitempty" url:"-"` }
type RemoveFromHistoryResult ¶
type RemoveFromHistoryResult struct { RemoveFromCollectionResult NotFound *struct { NotFound IDs []int64 `json:"ids"` } `json:"not_found"` }
type RemoveFromWatchListParams ¶
type RemoveFromWatchListParams = RemoveFromCollectionParams
type RemoveFromWatchListResult ¶
type RemoveFromWatchListResult = RemoveFromCollectionResult
type RemovePlaybackParams ¶
type RemoveRatingsParams ¶
type RemoveRatingsParams = RemoveFromCollectionParams
type RemoveRatingsResult ¶
type RemoveRatingsResult = RemoveFromCollectionResult
type Resolution ¶
type Resolution string
const ( ResolutionUHD Resolution = "uhd_4k" ResolutionHD1080p Resolution = "hd_1080p" ResolutionHD1080i Resolution = "hd_1080i" ResolutionHD720p Resolution = "hd_720p" ResolutionSD480p Resolution = "sd_480p" ResolutionSD480i Resolution = "sd_480i" ResolutionSD576p Resolution = "sd_576p" ResolutionSD576i Resolution = "sd_576i" )
type RevokeTokenParams ¶
type RevokeTokenParams struct { // BasicParams is the basic parameters which all requests can take. BasicParams // AccessToken the token to revoke. AccessToken string `url:"-" json:"token"` // ClientSecret the client secret generated by trakt which is unique to our app. // this can be found in app settings. DO NOT EXPOSE THIS VALUE. ClientSecret string `url:"-" json:"client_secret"` }
RevokeTokenParams the parameters required in order to revoke an access token once an access token has been revoked, it cannot be used for any API call from there on the user will need to be re-authenticated if you require access again.
type ScrobbleParams ¶
type ScrobbleParams struct { Params Type Type `json:"-" url:"-"` Element *GenericElementParams `json:"-" url:"-"` AppVersion string `json:"app_version" url:"-"` AppDate string `json:"app_date" url:"-"` Progress float64 `json:"progress" url:"-"` }
func (*ScrobbleParams) MarshalJSON ¶
func (s *ScrobbleParams) MarshalJSON() ([]byte, error)
type SearchField ¶
type SearchField string
const ( // Shared search fields for media elements (movie|episode|show) SearchFieldTitle SearchField = "title" SearchFieldOverview SearchField = "overview" SearchFieldPeople SearchField = "people" SearchFieldTranslation SearchField = "translations" SearchFieldAlias SearchField = "aliases" // search fields specifically for movies. SearchFieldTagline SearchField = "tagline" // Shared search fields for both person and list. SearchFieldName SearchField = "name" // search fields specifically for person SearchFieldBiography SearchField = "biography" // search fields specifically for list. SearchFieldDescription SearchField = "description" )
func (SearchField) String ¶
func (s SearchField) String() string
type SearchQueryParams ¶
type SearchQueryParams struct { BasicListParams Filters TextQueryFilters `json:"-" url:"-"` Type Type `json:"-" url:"-"` Query string `json:"-" url:"query"` Fields []SearchField `json:"-" url:"fields,comma,omitempty"` Extended ExtendedType `json:"-" url:"extended,omitempty"` }
func (*SearchQueryParams) EncodeValues ¶
func (s *SearchQueryParams) EncodeValues(_ string, v *url.Values) error
EncodeValues implements the query.Encoder interface.
type SearchResult ¶
type SearchResult struct { GenericElement Person *Person `json:"person"` }
SearchResult represents a result from performing a search either by test search or ID lookup.
type SearchResultIterator ¶
type SearchResultIterator struct{ Iterator }
SearchResultIterator an instance of an iterator which allows us to return the current pointer as a concrete SearchResult struct.
func (*SearchResultIterator) Result ¶
func (s *SearchResultIterator) Result() (*SearchResult, error)
type Season ¶
type Season struct { MediaIDs `json:"ids"` Title string `json:"title"` Overview string `json:"overview"` Number int64 `json:"number"` Rating float64 `json:"rating"` Votes int64 `json:"votes"` EpisodeCount int64 `json:"episode_count"` AiredCount int64 `json:"aired_episodes"` FirstAired time.Time `json:"first_aired"` Network string `json:"network"` }
type SeasonActivity ¶
type SeasonActivity = ShowActivity
type SeasonCollectionParams ¶
type SeasonCollectionParams struct { Metadata Number int64 `json:"number"` CollectedAt time.Time `json:"collected_at,omitempty" url:"-"` Episodes []*EpisodeCollectionParams `json:"episodes,omitempty"` }
type SeasonHistoryParams ¶
type SeasonHistoryParams struct { Number int64 `json:"number"` WatchedAt time.Time `json:"watched_at,omitempty" url:"-"` Episodes []*EpisodeHistoryParams `json:"episodes,omitempty"` }
type SeasonIterator ¶
type SeasonIterator struct{ Iterator }
func (*SeasonIterator) Season ¶
func (s *SeasonIterator) Season() (*Season, error)
type SeasonRatingParams ¶
type SeasonRatingParams struct { Number int64 `json:"number"` Rating int64 `json:"rating,omitempty"` RatedAt time.Time `json:"rated_at,omitempty" url:"-"` Episodes []*EpisodeRatingParams `json:"episodes,omitempty"` }
type SeasonRemovalParams ¶
type SeasonRemovalParams struct { Number int64 `json:"number" url:"-"` Episodes []int64 `json:"-" url:"-"` }
func (*SeasonRemovalParams) MarshalJSON ¶
func (s *SeasonRemovalParams) MarshalJSON() ([]byte, error)
type SeasonWatchListParams ¶
type SeasonWatchListParams struct { Number int64 `json:"number"` CollectedAt time.Time `json:"collected_at,omitempty" url:"-"` Episodes []int64 `json:"episodes,omitempty"` }
func (*SeasonWatchListParams) MarshalJSON ¶
func (s *SeasonWatchListParams) MarshalJSON() ([]byte, error)
type SeasonWithEpisodes ¶
type SeasonWithEpisodesIterator ¶
type SeasonWithEpisodesIterator struct{ BasicIterator }
func (*SeasonWithEpisodesIterator) Season ¶
func (s *SeasonWithEpisodesIterator) Season() (*SeasonWithEpisodes, error)
type SharingParams ¶
type Show ¶
type Show struct { Year int64 `json:"-"` FirstAired time.Time `json:"first_aired"` Airs *Airs `json:"airs"` Certification string `json:"certification"` Country string `json:"country"` TrailerURL string `json:"trailer"` HomepageURL string `json:"homepage"` Status Status `json:"status"` Genres []string `json:"genre"` AiredEpisodes int64 `json:"aired_episodes"` Language string `json:"language"` // contains filtered or unexported fields }
func (*Show) UnmarshalJSON ¶
type ShowActivity ¶
type ShowCollectionParams ¶
type ShowCollectionParams struct { Metadata IDs MediaIDs `json:"ids,omitempty" url:"-"` Title string `json:"title,omitempty" url:"-"` Year int64 `json:"year,omitempty" url:"-"` CollectedAt time.Time `json:"collected_at,omitempty" url:"-"` Seasons []*SeasonCollectionParams `json:"seasons,omitempty" url:"-"` }
type ShowHistoryParams ¶
type ShowIterator ¶
type ShowIterator struct{ Iterator }
func (*ShowIterator) Show ¶
func (s *ShowIterator) Show() (*Show, error)
type ShowRatingParams ¶
type ShowRatingParams struct { IDs MediaIDs `json:"ids,omitempty" url:"-"` Title string `json:"title,omitempty" url:"-"` Year int64 `json:"year,omitempty" url:"-"` Rating int64 `json:"rating,omitempty"` RatedAt time.Time `json:"rated_at,omitempty" url:"-"` Seasons []*SeasonRatingParams `json:"seasons,omitempty" url:"-"` }
type ShowRemovalParams ¶
type ShowRemovalParams struct { IDs MediaIDs `json:"ids,omitempty" url:"-"` Title string `json:"title,omitempty" url:"-"` Year int64 `json:"year,omitempty" url:"-"` Seasons []*SeasonRemovalParams `json:"seasons,omitempty"` }
type ShowWatchListParams ¶
type ShowWatchListParams struct { IDs MediaIDs `json:"ids,omitempty" url:"-"` Title string `json:"title,omitempty" url:"-"` Year int64 `json:"year,omitempty" url:"-"` Seasons []*SeasonCollectionParams `json:"seasons,omitempty" url:"-"` }
type ShowWithStatistics ¶
type ShowWithStatistics struct { Show `json:"show"` // contains filtered or unexported fields }
type ShowWithStatisticsIterator ¶
type ShowWithStatisticsIterator struct{ Iterator }
func (*ShowWithStatisticsIterator) Show ¶
func (s *ShowWithStatisticsIterator) Show() (*ShowWithStatistics, error)
type SortDirection ¶
type SortDirection string
const ( SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
type SortPreference ¶
type SortPreference struct { Type SortType Direction SortDirection }
type SortType ¶
type SortType string
const ( // these sort types are used for comment sorting. SortTypeNewest SortType = "newest" SortTypeOldest SortType = "oldest" SortTypeReplies SortType = "replies" SortTypeHighest SortType = "highest" SortTypeLowest SortType = "lowest" SortTypePlays SortType = "plays" // these sort types are used for list sorting. SortTypePopular SortType = "popular" SortTypeLikes SortType = "likes" SortTypeComments SortType = "comments" SortTypeItems SortType = "items" SortTypeAdded SortType = "added" SortTypeUpdated SortType = "updated" // these sort types are used for watchlist sorting. SortTypeRank SortType = "rank" SortTypeTitle SortType = "title" SortTypeReleased SortType = "released" SortTypeRuntime SortType = "runtime" SortTypePopularity SortType = "popularity" SortTypePercentage SortType = "percentage" SortTypeVotes SortType = "votes" )
type StartCheckinParams ¶
type StartCheckinParams struct { Params // Type the type of media element. Can either be TypeMovie or TypeEpisode. Type Type `json:"-"` // Element the actual element data. We can provide as much or as little as // we want about the item. The recommended values are either the trakt ID or slug. Element *GenericElementParams `json:"-"` // Message used for sharing. If not sent, it will use the watching string in the user settings. Message string `json:"message,omitempty"` // Foursquare venue ID. Optional. VenueID string `json:"venue_id,omitempty"` // Foursquare venue name. Optional. VenueName string `json:"venue_name,omitempty"` // Version number of the app. Optional. AppVersion string `json:"app_version,omitempty"` // Build date of the app. Optional. AppDate string `json:"app_date,omitempty"` // The sharing object is optional and will apply the user's settings if not sent. // If sharing is sent, each key will override the user's setting for that social network. // Send true to post or false to not post on the indicated social network. You can see which // social networks a user has connected with the /users/settings method. Sharing *SharingParams `json:"sharing,omitempty"` }
StartCheckinParams parameters in order to start a checkin operation. The only required values are Type, Element and an OAuth token.
func (*StartCheckinParams) MarshalJSON ¶
func (s *StartCheckinParams) MarshalJSON() ([]byte, error)
MarshalJSON implements Marshaller interface.
type Statistics ¶
type Status ¶
type Status string
const ( StatusReturningSeries Status = `returning series` StatusInProduction Status = `in production` StatusPlanned Status = `planned` StatusCancelled Status = `canceled` StatusEnded Status = `ended` StatusPostProduction Status = `post production` StatusRumored Status = `rumored` StatusReleased Status = `released` )
type TextQueryFilters ¶
type TextQueryFilters struct { Years []int64 `url:"years,comma,omitempty" json:"-"` Genres []string `url:"genres,comma,omitempty" json:"-"` Languages []string `url:"languages,comma,omitempty" json:"-"` Countries []string `url:"countries,comma,omitempty" json:"-"` Runtime *Range `url:"runtimes,omitempty" json:"-"` Rating *Range `url:"ratings,comma,omitempty" json:"-"` // filters specific for movies and shows Certifications []string `url:"certifications,comma,omitempty" json:"-"` // filters specific for shows Networks []string `url:"networks,comma,omitempty" json:"-"` Statuses []Status `url:"statuses,comma,omitempty" json:"-"` }
TextQueryFilters represents the set of filters which can be applied when performing a Text Lookup. this differs from the generic filter set as we want to force queryFunc to be given.
type TimePeriod ¶
type TimePeriod string
const ( TimePeriodWeekly TimePeriod = "weekly" TimePeriodMonthly TimePeriod = "monthly" TimePeriodYearly TimePeriod = "yearly" TimePeriodAll = TimePeriod(All) )
func (TimePeriod) String ¶
func (t TimePeriod) String() string
type TimePeriodListParams ¶
type TimePeriodListParams struct { BasicListParams Filters Period TimePeriod `url:"-" json:"-"` Extended ExtendedType `url:"extended" json:"-"` }
type Token ¶
type Token struct { // AccessToken the generated access token key. // this is the code which is used with authenticated requests. AccessToken string `json:"access_token"` // Type the type of token, usually bearer. Type string `json:"token_type"` // Scope the scopes / level of access this token has to the // users account. Scope string `json:"scope"` // CreatedAt the time when the token was generated. CreatedAt time.Time `json:"-"` // RefreshToken this can be used to generate a new access token // after one expires without having to get the user to authenticate // again. RefreshToken string `json:"refresh_token"` // ExpiresIn the length of time this token is valid for. ExpiresIn time.Duration `json:"-"` }
Token represents an access token. A token is usually valid for 3 months and can be refreshed using the refresh token. the expires in duration determines how long the token is valid for.
func (*Token) UnmarshalJSON ¶
UnmarshalJSON implements Unmarshaller interface. allows us to convert the created at | expires in into time.Duration.
type Translation ¶
type TranslationIterator ¶
type TranslationIterator struct{ BasicIterator }
func (*TranslationIterator) Translation ¶
func (t *TranslationIterator) Translation() (*Translation, error)
type TranslationListParams ¶
type TranslationListParams struct { BasicListParams Language string `json:"-" url:"-"` }
type TrendingCommentParams ¶
type TrendingCommentParams struct { // BasicListParams is the parameters which all requests can take for listing // based operations where no OAuth token is required. BasicListParams // Extended sets the level of detail required Extended ExtendedType `url:"extended,omitempty" json:"-"` // CommentType the type of comments to filter by. CommentType CommentType `url:"-" json:"-"` // MediaType the type of media item to filter by. MediaType Type `url:"-" json:"-"` }
TrendingCommentParams represents parameters required to retrieve a list of trending comments.
type TrendingMovie ¶
type TrendingMovieIterator ¶
type TrendingMovieIterator struct{ Iterator }
func (*TrendingMovieIterator) Trending ¶
func (t *TrendingMovieIterator) Trending() (*TrendingMovie, error)
type TrendingShow ¶
type TrendingShowIterator ¶
type TrendingShowIterator struct{ Iterator }
func (*TrendingShowIterator) Trending ¶
func (t *TrendingShowIterator) Trending() (*TrendingShow, error)
type UpdateCommentParams ¶
type UpdateCommentParams struct { // Params is the basic parameters which all requests can take where // OAuth is required. Params // Text the updated comment text. Text string `json:"comment"` // Spoiler whether this comment contains a spoiler for the item // its commenting on. Spoiler bool `json:"spoiler"` }
UpdateCommentParams represents parameters which are required to update an existing comment.
type UpdatedCommentParams ¶
type UpdatedCommentParams = TrendingCommentParams
UpdatedCommentParams represents parameters required to retrieve a list of the recently updated comments.
type User ¶
type User struct { Username string `json:"username"` Name string `json:"name"` Gender Gender `json:"gender"` Age uint `json:"age"` About string `json:"about"` Location string `json:"location"` JoinedAt time.Time `json:"joined_at"` Private bool `json:"private"` Vip *VipStatus `json:"-"` Images *UserImages `json:"images"` // contains filtered or unexported fields }
func (*User) UnmarshalJSON ¶
type UserImages ¶
type UserImages struct { Avatar *struct { Full string `json:"full"` } `json:"avatar"` }
type UserIterator ¶
type UserIterator struct{ Iterator }
func (*UserIterator) User ¶
func (u *UserIterator) User() (*User, error)
type UserLike ¶
type UserLike struct { // User the user who liked the reply User `json:"user"` // LikedAt the time at which the user liked the comment. LikedAt time.Time `json:"liked_at"` }
UserLike represents a user which has liked a comment
type UserLikeIterator ¶
type UserLikeIterator struct{ Iterator }
UserLikeIterator represents a list of UserLikes which can be iterated.
func (*UserLikeIterator) UserLike ¶
func (li *UserLikeIterator) UserLike() (*UserLike, error)
UserLike attempts to return an UserLike entry at the current cursor in the iterator. Returns an error if there no cursor (Next hasnt been called yet) or if there is an error on the iterator retrieving a page of results.
type WatchListEntry ¶
type WatchListEntry struct { GenericMediaElement Season *Season `json:"season"` Rank int64 `json:"rank"` ListedAt time.Time `json:"listed_at"` }
type WatchListEntryIterator ¶
type WatchListEntryIterator struct{ Iterator }
func (*WatchListEntryIterator) Applied ¶
func (w *WatchListEntryIterator) Applied() *SortPreference
Applied attempts to retrieve the applied sort type on a users watchlist.
func (*WatchListEntryIterator) Entry ¶
func (w *WatchListEntryIterator) Entry() (*WatchListEntry, error)
func (*WatchListEntryIterator) Preferred ¶
func (w *WatchListEntryIterator) Preferred() *SortPreference
Preferred attempts to retrieve the preferred sort type on a users watchlist.
type WatchedEpisode ¶
type WatchedEpisodeProgress ¶
type WatchedIterator ¶
type WatchedIterator interface { BasicIterator Type() Type Show() (*WatchedShow, error) Movie() (*WatchedMovie, error) }
type WatchedMovie ¶
type WatchedMovie struct { Movie `json:"movie"` // contains filtered or unexported fields }
type WatchedProgress ¶
type WatchedProgress struct { Seasons []*WatchedSeasonProgress `json:"seasons"` WatchedAt time.Time `json:"last_watched_at"` ResetAt time.Time `json:"reset_at"` // contains filtered or unexported fields }
type WatchedSeason ¶
type WatchedSeason struct { Episodes []*WatchedEpisode `json:"episodes"` // contains filtered or unexported fields }
type WatchedSeasonProgress ¶
type WatchedSeasonProgress struct { Episodes []*WatchedEpisodeProgress `json:"episodes"` // contains filtered or unexported fields }
type WatchedShow ¶
type WatchedShow struct { Show `json:"show"` ResetAt time.Time `json:"reset_at"` Seasons []*WatchedSeason `json:"seasons"` // contains filtered or unexported fields }
Source Files ¶
- alias.go
- authorization.go
- calendar.go
- certification.go
- checkin.go
- comment.go
- country.go
- episode.go
- error.go
- filter.go
- generic.go
- genre.go
- iter.go
- language.go
- list.go
- log.go
- movie.go
- network.go
- params.go
- person.go
- playback.go
- progress.go
- rating.go
- recommendation.go
- scrobble.go
- search.go
- season.go
- show.go
- statistics.go
- sync.go
- tag.go
- trakt.go
- translation.go
- user.go
Directories ¶
Path | Synopsis |
---|---|
Package authorization handles allowing us to generate an access token to perform actions on behalf of an authenticated user.
|
Package authorization handles allowing us to generate an access token to perform actions on behalf of an authenticated user. |
Package calender provides functionality to query a calendar or schedule for movies and shows.
|
Package calender provides functionality to query a calendar or schedule for movies and shows. |
Package certification gives functions to retrieve TV Show or Movie certifications.
|
Package certification gives functions to retrieve TV Show or Movie certifications. |
Package checkin allows user to manually signal that they are watching a media item.
|
Package checkin allows user to manually signal that they are watching a media item. |
Package comment gives us functionality to post, update and list comments.
|
Package comment gives us functionality to post, update and list comments. |
Package country gives functions to retrieve country information.
|
Package country gives functions to retrieve country information. |
Package episode contains functions to retrieve episode details.
|
Package episode contains functions to retrieve episode details. |
Package genre gives functions to retrieve genre information.
|
Package genre gives functions to retrieve genre information. |
Package language gives functions to retrieve language information.
|
Package language gives functions to retrieve language information. |
Package list contains functions which are capable of retrieving the most popular lists.
|
Package list contains functions which are capable of retrieving the most popular lists. |
Package movie contains functions to retrieve movie details either listing the most popular ones or a single one by ID.
|
Package movie contains functions to retrieve movie details either listing the most popular ones or a single one by ID. |
Package network gives functions to retrieve TV network information.
|
Package network gives functions to retrieve TV network information. |
Package person gives function to retrieve people from trakt.
|
Package person gives function to retrieve people from trakt. |
Package recommendation provides functions to retrieve and configure movie and show recommendations.
|
Package recommendation provides functions to retrieve and configure movie and show recommendations. |
Package scrobble provides an automatic way to track what a user is watching.
|
Package scrobble provides an automatic way to track what a user is watching. |
Package search allows us to perform textual based queries or ID lookups.
|
Package search allows us to perform textual based queries or ID lookups. |
Package season contains functions to retrieve season details.
|
Package season contains functions to retrieve season details. |
Package show contains functions to retrieve show details.
|
Package show contains functions to retrieve show details. |
Package sync allows us to sync our trakt collection with one or more media centres.
|
Package sync allows us to sync our trakt collection with one or more media centres. |