mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Commit from m3o/m3o action
This commit is contained in:
62
movie/movie.go
Executable file
62
movie/movie.go
Executable 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"`
|
||||
}
|
||||
Reference in New Issue
Block a user