Skip to content

Commit

Permalink
Merge pull request #51 from fancybits/more-expanded-image-types
Browse files Browse the repository at this point in the history
Expand all Image Types
  • Loading branch information
cyruzin committed Dec 20, 2023
2 parents 040b666 + d25c580 commit 6388ea1
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 73 deletions.
33 changes: 14 additions & 19 deletions collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,22 @@ func (c *Client) GetCollectionDetails(
return &collectionDetails, nil
}

// CollectionImage type is a struct for a single image.
type CollectionImage struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso639_1 string `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
}

// CollectionImages type is a struct for images JSON response.
type CollectionImages struct {
ID int64 `json:"id"`
Backdrops []struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso639_1 string `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"backdrops"`
Posters []struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso639_1 string `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"posters"`
ID int64 `json:"id"`
Backdrops []CollectionImage `json:"backdrops"`
Posters []CollectionImage `json:"posters"`
}

// GetCollectionImages get the images for a collection by id.
Expand Down
25 changes: 14 additions & 11 deletions companies.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,22 @@ func (c *Client) GetCompanyAlternativeNames(
return &companyAlternativeNames, nil
}

// CompanyImage type is a struct for a single image.
type CompanyImage struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
ID string `json:"id"`
FileType string `json:"file_type"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
}

// CompanyImages type is a struct for images JSON response.
type CompanyImages struct {
ID int64 `json:"id"`
Logos []struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
ID string `json:"id"`
FileType string `json:"file_type"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"logos"`
ID int64 `json:"id"`
Logos []CompanyImage `json:"logos"`
}

// GetCompanyImages get a companies logos by id.
Expand Down
27 changes: 14 additions & 13 deletions networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,22 @@ func (c *Client) GetNetworkAlternativeNames(
return &networkAltenativeNames, nil
}

// NetworkImage type is a struct for a single image.
type NetworkImage struct {
AspectRatio float64 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
ID string `json:"id"`
FileType string `json:"file_type"`
VoteAverage float64 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
}

// NetworkImages type is a struct for images JSON response.
type NetworkImages struct {
ID int64 `json:"id"`
Logos []struct {
AspectRatio float64 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
ID string `json:"id"`
FileType string `json:"file_type"`
VoteAverage float64 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"logos"`
ID int64 `json:"id"`
Logos []NetworkImage `json:"logos"`
}

// GetNetworkImages get the TV network logos by id.
Expand All @@ -86,8 +89,6 @@ type NetworkImages struct {
// An SVG can be scaled properly beyond those dimensions if you
// call them as a PNG.
//
//
//
// https://developers.themoviedb.org/3/networks/get-network-images
func (c *Client) GetNetworkImages(
id int,
Expand Down
23 changes: 13 additions & 10 deletions people.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,18 +388,21 @@ func (c *Client) GetPersonExternalIDs(
return &personExternalIDS, nil
}

// PersonImage type is a struct for a single image.
type PersonImage struct {
Iso639_1 string `json:"iso_639_1"`
Width int `json:"width"`
Height int `json:"height"`
VoteCount int64 `json:"vote_count"`
VoteAverage float32 `json:"vote_average"`
FilePath string `json:"file_path"`
AspectRatio float32 `json:"aspect_ratio"`
}

// PersonImages type is a struct for images JSON response.
type PersonImages struct {
Profiles []struct {
Iso639_1 string `json:"iso_639_1"`
Width int `json:"width"`
Height int `json:"height"`
VoteCount int64 `json:"vote_count"`
VoteAverage float32 `json:"vote_average"`
FilePath string `json:"file_path"`
AspectRatio float32 `json:"aspect_ratio"`
} `json:"profiles"`
ID int `json:"id,omitempty"`
Profiles []PersonImage `json:"profiles"`
ID int `json:"id,omitempty"`
}

// GetPersonImages get the images for a person.
Expand Down
23 changes: 13 additions & 10 deletions tv_episodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,21 @@ func (c *Client) GetTVEpisodeExternalIDs(
return &tvEpisodeExternalIDs, nil
}

// TVEpisodeImage type is a struct for a single image.
type TVEpisodeImage struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso6391 interface{} `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
}

// TVEpisodeImages type is a struct for images JSON response.
type TVEpisodeImages struct {
ID int64 `json:"id,omitempty"`
Stills []struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso6391 interface{} `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"stills"`
ID int64 `json:"id,omitempty"`
Stills []TVEpisodeImage `json:"stills"`
}

// GetTVEpisodeImages get the images that belong to a TV episode.
Expand Down
23 changes: 13 additions & 10 deletions tv_seasons.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,18 +236,21 @@ func (c *Client) GetTVSeasonExternalIDs(
return &tvSeasonExternalIDs, nil
}

// TVSeasonImage type is a struct for a single image.
type TVSeasonImage struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso639_1 string `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
}

// TVSeasonImages type is a struct for images JSON response.
type TVSeasonImages struct {
ID int64 `json:"id,omitempty"`
Posters []struct {
AspectRatio float32 `json:"aspect_ratio"`
FilePath string `json:"file_path"`
Height int `json:"height"`
Iso639_1 string `json:"iso_639_1"`
VoteAverage float32 `json:"vote_average"`
VoteCount int64 `json:"vote_count"`
Width int `json:"width"`
} `json:"posters"`
ID int64 `json:"id,omitempty"`
Posters []TVSeasonImage `json:"posters"`
}

// GetTVSeasonImages get the images that belong to a TV season.
Expand Down

0 comments on commit 6388ea1

Please sign in to comment.