tvdb

package module
v0.0.0-...-9098706 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: MIT Imports: 8 Imported by: 1

README

tvdb CircleCI Go Report Card

TVDB v2.0 API wrapper for Go

Installation

go get -u github.com/danesparza/tvdb

Example

// Create a client and search request
client := tvdb.Client{}
request := tvdb.SeriesEpisodesRequest{Name: "Looney Tunes"}

// Search for the series
responses, err := client.SeriesSearch(request)

// Loop through the TV series information in the resopnse:
for _, response := range responses {
  fmt.Printf("Series name: %v", response.SeriesName)
}
  

This should print:

Series name: Looney Tunes
Series name: The Looney Tunes Show (2011)
Series name: ** 403: Series Not Permitted **
Series name: Baby Looney Tunes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	APIKey   string `json:"apikey,omitempty"`
	Username string `json:"username,omitempty"`
	UserKey  string `json:"userkey,omitempty"`
}

AuthRequest represents the login parameters

type AuthResponse

type AuthResponse struct {
	Token string `json:"token"`
}

AuthResponse represents the authorization response

type BasicEpisode

type BasicEpisode struct {
	AbsoluteNumber     int    `json:"absoluteNumber"`
	AiredEpisodeNumber int    `json:"airedEpisodeNumber"`
	AiredSeason        int    `json:"airedSeason"`
	AiredSeasonID      int    `json:"airedSeasonID"`
	DVDEpisodeNumber   int    `json:"dvdEpisodeNumber"`
	DVDSeason          int    `json:"dvdSeason"`
	EpisodeName        string `json:"episodeName"`
	FirstAired         string `json:"firstAired"`
	ID                 int    `json:"id"`
	LastUpdated        int    `json:"lastUpdated"`
	Overview           string `json:"overview"`
}

BasicEpisode represents a response for episode information from the TVDB service

type Client

type Client struct {
	ServiceURL string
	Token      string
	Language   string
	Version    string
}

Client is a service client to the TVDB service

func (*Client) EpisodesForSeries

func (client *Client) EpisodesForSeries(request SeriesEpisodesRequest) ([]BasicEpisode, error)

EpisodesForSeries searches for episodes in a given TV series

func (*Client) GetEpisode

func (client *Client) GetEpisode(request SeriesRequest) (Episode, error)

GetEpisode gets an Single Episode by the provided EpisodeID

func (*Client) GetSeries

func (client *Client) GetSeries(request SeriesRequest) (Series, error)

GetSeries get's information about a given TV series

func (*Client) GetSeriesActors

func (client *Client) GetSeriesActors(request SeriesRequest) ([]SeriesActorsData, error)

GetSeriesActors gets all available actors for a given show id

func (*Client) GetSeriesImages

func (client *Client) GetSeriesImages(request SeriesImageQueryRequest) ([]SeriesImagesCount, error)

GetSeriesImages gets images for a given show id and image type, if no KeyType is given it defaults to poster

func (*Client) GetUpdated

func (client *Client) GetUpdated(request UpdatedRequest) ([]UpdatedResponse, error)

GetUpdated gets updated id's since a given unixtimestamp

func (*Client) Login

func (client *Client) Login(request AuthRequest) (AuthResponse, error)

Login and get a bearer token

func (*Client) SeriesSearch

func (client *Client) SeriesSearch(request SeriesSearchRequest) ([]SeriesSearchData, error)

SeriesSearch search for a given TV series

type Episode

type Episode struct {
	AbsoluteNumber     int      `json:"absoluteNumber,omitempty"`
	AiredEpisodeNumber int      `json:"airedEpisodeNumber,omitempty"`
	AiredSeason        int      `json:"airedSeason,omitempty"`
	AirsAfterSeason    int      `json:"airsAfterSeason,omitempty"`
	AirsBeforeEpisode  int      `json:"airsBeforeEpisode,omitempty"`
	AirsBeforeSeason   int      `json:"airsBeforeSeason,omitempty"`
	Director           string   `json:"director,omitempty"`
	Directors          []string `json:"directors,omitempty"`
	DvdChapter         float32  `json:"dvdChapter,omitempty"`
	DvdDiscID          string   `json:"dvdDiscid,omitempty"`
	DvdEpisodeNumber   float32  `json:"dvdEpisodeNumber,omitempty"`
	DvdSeason          int      `json:"dvdSeason,omitempty"`
	EpisodeName        string   `json:"episodeName,omitempty"`
	Filename           string   `json:"filename,omitempty"`
	FirstAired         string   `json:"firstAired,omitempty"`
	GuestStars         []string `json:"guestStars,omitempty"`
	ID                 int      `json:"id,omitempty"`
	ImdbID             string   `json:"imdbId,omitempty"`
	LastUpdated        int      `json:"lastUpdated,omitempty"`
	LastUpdatedBy      int      `json:"lastUpdatedBy,omitempty"`
	Overview           string   `json:"overview,omitempty"`
	ProductionCode     string   `json:"productionCode,omitempty"`
	SeriesID           int      `json:"seriesId,omitempty"`
	ShowURL            string   `json:"showUrl,omitempty"`
	SiteRating         float32  `json:"siteRating,omitempty"`
	SiteRatingCount    int      `json:"siteRatingCount,omitempty"`
	ThumbAdded         string   `json:"thumbAdded,omitempty"`
	ThumbAuthor        int      `json:"thumbAuthor,omitempty"`
	ThumbHeight        string   `json:"thumbHeight,omitempty"`
	ThumbWidth         string   `json:"thumbWidth,omitempty"`
	Writers            []string `json:"writers,omitempty"`
}

Episode contains all informations about a single Episode

type EpisodeRecordData

type EpisodeRecordData struct {
	Data   Episode    `json:"data,omitempty"`
	Errors JSONErrors `json:"errors,omitempty"`
}

EpisodeRecordData contains the Server Response when requesting a single Episode

type JSONErrors

type JSONErrors struct {
	// Invalid filters passed to route
	InvalidFilters []string `json:"invalidFilters,omitempty"`
	// Invalid language or translation missing
	InvalidLanguage string `json:"invalidLanguage,omitempty"`
	// Invalid query params passed to route
	InvalidQueryParams []string `json:"invalidQueryParams,omitempty"`
}

JSONErrors contains errors that might be send back by the API

type Links struct {
	FirstPage    int `json:"first"`
	LastPage     int `json:"last"`
	NextPage     int `json:"next"`
	PreviousPage int `json:"prev"`
}

Links represents the paging information for multiple episode responses

type Series

type Series struct {
	Added           string   `json:"added"`
	AirsDayOfWeek   string   `json:"airsDayOfWeek"`
	AirsTime        string   `json:"airsTime"`
	Aliases         []string `json:"aliases"`
	Banner          string   `json:"banner"`
	FirstAired      string   `json:"firstAired"`
	Genre           []string `json:"genre"`
	ID              int      `json:"id"`
	ImdbID          string   `json:"imdbId"`
	LastUpdated     int      `json:"lastUpdated"`
	Network         string   `json:"network"`
	NetworkID       string   `json:"networkId"`
	Overview        string   `json:"overview"`
	Rating          string   `json:"rating"`
	Runtime         string   `json:"runtime"`
	SeriesID        string   `json:"seriesId"`
	SeriesName      string   `json:"seriesName"`
	SiteRating      float64  `json:"siteRating"`
	SiteRatingCount int      `json:"siteRatingCount"`
	Status          string   `json:"status"`
	Zap2itID        string   `json:"zap2itId"`
}

Series represents a response for series information from the TVDB service

type SeriesActors

type SeriesActors struct {
	Data []SeriesActorsData `json:"data"`
}

SeriesActors is the response of the api when asking for authors

type SeriesActorsData

type SeriesActorsData struct {
	ID          int    `json:"id"`
	Image       string `json:"image"`
	ImageAdded  string `json:"imageAdded"`
	ImageAuthor int    `json:"imageAuthor"`
	LastUpdated string `json:"lastUpdated"`
	Name        string `json:"name"`
	Role        string `json:"role"`
	SeriesID    int    `json:"seriesId"`
	SortOrder   int    `json:"sortOrder"`
}

SeriesActorsData contains information about a single actor

type SeriesData

type SeriesData struct {
	Data   Series     `json:"data"`
	Errors JSONErrors `json:"errors,omitempty"`
}

SeriesData represents the list of responses to get series information

type SeriesEpisodes

type SeriesEpisodes struct {
	Links  Links          `json:"links"`
	Data   []BasicEpisode `json:"data"`
	Errors JSONErrors     `json:"errors,omitempty"`
}

SeriesEpisodes represents the list of responses to get episode information

type SeriesEpisodesRequest

type SeriesEpisodesRequest struct {
	SeriesID int

	/* Query parameters */
	AiredEpisode int `json:"airedEpisode"`
	AiredSeason  int `json:"airedSeason"`
	DVDEpisode   int `json:"dvdEpisode"`
	DVDSeason    int `json:"dvdSeason"`
	IMDBId       int `json:"imdbId"`
}

SeriesEpisodesRequest represents a request to get episode information for a series

type SeriesEpisodesSummary

type SeriesEpisodesSummary struct {
	// Number of all aired episodes for this series
	AiredEpisodes string   `json:"airedEpisodes,omitempty"`
	AiredSeasons  []string `json:"airedSeasons,omitempty"`
	// Number of all dvd episodes for this series
	DvdEpisodes string   `json:"dvdEpisodes,omitempty"`
	DvdSeasons  []string `json:"dvdSeasons,omitempty"`
}

SeriesEpisodesSummary Returns a summary of the episodes and seasons available for the series.

type SeriesImageQueryRequest

type SeriesImageQueryRequest struct {
	SeriesID   int    `json:"id"`
	KeyType    string `json:"keyType"`
	Resulution string `json:"resulution"`
	SubKey     string `json:"subKey"`
}

SeriesImageQueryRequest used to query images for a given series and type

type SeriesImagesCount

type SeriesImagesCount struct {
	FileName    string             `json:"fileName"`
	ID          int                `json:"id"`
	KeyType     string             `json:"keyType"`
	LanguageID  int                `json:"languageId"`
	RatingsInfo map[string]float64 `json:"ratingsInfo"`
	Resolution  string             `json:"resulution"`
	SubKey      string             `json:"subKey"`
	Thumbnail   string             `json:"thumbnail"`
}

SeriesImagesCount one single image response

type SeriesImagesCounts

type SeriesImagesCounts struct {
	Data []SeriesImagesCount `json:"data"`
}

SeriesImagesCounts is the response of the api when asking for images

type SeriesRequest

type SeriesRequest struct {
	SeriesID int `json:"id"`
}

SeriesRequest is used to request additional series information

type SeriesSearchData

type SeriesSearchData struct {
	Aliases    []string `json:"aliases"`
	Banner     string   `json:"banner"`
	FirstAired string   `json:"firstAired"`
	ID         int      `json:"id"`
	Network    string   `json:"network"`
	Overview   string   `json:"overview"`
	SeriesName string   `json:"seriesName"`
	Status     string   `json:"status"`
}

SeriesSearchData represents TV series information in the search response

type SeriesSearchRequest

type SeriesSearchRequest struct {
	Name     string
	IMDBID   string
	Zap2ItID string
}

SeriesSearchRequest represents the request

type SeriesSearchResponses

type SeriesSearchResponses struct {
	Data []SeriesSearchData `json:"data"`
}

SeriesSearchResponses represents a search response from the service

type UpdatedRequest

type UpdatedRequest struct {
	FromTime int64 `json:"fromTime"`
	ToTime   int64 `json:"toTime"`
}

UpdatedRequest must be used when making the requst

type UpdatedResponse

type UpdatedResponse struct {
	ID          int `json:"id"`
	LastUpdated int `json:"lastUpdated"`
}

UpdatedResponse a single UpdatedResponse

type UpdatedResponses

type UpdatedResponses struct {
	Data []UpdatedResponse `json:"data"`
}

UpdatedResponses contains the response returned by the API Server

Jump to

Keyboard shortcuts

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