Documentation ¶
Overview ¶
Package tvdb a simple interface to thetvdb.com REST API
Copyright 2016 Lorenzo Giuliani <lorenzo@frenzart.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type Auth
- type Client
- type Episode
- type EpisodeRecordData
- type EpisodeSearchParams
- type EpisodesRecordData
- type EpisodesService
- type JSONError
- type JSONErrors
- type Links
- type SearchParams
- type SearchService
- func (s *SearchService) ByImdbID(id string) ([]*SeriesSearchData, error)
- func (s *SearchService) ByName(name string) ([]*SeriesSearchData, error)
- func (s *SearchService) ByZap2itID(id string) ([]*SeriesSearchData, error)
- func (s *SearchService) Search(params *SearchParams) ([]*SeriesSearchData, error)
- type Series
- type SeriesData
- type SeriesSearchData
- type SeriesSearchResults
- type SeriesService
- type Token
- type TokenService
Constants ¶
const (
// Version of the client
Version = "0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Authentication configuration Auth *Auth // Services Search *SearchService Series *SeriesService Episodes *EpisodesService Token *TokenService // contains filtered or unexported fields }
Client is the TvDB REST API client
type Episode ¶
type Episode struct { ID int32 `json:"id,omitempty"` AiredSeason int32 `json:"airedSeason,omitempty"` AiredEpisodeNumber int32 `json:"airedEpisodeNumber,omitempty"` EpisodeName string `json:"episodeName,omitempty"` FirstAired string `json:"firstAired,omitempty"` GuestStars []string `json:"guestStars,omitempty"` Director string `json:"director,omitempty"` Directors []string `json:"directors,omitempty"` Writers []string `json:"writers,omitempty"` Overview string `json:"overview,omitempty"` ProductionCode string `json:"productionCode,omitempty"` ShowURL string `json:"showUrl,omitempty"` LastUpdated int32 `json:"lastUpdated,omitempty"` DvdDiscid string `json:"dvdDiscid,omitempty"` DvdSeason int32 `json:"dvdSeason,omitempty"` DvdEpisodeNumber float32 `json:"dvdEpisodeNumber,omitempty"` DvdChapter float32 `json:"dvdChapter,omitempty"` AbsoluteNumber int32 `json:"absoluteNumber,omitempty"` Filename string `json:"filename,omitempty"` SeriesID string `json:"seriesId,omitempty"` LastUpdatedBy string `json:"lastUpdatedBy,omitempty"` AirsAfterSeason int32 `json:"airsAfterSeason,omitempty"` AirsBeforeSeason int32 `json:"airsBeforeSeason,omitempty"` AirsBeforeEpisode int32 `json:"airsBeforeEpisode,omitempty"` ThumbAuthor int32 `json:"thumbAuthor,omitempty"` ThumbAdded string `json:"thumbAdded,omitempty"` ThumbWidth string `json:"thumbWidth,omitempty"` ThumbHeight string `json:"thumbHeight,omitempty"` ImdbID string `json:"imdbId,omitempty"` SiteRating float32 `json:"siteRating,omitempty"` SiteRatingCount int32 `json:"siteRatingCount,omitempty"` }
Episode a single episode
func (*Episode) IsInFuture ¶
Check if an episode is in the future
func (*Episode) ParseAired ¶
I guess date/time parsing is difficult in go
type EpisodeRecordData ¶
type EpisodeRecordData struct { Data Episode `json:"data,omitempty"` Errors JSONError `json:"jsonError,omitempty"` }
EpisodeRecordData Searches results
type EpisodeSearchParams ¶
type EpisodeSearchParams struct { AbsoluteNumber *string `url:"absoluteNumber,omitempty"` AiredSeason *string `url:"airedSeason,omitempty"` AiredEpisode *string `url:"airedEpisode,omitempty"` DvdSeason *string `url:"dvdSeason,omitempty"` DvdEpisode *string `url:"dvdEpisode,omitempty"` ImdbId *string `url:"imdbId,omitempty"` Page *string `url:"page,omitempty"` }
SearchParams optional episodes search parameters
type EpisodesRecordData ¶
type EpisodesRecordData struct { Data []Episode `json:"data,omitempty"` Links Links `json:"links,omitempty"` }
Episodes Search Results
type EpisodesService ¶
type EpisodesService struct {
// contains filtered or unexported fields
}
EpisodesService the episode service
func (*EpisodesService) Get ¶
func (s *EpisodesService) Get(id int32) (*Episode, error)
Get a single episode
func (*EpisodesService) ListEpisodes ¶
func (s *EpisodesService) ListEpisodes(seriesId int32, params *EpisodeSearchParams) (*EpisodesRecordData, error)
Note, only use the page value in EpisodeSearchParams
func (*EpisodesService) SearchEpisodes ¶
func (s *EpisodesService) SearchEpisodes(seriesId int32, params *EpisodeSearchParams) (*EpisodesRecordData, error)
Find episodes meeting certain criteria
type JSONError ¶
type JSONError struct {
Message string `json:"error,omitempty"`
}
JSONError is a generic type for errors
type JSONErrors ¶
type JSONErrors []JSONError
func (*JSONErrors) UnmarshalJSON ¶
func (j *JSONErrors) UnmarshalJSON(p []byte) error
type Links ¶
type SearchParams ¶
type SearchParams struct { Name *string `url:"name,omitempty"` ImdbID *string `url:"imdbId,omitempty"` Zap2itID *string `url:"zap2itId,omitempty"` }
SearchParams all optional search parameters
type SearchService ¶
type SearchService struct {
// contains filtered or unexported fields
}
SearchService provides an interface to the search engine
func (*SearchService) ByImdbID ¶
func (s *SearchService) ByImdbID(id string) ([]*SeriesSearchData, error)
ByImdbID Search by IMDB id
func (*SearchService) ByName ¶
func (s *SearchService) ByName(name string) ([]*SeriesSearchData, error)
ByName Search series by name
func (*SearchService) ByZap2itID ¶
func (s *SearchService) ByZap2itID(id string) ([]*SeriesSearchData, error)
ByZap2itID Search by Zap2it id
func (*SearchService) Search ¶
func (s *SearchService) Search(params *SearchParams) ([]*SeriesSearchData, error)
Search search by SearchParams
type Series ¶
type Series struct { ID int32 `json:"id"` SeriesName string `json:"seriesName"` Aliases []string `json:"aliases,omitempty"` Banner string `json:"banner,omitempty"` SeriesID string `json:"seriesId,omitempty"` Status string `json:"status,omitempty"` FirstAired string `json:"firstAired,omitempty"` Network string `json:"network,omitempty"` NetworkID string `json:"networkId,omitempty"` Runtime string `json:"runtime,omitempty"` Genre []string `json:"genre,omitempty"` Overview string `json:"overview,omitempty"` LastUpdated int32 `json:"lastUpdated,omitempty"` AirsDayOfWeek string `json:"airsDayOfWeek,omitempty"` AirsTime string `json:"airsTime,omitempty"` Rating string `json:"rating,omitempty"` ImdbID string `json:"imdbId,omitempty"` Zap2itID string `json:"zap2itId,omitempty"` Added string `json:"added,omitempty"` SiteRating float32 `json:"siteRating,omitempty"` SiteRatingCount int32 `json:"siteRatingCount,omitempty"` }
Series type
type SeriesData ¶
type SeriesData struct { Data Series `json:"data,omitempty"` Errors JSONErrors `json:"errors,omitempty"` }
SeriesData response container
type SeriesSearchData ¶
type SeriesSearchData struct { ID int32 `json:"id,omitempty"` Aliases []string `json:"aliases,omitempty"` Banner string `json:"banner,omitempty"` FirstAired string `json:"firstAired,omitempty"` Network string `json:"network,omitempty"` Overview string `json:"overview,omitempty"` SeriesName string `json:"seriesName,omitempty"` Status string `json:"status,omitempty"` }
SeriesSearchData type definition of search results
type SeriesSearchResults ¶
type SeriesSearchResults struct {
Data []*SeriesSearchData `json:"data,omitempty"`
}
SeriesSearchResults contains search results
type SeriesService ¶
type SeriesService struct {
// contains filtered or unexported fields
}
SeriesService TV Series service
type TokenService ¶
TokenService tv series service
func (*TokenService) Login ¶
func (s *TokenService) Login() (*Token, error)
Login requests and applies a new Token to the base client