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 ¶
- type AlternateIds
- type Cast
- type CastInfoLinks
- type CastInfoResponse
- type Client
- type Clip
- type ClipLinks
- type DVDListsDirectoryLinks
- type DVDListsDirectoryResponse
- type DVDListsService
- func (d *DVDListsService) CurrentReleaseDVDs(opt *Options) (*MovieListsResponse, error)
- func (d *DVDListsService) NewReleaseDVDs(opt *Options) (*MovieListsResponse, error)
- func (d *DVDListsService) TopRentals(opt *Options) (*MovieListsResponse, error)
- func (d *DVDListsService) UpcomingDVDs(opt *Options) (*MovieListsResponse, error)
- type DetailedInfoService
- func (d *DetailedInfoService) CastInfo(id string) (*CastInfoResponse, error)
- func (d *DetailedInfoService) MovieAlias(imdbId string) (*Movie, error)
- func (d *DetailedInfoService) MovieClips(id string) (*MovieClipsResponse, error)
- func (d *DetailedInfoService) MovieInfo(id string) (*Movie, error)
- func (d *DetailedInfoService) MovieReviews(id string, opt *Options) (*MovieReviewsResponse, error)
- func (d *DetailedInfoService) MovieSimilar(id string, opt *Options) (*MovieSimilarResponse, error)
- type Director
- type Id
- type IntWrapper
- type ListsDirectoryLinks
- type ListsDirectoryResponse
- type Movie
- type MovieClipLinks
- type MovieClipsResponse
- type MovieLinks
- type MovieListsDirectoryLinks
- type MovieListsDirectoryResponse
- type MovieListsResponse
- type MovieListsService
- func (m *MovieListsService) BoxOffice(opt *Options) (*MovieListsResponse, error)
- func (m *MovieListsService) InTheaters(opt *Options) (*MovieListsResponse, error)
- func (m *MovieListsService) OpeningMovies(opt *Options) (*MovieListsResponse, error)
- func (m *MovieListsService) UpcomingMovies(opt *Options) (*MovieListsResponse, error)
- type MovieReviewsLinks
- type MovieReviewsResponse
- type MovieSimilarLinks
- type MovieSimilarResponse
- type Options
- type Posters
- type Ratings
- type ReleaseDates
- type Review
- type ReviewLinks
- type SearchService
- type TopLevelListsService
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 CastInfoLinks ¶
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 ¶
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 DVDListsDirectoryLinks ¶
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 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 ¶
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 ¶
type MovieClipsResponse ¶
type MovieClipsResponse struct { Clips []Clip `json:"clips,omitempty"` Links MovieClipLinks `json:"links,omitempty"` }
type MovieLinks ¶
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 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 ¶
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 ¶
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 ReleaseDates ¶
type ReviewLinks ¶
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.