Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-12-07 11:30:32 +00:00
parent 1fd95a1ba2
commit 2df19f48f9
19 changed files with 784 additions and 659 deletions

62
movie/movie.go Executable file
View File

@@ -0,0 +1,62 @@
package movie
import (
"go.m3o.com/client"
)
func NewMovieService(token string) *MovieService {
return &MovieService{
client: client.NewClient(&client.Options{
Token: token,
}),
}
}
type MovieService struct {
client *client.Client
}
//
func (t *MovieService) Search(request *SearchRequest) (*SearchResponse, error) {
rsp := &SearchResponse{}
return rsp, t.client.Call("movie", "Search", request, rsp)
}
type MovieInfo struct {
Adult bool `json:"adult"`
BackdropPath string `json:"backdrop_path"`
GenreIds int32 `json:"genre_ids"`
Id int32 `json:"id"`
OriginalLanguage string `json:"original_language"`
OriginalTitle string `json:"original_title"`
Overview string `json:"overview"`
Popularity float64 `json:"popularity"`
PosterPath string `json:"poster_path"`
ReleaseDate string `json:"release_date"`
Title string `json:"title"`
Video bool `json:"video"`
VoteAverage float64 `json:"vote_average"`
VoteCount int32 `json:"vote_count"`
}
type SearchRequest struct {
// a ISO 639-1 value to display translated data
Language string `json:"language"`
// page to query
Page int32 `json:"page"`
PrimaryReleaseYear int32 `json:"primary_release_year"`
// a text query to search
Query string `json:"query"`
// a ISO 3166-1 code to filter release dates.
Region string `json:"region"`
Year int32 `json:"year"`
}
type SearchResponse struct {
Page int32 `json:"page"`
Results []MovieInfo `json:"results"`
TotalPages int32 `json:"total_pages"`
TotalResults int32 `json:"total_results"`
}