moviebuff

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

moviebuff-sdk-go is Go SDK for Moviebuff.

The Moviebuff is a service that offers information about movies, people and entities.

All resources are identified by a UUID, which Moviebuff.com uniquely and randomly generates. Since it may be difficult to get the Moviebuff UUID of any resource without prior knowledge, the API also allows substitution of the UUID with the URL identifier of the resource. For instance, if when attempting to get information for 12 Years a Slave (moviebuff.com/12-years-a-slave), either its UUID or the identifier 12-years-a-slave may be used.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken         = errors.New("access denied")
	ErrResponseNotReceived  = errors.New("could not receive valid response")
	ErrResourceDoesNotExist = errors.New("resource does not exist")
)

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	ID        string    `json:"calendarId"`
	Name      string    `json:"name"`
	Holidays  []Holiday `json:"holidays"`
	SyncToken string    `json:"syncToken"`
	TimeZone  string    `json:"timeZone"`
}

Calendar - contains the info about the country's public holidays

type Certification

type Certification struct {
	//Indicates whether this certification represents safe for children
	ChildSafe bool `json:"childSafe"`
	// UUID of this certification
	UUID string `json:"uuid"`
	// Readable code for this certification
	Code string `json:"code"`
	// Country of this certification
	Country Country `json:"country"`
}

Certification contains a readable code as well as UUID along with whether the certification indicates that the movie is safe for children and the country it is applicable for. A movie has multiple certifications, one for each country it is released in.

type Config

type Config struct {
	HostURL     string
	StaticToken string
	Client      *http.Client
}

type Country

type Country struct {
	//Country name as on Qube Wire Cinemas
	Name string `json:"name"`
	//ISO 2-digit Country Code
	Code string `json:"code"`
	//Country UUID as on Qube Wire Cinemas
	UUID string `json:"uuid"`
}

Country has country information as available on Qube Wire Cinemas

type Entity

type Entity struct {
	// Name of the entity.
	Name string `json:"name"`

	// Poster image of the entity.
	Poster string `json:"poster"`

	// Tags of the entity.
	Tags []string `json:"tags"`

	// The primary slug url of the entity.
	URL string `json:"url"`

	// The UUID of the entity.
	UUID string `json:"uuid"`

	// The links to various social media platforms, websites of the entity.
	Links []struct {
		DisplayClass string `json:"displayClass"`
		Name         string `json:"name"`
		URL          string `json:"url"`
	} `json:"links"`

	// Trivia of the entity.
	Trivia []string `json:"trivia"`

	// The main services provided by the entity.
	Services []string `json:"services"`

	// The profile of the entity as a company.
	CompanyProfile string `json:"companyProfile"`

	// The credits for the entity from various movies grouped by the department.
	Credits []struct {
		Department string `json:"department"`
		Roles      []struct {
			Name string `json:"name"`
			URL  string `json:"url"`
			// Release Dates mapped against their corresponding country code like "IN" : "2013-12-20".
			ReleaseDates map[string]string `json:"releaseDates"`

			// Certifications mapped against their corresponding country code like "IN" : "A".
			Certifications map[string]string `json:"certifications"`
			Language       string            `json:"language"`
			Type           string            `json:"type"`
			UUID           string            `json:"uuid"`
			Poster         interface{}       `json:"poster"`
			MoviebuffURL   string            `json:"moviebuffUrl"`
			APIPath        string            `json:"apiPath"`
			Role           string            `json:"role"`
			Department     string            `json:"department"`
			Primary        bool              `json:"primary"`
			Character      interface{}       `json:"character"`
		} `json:"roles"`
	} `json:"credits"`

	// The Alternate slug URLs of the entity.
	AlternateUrls []string `json:"alternateUrls"`

	// value is fixed as entity
	Type string `json:"type"`

	// An list of posters of the entity.
	Posters []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"posters"`

	// An list of videos of the entity.
	Videos []struct {
		Featured  bool   `json:"featured"`
		URL       string `json:"url"`
		EmbedURL  string `json:"embedUrl"`
		Key       string `json:"key"`
		Caption   string `json:"caption"`
		Thumbnail string `json:"thumbnail"`
		Type      string `json:"type"`
	} `json:"videos"`

	// An list of stills of the entity.
	Stills []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"stills"`

	// The path to the entity in the current version of the API.
	APIPath string `json:"apiPath"`

	// The url to the moviebuff page of the entity.
	MoviebuffURL string `json:"moviebuffUrl"`
}

Entity contain basic details of an entity. Entities are usually organizations like production companies, service providers, etc.

type Holiday

type Holiday struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Date string `json:"date"`
}

Holiday - contains id, date and name of the holiday

type Movie

type Movie struct {
	// Name of the movie.
	Name string `json:"name"`

	// Poster url of the movie.
	Poster string `json:"poster"`

	// Alternate URLS of the movie.
	AlternateUrls []string `json:"alternateUrls"`

	// Primary URL of the movie.
	URL string `json:"url"`

	// Type of the resource.
	Type string `json:"type"`

	// UUID of the movie.
	UUID string `json:"uuid"`

	// Release Dates mapped against their corresponding country code like "IN" : "2013-12-20".
	ReleaseDates map[string]string `json:"releaseDates"`

	// Certifications mapped against their corresponding country code like "IN" : "A".
	Certifications map[string]string `json:"certifications"`

	// The primary language of the movie.
	Language string `json:"language"`

	// The language details of the movie.
	LanguageData struct {
		Name string `json:"name"`
		UUID string `json:"uuid"`
	} `json:"languageData"`

	// The type of the movie like Feature Film, Short Film etc.
	FilmType string `json:"filmType"`

	Featured bool `json:"featured"`

	// The synopsis of the movie.
	Synopsis string `json:"synopsis"`

	// The short synopsis of the movie.
	ShortSynopsis string `json:"shortSynopsis"`

	// The storyline of the movie.
	Storyline string `json:"storyline"`

	// An list of genres of the movie.
	Genres []string `json:"genres"`

	// The name of the movie in the local language.
	LocalName string `json:"localName"`

	// The running time of the movie in seconds.
	RunningTime int `json:"runningTime"`

	// Details of the trailer of the movie.
	Trailer struct {
		Featured  bool   `json:"featured"`
		URL       string `json:"url"`
		EmbedURL  string `json:"embedUrl"`
		Key       string `json:"key"`
		Caption   string `json:"caption"`
		Thumbnail string `json:"thumbnail"`
		Type      string `json:"type"`
	} `json:"trailer"`

	// An list containing the alternate titles of the movie.
	AlternateTitles []string `json:"alternateTitles"`

	// An list containing the taglines of the movie.
	TagLines []string `json:"taglines"`

	// An list containing links to movie's twitter, facebook pages etc.
	Links []struct {
		DisplayClass string `json:"displayClass"`
		Name         string `json:"name"`
		URL          string `json:"url"`
	} `json:"links"`

	// An list containing the links to various purchase channels of movie, its songs etc.
	PurchaseLinks []struct {
		DisplayClass string `json:"displayClass"`
		Name         string `json:"name"`
		URL          string `json:"url"`
	} `json:"purchaseLinks"`

	// An list of objects each having a name and data. Here name contains the type of the tech data and data which may
	// be an list of strings or a string.
	TechDetails []struct {
		Name string      `json:"name"`
		Data interface{} `json:"data"`
	} `json:"techDetails"`

	// An list containing the trivia of the movie.
	Trivia []string `json:"trivia"`

	// An object containing the value and the count of the ratings for the movie.
	MovieRating struct {
		Value string `json:"value"`
		Count int    `json:"count"`
	} `json:"movieRating"`

	// An object containing the value and the count of the ratings for the movie's tracks.
	MusicRating struct {
		Value string `json:"value"`
		Count int    `json:"count"`
	} `json:"musicRating"`

	// An list containing the cast of the movie.
	Cast []struct {
		Name         string `json:"name"`
		Poster       string `json:"poster"`
		Type         string `json:"type"`
		URL          string `json:"url"`
		UUID         string `json:"uuid"`
		Role         string `json:"role"`
		Department   string `json:"department"`
		Primary      bool   `json:"primary"`
		Character    string `json:"character"`
		MoviebuffURL string `json:"moviebuffUrl"`
		APIPath      string `json:"apiPath"`
	} `json:"cast"`

	// An list containing the crew of the movie grouped by department.
	Crew []struct {
		Department string `json:"department"`
		Roles      []struct {
			Name         string `json:"name"`
			Poster       string `json:"poster"`
			Type         string `json:"type"`
			URL          string `json:"url"`
			UUID         string `json:"uuid"`
			Role         string `json:"role"`
			Department   string `json:"department"`
			Primary      bool   `json:"primary"`
			Character    string `json:"character"`
			MoviebuffURL string `json:"moviebuffUrl"`
			APIPath      string `json:"apiPath"`
		} `json:"roles"`
	} `json:"crew"`

	// An list containing the music labels for the movies tracks.
	MusicLabels []struct {
		Name         string `json:"name"`
		Poster       string `json:"poster"`
		URL          string `json:"url"`
		UUID         string `json:"uuid"`
		Type         string `json:"type"`
		APIPath      string `json:"apiPath"`
		MoviebuffURL string `json:"moviebuffUrl"`
	} `json:"musicLabels"`

	// An list containing the posters of the movie.
	Posters []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"posters"`

	// An list containing the videos of the movie.
	Videos []struct {
		Featured  bool   `json:"featured"`
		URL       string `json:"url"`
		EmbedURL  string `json:"embedUrl"`
		Key       string `json:"key"`
		Caption   string `json:"caption"`
		Thumbnail string `json:"thumbnail"`
		Type      string `json:"type"`
	} `json:"videos"`

	// An list containing the stills of the movie.
	Stills []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"stills"`

	// An list containing the news articles related to the movie.
	News []struct {
		Poster  string `json:"poster"`
		Summary string `json:"summary"`
		Date    string `json:"date"`
		URL     string `json:"url"`
		Writer  string `json:"writer"`
	} `json:"news"`

	// An list containing the various connections of the movie with other movie.
	// It is an list of objects with each object having a connectionType that
	// specifies how the two movies are related to each other.
	Connections []struct {
		Name string `json:"name"`
		URL  string `json:"url"`
		// Release Dates mapped against their corresponding country code like "IN" : "2013-12-20".
		ReleaseDates map[string]string `json:"releaseDates"`

		// Certifications mapped against their corresponding country code like "IN" : "A".
		Certifications map[string]string `json:"certifications"`

		Language       string `json:"language"`
		Type           string `json:"type"`
		UUID           string `json:"uuid"`
		Poster         string `json:"poster"`
		MoviebuffURL   string `json:"moviebuffUrl"`
		APIPath        string `json:"apiPath"`
		ConnectionType string `json:"connectionType"`
	} `json:"connections"`

	// An object where each release status is mapped against its corresponding country code.
	ReleaseStatuses struct {
		AE string `json:"AE"`
	} `json:"releaseStatuses"`

	ThirdPartyIdentifiers []struct {
		IDs    []string `json:"ids"`
		Source struct {
			UUID string `json:"uuid"`
			Name string `json:"name"`
		} `json:"source"`
	} `json:"thirdPartyIdentifiers"`

	MoviebuffURL string `json:"moviebuffUrl"`
	APIPath      string `json:"apiPath"`
}

Movie contain basic movie details like release dates, certifications, cast, crew, trailers, posters, purchase links etc. Here movies may include feature films, documentaries, short films etc.

func (*Movie) GetEarliestReleaseYear

func (m *Movie) GetEarliestReleaseYear() (releaseYear int)

GetEarliestReleaseYear return the year at which movie was first released anywhere in the world. Returns 0 if release date is not available

func (*Movie) GetThirdPartyIDsBySource

func (m *Movie) GetThirdPartyIDsBySource(sourceID string) []string

GetThirdPartyIDsBySource returns third-party IDs for provided source. Returns nil if source ID is not available

type Moviebuff

type Moviebuff interface {
	GetMovie(ctx context.Context, id string) (*Movie, error)
	GetPerson(ctx context.Context, id string) (*Person, error)
	GetEntity(ctx context.Context, id string) (*Entity, error)
	GetResources(ctx context.Context, resourceType ResourceType, limit, page int) (*Resources, error)
	GetCertifications(ctx context.Context, country string) ([]Certification, error)
	GetHolidayCalendar(ctx context.Context, countryID string) (*Calendar, error)
}

Moviebuff allows to access to information in moviebuff using resource ids.

func New

func New(config Config) Moviebuff

New returns a Moviebuff interface.

type Person

type Person struct {
	// Name of the given person.
	Name string `json:"name"`

	// Profile photo of person
	Poster string `json:"poster"`

	// The URL for the poster of the given person.
	URL string `json:"url"`

	// The alternate URLs of the given person.
	AlternateUrls []string `json:"alternateUrls"`

	// An list of alternate names of the given person.
	AlternateNames []string `json:"alternateNames"`

	// Tags for the given person.
	Tags []string `json:"tags"`

	// value is fixed as person
	Type string `json:"type"`

	// The UUID of the person.
	UUID string `json:"uuid"`

	// The Biography of the given person.
	Biography string `json:"biography"`

	// Other popular name and titles of the given person.
	Akas []string `json:"akas"`

	// Height of the given person.
	Height string `json:"height"`

	// The date of birth of the given person.
	Birthday string `json:"birthday"`

	// The date of death of the given person.
	Deathday string `json:"deathday"`

	// The birth place of the given person.
	Birthplace string `json:"birthplace"`

	// An list containing the links of the given person's social media accounts, websites etc.
	Links []struct {
		DisplayClass string `json:"displayClass"`
		Name         string `json:"name"`
		URL          string `json:"url"`
	} `json:"links"`

	// The trivia of the given person.
	Trivia []string `json:"trivia"`

	// An list of posters of the given person.
	Posters []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"posters"`

	// An list of videos of the given person.
	Videos []struct {
		Featured  bool   `json:"featured"`
		URL       string `json:"url"`
		EmbedURL  string `json:"embedUrl"`
		Key       string `json:"key"`
		Caption   string `json:"caption"`
		Thumbnail string `json:"thumbnail"`
		Type      string `json:"type"`
	} `json:"videos"`

	// An list of stills of the given person.
	Stills []struct {
		Featured bool   `json:"featured"`
		URL      string `json:"url"`
		Key      string `json:"key"`
		Caption  string `json:"caption"`
		Type     string `json:"type"`
	} `json:"stills"`

	// The roles of the person in various movies grouped by department name.
	Credits []struct {
		Department string `json:"department"`
		Roles      []struct {
			Name string `json:"name"`
			URL  string `json:"url"`
			// Release Dates mapped against their corresponding country code like "IN" : "2013-12-20".
			ReleaseDates map[string]string `json:"releaseDates"`

			// Certifications mapped against their corresponding country code like "IN" : "A".
			Certifications map[string]string `json:"certifications"`
			Language       string            `json:"language"`
			Type           string            `json:"type"`
			UUID           string            `json:"uuid"`
			Poster         string            `json:"poster"`
			MoviebuffURL   string            `json:"moviebuffUrl"`
			APIPath        string            `json:"apiPath"`
			Role           string            `json:"role"`
			Department     string            `json:"department"`
			Primary        bool              `json:"primary"`
			Character      string            `json:"character"`
		} `json:"roles"`
	} `json:"credits"`

	// The path to the person in the current version of the api.
	APIPath string `json:"apiPath"`

	// The url pointing to the moviebuff page of the person.
	MoviebuffURL string `json:"moviebuffUrl"`
}

Person contain basic details of a celebrity. The people in the database include actors, directors, support personnel, etc. Moviebuff aims to document most, if not all, of the individuals involved in a film.

type Resource

type Resource struct {
	// Name of the resource
	Name string `json:"name"`

	// slug url of the resource
	URL string `json:"url"`

	// uuid of the resource
	UUID string `json:"uuid"`

	// type of resource. Possible type: movies, people, entities, theatres
	Type string `json:"type"`

	// Poster url of the resource
	Poster string `json:"poster"`

	// The path to the person in the current version of the api.
	APIPath string `json:"apiPath"`

	// The url pointing to the moviebuff page of the person.
	MoviebuffURL string `json:"moviebuffUrl"`
}

Resource contains information about specific type of the resource like movie, people, entity in moviebuff.

type ResourceType

type ResourceType string

Type of resources supported by moviebuff

const (
	RESOURCE_TYPE_PEOPLE   ResourceType = "people"
	RESOURCE_TYPE_MOVIES   ResourceType = "movies"
	RESOURCE_TYPE_ENTITIES ResourceType = "entities"
)

type Resources

type Resources struct {
	Prev string     `json:"prev"`
	Data []Resource `json:"data"`
	Next string     `json:"next"`
}

Resources contain a paginated list of various resources like movies, people, entities in moviebuff. prev - The previous page in the paginated api. If null there are no more pages before this page. data - The array of items requested by the client. Each item in the array will contain the following fields name, url, uuid, type, poster, moviebuffUrl, apiPath. he next page in the paginated api. If null there are no more pages at the end.

Jump to

Keyboard shortcuts

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