rottentomatoes

package module
v0.0.0-...-4ccee1c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2014 License: MIT Imports: 9 Imported by: 1

README

Rotten Tomatoes API rottentomatoes

rottentomatoes is a Go client library for accessing the Rotten Tomatoes API.

Documentation: http://godoc.org/github.com/rojters/rottentomatoes
Rotten Tomatoes API Documentation: http://developer.rottentomatoes.com/
Build Status: travis-ci status

Usage

import "github.com/rojters/rottentomatoes"

Construct a new Rotten Tomatoes client, then use the various services on the client to access different parts of the Rotten Tomatoes API. For example, to find information about a particular movie using it's IMDb Id:

rt := rottentomatoes.NewClient(nil, "")
// http://www.imdb.com/title/tt0118715/ (The Big Lebowski)
m, _ := rt.DetailedInfo.MovieAlias("0118715")

Some API methods have optional parameters that can be passed. For example, to page limit the number of results returned:

rt := rottentomatoes.NewClient(nil, "")
opt := &rottentomatoes.Options{PageLimit: 10}
it, _ := rt.MovieLists.InTheaters(Opt)

License

MIT

Documentation

Overview

Package rottentomatoes provides a client for using the Rotten Tomatoes API.

Usage:

import "github.com/rojters/rottentomatoes"

Construct a new Rotten Tomatoes client, then use the various services on the client to access different parts of the Rotten Tomatoes API. For example, to find information about a particular movie using it's IMDb Id:

rt := rottentomatoes.NewClient(nil, "")
// http://www.imdb.com/title/tt0118715/ (The Big Lebowski)
m, _ := rt.DetailedInfo.MovieAlias("0118715")

Some API methods have optional parameters that can be passed. For example, to page limit the number of results returned:

rt := rottentomatoes.NewClient(nil, "")
opt := &rottentomatoes.Options{PageLimit: 10}
it, _ := rt.MovieLists.InTheaters(Opt)

The services of a client divide the API into logical chunks and correspond to the structure of the Rotten Tomatoes API Documentation at http://developer.rottentomatoes.com/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlternateIds

type AlternateIds struct {
	IMDB Id `json:"imdb,omitempty"`
}

type Cast

type Cast struct {
	Name       string   `json:"name"`
	Id         Id       `json:"id"`
	Characters []string `json:"characters"`
}
type CastInfoLinks struct {
	Rel string `json:"rel,omitempty"`
}

type CastInfoResponse

type CastInfoResponse struct {
	Cast  []Cast        `json:"cast,omitempty"`
	Links CastInfoLinks `json:"links,omitempty"`
}

type Client

type Client struct {

	// ApiKey required to use the Rotten Tomatoes API.
	ApiKey string

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent used when communicating with the Rotten Tomatoes API.
	UserAgent string

	// Services are grouped as on http://developer.rottentomatoes.com/io-docs
	MovieLists    *MovieListsService
	DVDLists      *DVDListsService
	DetailedInfo  *DetailedInfoService
	Search        *SearchService
	TopLevelLists *TopLevelListsService
	// contains filtered or unexported fields
}

Rotten Tomatoes API client.

func NewClient

func NewClient(httpClient *http.Client, apiKey string) *Client

NewClient returns a new Rotten Tomatoes API client. If a nil httpClient is provided, http.DefaultClient will be used. A Rotten Tomatoes API key is required for use which can be obtained at http://developer.rottentomatoes.com/ Provide the key as a string, or store it in an environment variable 'ROTTENTOMATOES_APIKEY' and pass the empty string.

type Clip

type Clip struct {
	Title     string    `json:"title,omitempty"`
	Duration  string    `json:"duration,omitempty"`
	Thumbnail string    `json:"thumbnail,omitempty"`
	Links     ClipLinks `json:"links,omitempty"`
}
type ClipLinks struct {
	Alternate string `json:"alternate,omitempty"`
}
type DVDListsDirectoryLinks struct {
	TopRentals      string `json:"top_rentals,omitempty"`
	CurrentReleases string `json:"current_releases,omitempty"`
	NewReleases     string `json:"new_releases,omitempty"`
	Upcoming        string `json:"upcoming,omitempty"`
}

type DVDListsDirectoryResponse

type DVDListsDirectoryResponse struct {
	Links DVDListsDirectoryLinks `json:"links,omitempty"`
}

type DVDListsService

type DVDListsService struct {
	// contains filtered or unexported fields
}

func (*DVDListsService) CurrentReleaseDVDs

func (d *DVDListsService) CurrentReleaseDVDs(opt *Options) (*MovieListsResponse, error)

Returns current release dvds. Results are paginated if they go past the specified page limit. Available options: PageLimit, Page, Country.

func (*DVDListsService) NewReleaseDVDs

func (d *DVDListsService) NewReleaseDVDs(opt *Options) (*MovieListsResponse, error)

Returns new release dvds. Results are paginated if they go past the specified page limit. Available options: PageLimit, Page, Country.

func (*DVDListsService) TopRentals

func (d *DVDListsService) TopRentals(opt *Options) (*MovieListsResponse, error)

Returns the current top dvd rentals. Available options: Limit, Country.

func (*DVDListsService) UpcomingDVDs

func (d *DVDListsService) UpcomingDVDs(opt *Options) (*MovieListsResponse, error)

Returns upcoming dvds. Results are paginated if they go past the specified page limit. Available options: PageLimit, Page, Country.

type DetailedInfoService

type DetailedInfoService struct {
	// contains filtered or unexported fields
}

func (*DetailedInfoService) CastInfo

func (d *DetailedInfoService) CastInfo(id string) (*CastInfoResponse, error)

Returns the complete movie cast for a movie.

func (*DetailedInfoService) MovieAlias

func (d *DetailedInfoService) MovieAlias(imdbId string) (*Movie, error)

Same as MovieInfo but provides a movie lookup by an id from a different vendor. Only supports imdb lookup at this time. Note: skip the initial 'tt'.

func (*DetailedInfoService) MovieClips

func (d *DetailedInfoService) MovieClips(id string) (*MovieClipsResponse, error)

Returns related movie clips and trailers for a movie

func (*DetailedInfoService) MovieInfo

func (d *DetailedInfoService) MovieInfo(id string) (*Movie, error)

Returns detailed information on a specific movie specified by Id.

func (*DetailedInfoService) MovieReviews

func (d *DetailedInfoService) MovieReviews(id string, opt *Options) (*MovieReviewsResponse, error)

Returns the reviews for a movie. Results are paginated if they go past the specified page limit. Available options: PageLimit, Page, Country, ReviewType

func (*DetailedInfoService) MovieSimilar

func (d *DetailedInfoService) MovieSimilar(id string, opt *Options) (*MovieSimilarResponse, error)

Returns similar movies for a movie. Available options: Limit

type Director

type Director struct {
	Name string `json:"name,omitempty"`
}

type Id

type Id int64

func (*Id) UnmarshalJSON

func (i *Id) UnmarshalJSON(b []byte) (err error)

type IntWrapper

type IntWrapper int64

The Rotten Tomatoes API sends an empty string if the field is missing rather than omitting it.

func (*IntWrapper) UnmarshalJSON

func (i *IntWrapper) UnmarshalJSON(b []byte) (err error)
type ListsDirectoryLinks struct {
	Movies string `json:"movies,omitempty"`
	DVDs   string `json:"dvds,omitempty"`
}

type ListsDirectoryResponse

type ListsDirectoryResponse struct {
	Links ListsDirectoryLinks `json:"links,omitempty"`
}

type Movie

type Movie struct {
	Id                Id           `json:"id,omitempty"`
	Title             string       `json:"title,omitempty"`
	Year              IntWrapper   `json:"year,omitempty"`
	Genres            []string     `json:"genres,omitempty"`
	MPAA_Rating       string       `json:"mpaa_rating,omitempty"`
	Runtime           IntWrapper   `json:"runtime,omitempty"`
	CriticsConsensus  string       `json:"critics_consensus,omitempty"`
	ReleaseDates      ReleaseDates `json:"release_dates,omitempty"`
	Ratings           Ratings      `json:"ratings,omitempty"`
	Synopsis          string       `json:"synopsis,omitempty"`
	Posters           Posters      `json:"posters,omitempty"`
	AbridgedCast      []Cast       `json:"abridged_cast,omitempty"`
	AbridgedDirectors []Director   `json:"abridged_directors,omitempty"`
	Studio            string       `json:"studio,omitempty"`
	AlternateIds      AlternateIds `json:"alternate_ids,omitempty"`
	Links             MovieLinks   `json:"links,omitempty"`
	LinkTemplate      string       `json:"link_template,omitempty"`
}
type MovieClipLinks struct {
	Alternate string `json:"alternate,omitempty"`
	Rel       string `json:"rel,omitempty"`
	Self      string `json:"self,omitempty"`
}

type MovieClipsResponse

type MovieClipsResponse struct {
	Clips []Clip         `json:"clips,omitempty"`
	Links MovieClipLinks `json:"links,omitempty"`
}
type MovieLinks struct {
	Self      string `json:"self,omitempty"`
	Alternate string `json:"alternate,omitempty"`
	Cast      string `json:"cast,omitempty"`
	Clips     string `json:"clips,omitempty"`
	Reviews   string `json:"reviews,omitempty"`
	Similar   string `json:"similar,omitempty"`
	Canonical string `json:"canonical,omitempty"`
}
type MovieListsDirectoryLinks struct {
	BoxOffice  string `json:"box_office,omitempty"`
	InTheaters string `json:"in_theaters,omitempty"`
	Opening    string `json:"opening,omitempty"`
	Upcoming   string `json:"upcoming,omitempty"`
}

type MovieListsDirectoryResponse

type MovieListsDirectoryResponse struct {
	Links MovieListsDirectoryLinks `json:"links,omitempty"`
}

type MovieListsResponse

type MovieListsResponse struct {
	Total        int        `json:"total,omitempty"`
	Movies       []Movie    `json:"movies,omitempty"`
	Links        MovieLinks `json:"links,omitempty"`
	LinkTemplate string     `json:"link_template,omitempty"`
}

type MovieListsService

type MovieListsService struct {
	// contains filtered or unexported fields
}

func (*MovieListsService) BoxOffice

func (m *MovieListsService) BoxOffice(opt *Options) (*MovieListsResponse, error)

Returns Top Box Office Earning Movies, Sorted by Most Recent Weekend Gross Ticket Sales. Available options: Limit, Country.

func (*MovieListsService) InTheaters

func (m *MovieListsService) InTheaters(opt *Options) (*MovieListsResponse, error)

Returns movies currently in theaters. Available options: PageLimit, Page, Country.

func (*MovieListsService) OpeningMovies

func (m *MovieListsService) OpeningMovies(opt *Options) (*MovieListsResponse, error)

Returns current opening movies. Available options: Limit, Country.

func (*MovieListsService) UpcomingMovies

func (m *MovieListsService) UpcomingMovies(opt *Options) (*MovieListsResponse, error)

Returns upcoming movies. Results are paginated if they go past the specified page limit. Available options: PageLimit, Page, Country.

type MovieReviewsLinks struct {
	Alternate string `json:"alternate,omitempty"`
	Next      string `json:"next,omitempty"`
	Rel       string `json:"rel,omitempty"`
	Self      string `json:"self,omitempty"`
}

type MovieReviewsResponse

type MovieReviewsResponse struct {
	Total        int               `json:"total,omitempty"`
	Reviews      []Review          `json:"reviews,omitempty"`
	Links        MovieReviewsLinks `json:"links,omitempty"`
	LinkTemplate string            `json:"link_template,omitempty"`
}
type MovieSimilarLinks struct {
	Rel  string `json:"rel,omitempty"`
	Self string `json:"self,omitempty"`
}

type MovieSimilarResponse

type MovieSimilarResponse struct {
	Movies       []Movie           `json:"movies,omitempty"`
	Links        MovieSimilarLinks `json:"links,omitempty"`
	LinkTemplate string            `json:"link_template,omitempty"`
}

type Options

type Options struct {
	// ApiKey required to use the Rotten Tomatoes API.
	ApiKey string `url:"apikey,omitempty"`

	// Provides localized data for the selected country
	// (ISO 3166-1 alpha-2) if available. Otherwise, returns US data.
	Country string `url:"country,omitempty"`

	// Movie ID.
	Id string `url:"id,omitempty"`

	// Limit the number of entities returned
	Limit int `url:"limit,omitempty"`

	// The selected page of entities
	Page int `url:"page,omitempty"`

	// The amount of entities to get per request
	PageLimit int `url:"page_limit,omitempty"`

	//The plain text search query to search for a movie.
	Query string `url:"q,omitempty"`

	// 3 different review types are possible: 'all', 'top_critic' and 'dvd'.
	// 'top_critic' shows all the Rotten Tomatoes designated top critics.
	// 'dvd' pulls the reviews given on the DVD of the movie.
	// 'all' as the name implies retrieves all reviews.
	ReviewType string `url:"review_type,omitempty"`

	// Movies Alias type, only supports 'imdb' lookup at this time.
	Type string `url:"type,omitempty"`
}

type Posters

type Posters struct {
	Thumbnail string `json:"thumbnail,omitempty"`
	Profile   string `json:"Profile,omitempty"`
	Detailed  string `json:"Detailed,omitempty"`
	Original  string `json:"original,omitempty"`
}

type Ratings

type Ratings struct {
	CriticsRating  string `json:"critics_rating,omitempty"`
	CriticsScore   int    `json:"critics_score,omitempty"`
	AudienceRating string `json:"audience_rating,omitempty"`
	AudienceScore  int    `json:"audience_score,omitempty"`
}

type ReleaseDates

type ReleaseDates struct {
	Theater string `json:"theater,omitempty"`
	DVD     string `json:"dvd,omitempty"`
}

type Review

type Review struct {
	Critic      string      `json:"critic,omitempty"`
	Date        string      `json:"date,omitempty"`
	Freshness   string      `json:"freshness,omitempty"`
	Publication string      `json:"publication,omitempty"`
	Quote       string      `json:"quote,omitempty"`
	Links       ReviewLinks `json:"links,omitempty"`
}
type ReviewLinks struct {
	Review string `json:"review,omitempty"`
}

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

func (*SearchService) MovieSearch

func (s *SearchService) MovieSearch(query string, opt *Options) (*MovieListsResponse, error)

Returns movies from search results. Available options: PageLimit, Page.

type TopLevelListsService

type TopLevelListsService struct {
	// contains filtered or unexported fields
}

func (*TopLevelListsService) DVDListsDirectory

func (t *TopLevelListsService) DVDListsDirectory() (*DVDListsDirectoryResponse, error)

Returns the dvd lists.

func (*TopLevelListsService) ListsDirectory

func (t *TopLevelListsService) ListsDirectory() (*ListsDirectoryResponse, error)

Returns the top level lists available in the API.

func (*TopLevelListsService) MovieListsDirectory

func (t *TopLevelListsService) MovieListsDirectory() (*MovieListsDirectoryResponse, error)

Returns the movie lists.

Jump to

Keyboard shortcuts

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