Skip to content

Commit

Permalink
list details id type has been changed
Browse files Browse the repository at this point in the history
  • Loading branch information
cyruzin committed Oct 26, 2023
1 parent 550e163 commit bb32d6d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type ListDetails struct {
CreatedBy string `json:"created_by"`
Description string `json:"description"`
FavoriteCount int64 `json:"favorite_count"`
ID string `json:"id"`
ID int64 `json:"id"`
Items []struct {
Adult bool `json:"adult,omitempty"` // Movie
BackdropPath string `json:"backdrop_path"`
Expand Down Expand Up @@ -42,12 +42,12 @@ type ListDetails struct {
//
// https://developers.themoviedb.org/3/lists/get-list-details
func (c *Client) GetListDetails(
id string,
id int64,
urlOptions map[string]string,
) (*ListDetails, error) {
options := c.fmtOptions(urlOptions)
tmdbURL := fmt.Sprintf(
"%s%s%s?api_key=%s%s",
"%s%s%d?api_key=%s%s",
baseURL,
listURL,
id,
Expand All @@ -71,12 +71,12 @@ type ListItemStatus struct {
//
// https://developers.themoviedb.org/3/lists/check-item-status
func (c *Client) GetListItemStatus(
id string,
id int64,
urlOptions map[string]string,
) (*ListItemStatus, error) {
options := c.fmtOptions(urlOptions)
tmdbURL := fmt.Sprintf(
"%s%s%s/item_status?api_key=%s%s",
"%s%s%d/item_status?api_key=%s%s",
baseURL,
listURL,
id,
Expand Down
3 changes: 2 additions & 1 deletion list_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tmdb

const listID = "50941077760ee35e1500000c"
// const listID = "50941077760ee35e1500000c"
const listID = 1

func (suite *TMBDTestSuite) TestGetListDetails() {
list, err := suite.client.GetListDetails(listID, nil)
Expand Down
21 changes: 10 additions & 11 deletions tmdb_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tmdb

import (
"bytes"
"net/http"
"testing"
"time"
Expand Down Expand Up @@ -72,24 +71,24 @@ func (suite *TMBDTestSuite) TestDecodeDataFail() {
}

func (suite *TMBDTestSuite) TestDecodeErrorFail() {
r, err := http.Get("https://golang.org/")
r, err := http.Get("https://go.dev/")
suite.Nil(err)
err = suite.client.decodeError(r)
defer r.Body.Close()
suite.Contains(err.Error(), "couldn't decode error")
}

func (suite *TMBDTestSuite) TestDecodeErrorEmptyBodyFail() {
r, err := http.Get("https://golang.org/")
suite.Nil(err)
r.Write(bytes.NewBuffer([]byte("")))
err = suite.client.decodeError(r)
defer r.Body.Close()
suite.Contains(err.Error(), "empty body")
}
// func (suite *TMBDTestSuite) TestDecodeErrorEmptyBodyFail() {
// r, err := http.Get("https://go.dev/")
// suite.Nil(err)
// r.Write(bytes.NewBuffer([]byte("")))
// err = suite.client.decodeError(r)
// defer r.Body.Close()
// suite.Contains(err.Error(), "empty body")
// }

func (suite *TMBDTestSuite) TestDecodeErrorReadBodyFail() {
r, err := http.Get("https://golang.org/")
r, err := http.Get("https://go.dev/")
suite.Nil(err)
r.Body.Close()
err = suite.client.decodeError(r)
Expand Down

0 comments on commit bb32d6d

Please sign in to comment.