Documentation
¶
Overview ¶
Package internal used for client and services
Package internal used for client and services ¶
Package internal used for client and services ¶
Package internal used for client and services ¶
Package internal used for client and services ¶
Package internal used for client and services ¶
Package internal used for client and services ¶
Package internal used for client and services
Index ¶
- Constants
- type AbuseRateLimitError
- type CalendarsService
- func (c *CalendarsService) GetDVDReleases(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- func (c *CalendarsService) GetFinales(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- func (c *CalendarsService) GetMovies(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- func (c *CalendarsService) GetNewShows(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- func (c *CalendarsService) GetSeasonPremieres(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- func (c *CalendarsService) GetShows(ctx context.Context, actionType *string, startDate *string, days *int, ...) ([]*str.CalendarList, *str.Response, error)
- type Client
- func (c *Client) BareDo(ctx context.Context, req *http.Request) (*str.Response, error)
- func (c *Client) CheckResponse(r *http.Response) error
- func (c *Client) CheckRetryAfter(req *http.Request) *AbuseRateLimitError
- func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*str.Response, error)
- func (_ *Client) HavePages(page int, pages int) bool
- func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOption) (*http.Request, error)
- func (c *Client) NewResponse(r *http.Response) *str.Response
- func (_ *Client) ParseRate(r *http.Response) str.Rate
- func (_ *Client) ParseRateLimit(r *http.Response) *time.Duration
- func (c *Client) UpdateHeaders(headers map[string]any)
- func (_ *Client) WithContext(ctx context.Context, req *http.Request) *http.Request
- type OauthService
- func (o *OauthService) ExchangeRefreshTokenForAccessToken(ctx context.Context, deviceToken *str.CurrentDeviceToken) (*str.DeviceToken, *str.Response, error)
- func (o *OauthService) GenerateNewDeviceCodes(ctx context.Context, code *str.NewDeviceCode) (*str.DeviceCode, *str.Response, error)
- func (o *OauthService) PoolForTheAccessToken(ctx context.Context, deviceToken *str.NewDeviceToken) (*str.DeviceToken, *str.Response, error)
- type PeopleService
- func (p *PeopleService) GetListsContainingThisPerson(ctx context.Context, id *string, typeString *string, sort *string, ...) ([]*str.PersonalList, *str.Response, error)
- func (p *PeopleService) GetMovieCredits(ctx context.Context, id *string, opts *uri.ListOptions) (*str.PersonMovies, *str.Response, error)
- func (p *PeopleService) GetRecentlyUpdatedPeople(ctx context.Context, startDate *string, opts *uri.ListOptions) ([]*str.PersonItem, *str.Response, error)
- func (p *PeopleService) GetRecentlyUpdatedPeopleTraktIDs(ctx context.Context, startDate *string, opts *uri.ListOptions) ([]*int, *str.Response, error)
- func (p *PeopleService) GetShowCredits(ctx context.Context, id *string, opts *uri.ListOptions) (*str.PersonShows, *str.Response, error)
- func (p *PeopleService) GetSinglePerson(ctx context.Context, id *string, opts *uri.ListOptions) (*str.Person, *str.Response, error)
- type RequestOption
- type SearchService
- func (s *SearchService) GetIDLookupResults(ctx context.Context, formatType *string, id *string, opts *uri.ListOptions) ([]*str.SearchListItem, *str.Response, error)
- func (s *SearchService) GetTextQueryResults(ctx context.Context, searchType *string, opts *uri.ListOptions) ([]*str.SearchListItem, *str.Response, error)
- type Service
- type SyncService
- func (s *SyncService) GetCollection(ctx context.Context, types *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
- func (s *SyncService) GetWatchedHistory(ctx context.Context, types *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
- func (s *SyncService) GetWatchlist(ctx context.Context, types *string, sort *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
- type UsersService
- func (u *UsersService) GetItemstOnAPersonalList(ctx context.Context, id *string, listID *string, t *string) ([]*str.UserListItem, *str.Response, error)
- func (u *UsersService) GetUserProfile(ctx context.Context, id *string) (*str.UserProfile, *str.Response, error)
- func (u *UsersService) GetUsersPersonalLists(ctx context.Context, id *string) ([]*str.PersonalList, *str.Response, error)
Constants ¶
const ( Version = "2" HeaderRateLimit = "X-RateLimit" HeaderRetryAfter = "Retry-After" HeaderPaginationPageCount = "X-Pagination-Page-Count" )
basic consts for client
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbuseRateLimitError ¶
type AbuseRateLimitError struct {
Response *http.Response
RetryAfter *time.Duration
Message string `json:"message"`
}
AbuseRateLimitError occurs when trakt.tv returns 429 too many requests header
func (*AbuseRateLimitError) Error ¶
func (r *AbuseRateLimitError) Error() string
type CalendarsService ¶
type CalendarsService Service
CalendarsService handles communication with the calendars related methods of the Trakt API.
func (*CalendarsService) GetDVDReleases ¶
func (c *CalendarsService) GetDVDReleases(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetDVDReleases Returns all movies with a DVD release date during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-dvd/get-dvd-releases API docs: https://trakt.docs.apiary.io/#reference/calendars/all-dvd/get-dvd-releases
func (*CalendarsService) GetFinales ¶
func (c *CalendarsService) GetFinales(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetFinales Returns all show finales (mid_season_finale, season_finale, series_finale) airing during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-finales/get-finales API docs: https://trakt.docs.apiary.io/#reference/calendars/all-finales/get-finales
func (*CalendarsService) GetMovies ¶
func (c *CalendarsService) GetMovies(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetMovies Returns all movies with a release date during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-movies/get-movies API docs: https://trakt.docs.apiary.io/#reference/calendars/all-movies/get-movies
func (*CalendarsService) GetNewShows ¶
func (c *CalendarsService) GetNewShows(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetNewShows Returns all new show premieres airing during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-new-shows/get-new-shows API docs: https://trakt.docs.apiary.io/#reference/calendars/all-new-shows/get-new-shows
func (*CalendarsService) GetSeasonPremieres ¶
func (c *CalendarsService) GetSeasonPremieres(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetSeasonPremieres Returns all show premieres (mid_season_premiere, season_premiere, series_premiere) airing during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-season-premieres/get-season-premieres API docs: https://trakt.docs.apiary.io/#reference/calendars/all-season-premieres/get-season-premieres
func (*CalendarsService) GetShows ¶
func (c *CalendarsService) GetShows(ctx context.Context, actionType *string, startDate *string, days *int, opts *uri.ListOptions) ([]*str.CalendarList, *str.Response, error)
GetShows Returns all shows airing during the time period specified.
API docs: https://trakt.docs.apiary.io/#reference/calendars/my-shows/get-shows API docs: https://trakt.docs.apiary.io/#reference/calendars/all-shows/get-shows
type Client ¶
type Client struct {
RateLimitReset time.Time
BaseURL *url.URL
Oauth *OauthService
Users *UsersService
Sync *SyncService
People *PeopleService
Calendars *CalendarsService
Search *SearchService
// contains filtered or unexported fields
}
A Client manages communication with the trakt.tv API.
func NewClient ¶
NewClient returns a new API client. If a nil httpClient is provided, a new http.Client will be used.
func (*Client) CheckResponse ¶
CheckResponse checks if api response have errors.
func (*Client) CheckRetryAfter ¶
func (c *Client) CheckRetryAfter(req *http.Request) *AbuseRateLimitError
CheckRetryAfter check Retry After header.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, urlStr string, body any, opts ...RequestOption) (*http.Request, error)
NewRequest creates an API request.
func (*Client) NewResponse ¶
NewResponse creates a new Response for the provided http.Response. r must not be nil.
func (*Client) ParseRateLimit ¶
ParseRateLimit parses related headers, and returns the time to retry after.
func (*Client) UpdateHeaders ¶
UpdateHeaders is for update client headers map
type OauthService ¶
type OauthService Service
OauthService handles communication with the oauth related methods of the Trakt API.
API docs: https://trakt.docs.apiary.io/#reference/authentication-oauth
func (*OauthService) ExchangeRefreshTokenForAccessToken ¶
func (o *OauthService) ExchangeRefreshTokenForAccessToken(ctx context.Context, deviceToken *str.CurrentDeviceToken) (*str.DeviceToken, *str.Response, error)
ExchangeRefreshTokenForAccessToken Use the refresh_token to get a new access_token without asking the user to re-authenticate. The access_token is valid for 3 months before it needs to be refreshed again.
func (*OauthService) GenerateNewDeviceCodes ¶
func (o *OauthService) GenerateNewDeviceCodes(ctx context.Context, code *str.NewDeviceCode) (*str.DeviceCode, *str.Response, error)
GenerateNewDeviceCodes Generate new codes to start the device authentication process.
API docs: https://trakt.docs.apiary.io/#reference/authentication-devices/device-code/generate-new-device-codes
func (*OauthService) PoolForTheAccessToken ¶
func (o *OauthService) PoolForTheAccessToken(ctx context.Context, deviceToken *str.NewDeviceToken) (*str.DeviceToken, *str.Response, error)
PoolForTheAccessToken Use the device_code and poll at the interval (in seconds) to check if the user has authorized you app.
API docs: https://trakt.docs.apiary.io/#reference/authentication-devices/get-token/poll-for-the-access_token
type PeopleService ¶
type PeopleService Service
PeopleService handles communication with the people related methods of the Trakt API.
func (*PeopleService) GetListsContainingThisPerson ¶
func (p *PeopleService) GetListsContainingThisPerson(ctx context.Context, id *string, typeString *string, sort *string, opts *uri.ListOptions) ([]*str.PersonalList, *str.Response, error)
GetListsContainingThisPerson Returns all lists that contain this person.
API docs: https://trakt.docs.apiary.io/#reference/people/lists/get-lists-containing-this-person
func (*PeopleService) GetMovieCredits ¶
func (p *PeopleService) GetMovieCredits(ctx context.Context, id *string, opts *uri.ListOptions) (*str.PersonMovies, *str.Response, error)
GetMovieCredits Returns all movies where this person is in the cast or crew.
API docs: https://trakt.docs.apiary.io/#reference/people/movies/get-movie-credits
func (*PeopleService) GetRecentlyUpdatedPeople ¶
func (p *PeopleService) GetRecentlyUpdatedPeople(ctx context.Context, startDate *string, opts *uri.ListOptions) ([]*str.PersonItem, *str.Response, error)
GetRecentlyUpdatedPeople Returns all people updated since the specified UTC date and time.
API docs: https://trakt.docs.apiary.io/#reference/people/updates/get-recently-updated-people
func (*PeopleService) GetRecentlyUpdatedPeopleTraktIDs ¶
func (p *PeopleService) GetRecentlyUpdatedPeopleTraktIDs(ctx context.Context, startDate *string, opts *uri.ListOptions) ([]*int, *str.Response, error)
GetRecentlyUpdatedPeopleTraktIDs Returns all people Trakt IDs updated since the specified UTC date and time.
API docs: https://trakt.docs.apiary.io/#reference/people/updated-ids
func (*PeopleService) GetShowCredits ¶
func (p *PeopleService) GetShowCredits(ctx context.Context, id *string, opts *uri.ListOptions) (*str.PersonShows, *str.Response, error)
GetShowCredits Returns all shows where this person is in the cast or crew, including the episode_count for which they appear.
API docs: https://trakt.docs.apiary.io/#reference/people/shows/get-show-credits
func (*PeopleService) GetSinglePerson ¶
func (p *PeopleService) GetSinglePerson(ctx context.Context, id *string, opts *uri.ListOptions) (*str.Person, *str.Response, error)
GetSinglePerson Returns a single person's details.
API docs: https://trakt.docs.apiary.io/#reference/people/summary/get-a-single-person
type RequestOption ¶
RequestOption represents an option that can modify an http.Request.
type SearchService ¶
type SearchService Service
SearchService handles communication with the search related methods of the Trakt API.
func (*SearchService) GetIDLookupResults ¶
func (s *SearchService) GetIDLookupResults(ctx context.Context, formatType *string, id *string, opts *uri.ListOptions) ([]*str.SearchListItem, *str.Response, error)
GetIDLookupResults Lookup items by their Trakt, IMDB, TMDB, or TVDB ID. If you use the search url without a type it might return multiple items if the id_type is not globally unique. Specify the type of results by sending a single value or a comma delimited string for multiple types.
API docs: https://trakt.docs.apiary.io/#reference/search/id-lookup/get-id-lookup-results
func (*SearchService) GetTextQueryResults ¶
func (s *SearchService) GetTextQueryResults(ctx context.Context, searchType *string, opts *uri.ListOptions) ([]*str.SearchListItem, *str.Response, error)
GetTextQueryResults Search all text fields that a media object contains (i.e. title, overview, etc). Results are ordered by the most relevant score. Specify the type of results by sending a single value or a comma delimited string for multiple types.
API docs: https://trakt.docs.apiary.io/#reference/search/text-query/get-text-query-results
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service structure for other services
type SyncService ¶
type SyncService Service
SyncService handles communication with the sync related methods of the Trakt API.
func (*SyncService) GetCollection ¶
func (s *SyncService) GetCollection(ctx context.Context, types *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
GetCollection Get all collected items in a user's collection.
API docs: https://trakt.docs.apiary.io/#reference/sync/get-collection/get-collection
func (*SyncService) GetWatchedHistory ¶
func (s *SyncService) GetWatchedHistory(ctx context.Context, types *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
GetWatchedHistory Returns movies and episodes that a user has watched, sorted by most recent.
API docs: https://trakt.docs.apiary.io/#reference/sync/get-watched/get-watched-history
func (*SyncService) GetWatchlist ¶
func (s *SyncService) GetWatchlist(ctx context.Context, types *string, sort *string, opts *uri.ListOptions) ([]*str.ExportlistItem, *str.Response, error)
GetWatchlist Returns all items in a user's watchlist filtered by type.
API docs: https://trakt.docs.apiary.io/#reference/sync/get-watchlist/get-watchlist
type UsersService ¶
type UsersService Service
UsersService handles communication with the users related methods of the Trakt API.
func (*UsersService) GetItemstOnAPersonalList ¶
func (u *UsersService) GetItemstOnAPersonalList(ctx context.Context, id *string, listID *string, t *string) ([]*str.UserListItem, *str.Response, error)
GetItemstOnAPersonalList Get all items on a personal list.
API docs: https://trakt.docs.apiary.io/#reference/users/list-items/get-items-on-a-personal-list
func (*UsersService) GetUserProfile ¶
func (u *UsersService) GetUserProfile(ctx context.Context, id *string) (*str.UserProfile, *str.Response, error)
GetUserProfile Get a user's profile information.
API docs:https://trakt.docs.apiary.io/#reference/users/profile/get-user-profile
func (*UsersService) GetUsersPersonalLists ¶
func (u *UsersService) GetUsersPersonalLists(ctx context.Context, id *string) ([]*str.PersonalList, *str.Response, error)
GetUsersPersonalLists Returns all personal lists for a user.
API docs: https://trakt.docs.apiary.io/#reference/users/lists/get-a-user's-personal-lists