-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathreviews.go
42 lines (39 loc) · 1.09 KB
/
reviews.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package tmdb
import "fmt"
// ReviewDetails type is a struct for details JSON response.
type ReviewDetails struct {
ID string `json:"id"`
Author string `json:"author"`
AuthorDetails struct {
AvatarPath string `json:"avatar_path"`
Name string `json:"name"`
Rating float32 `json:"rating"`
Username string `json:"username"`
} `json:"author_details"`
Content string `json:"content"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Iso639_1 string `json:"iso_639_1"`
MediaID int64 `json:"media_id"`
MediaTitle string `json:"media_title"`
MediaType string `json:"media_type"`
URL string `json:"url"`
}
// GetReviewDetails get review details by id.
//
// https://developers.themoviedb.org/3/reviews/get-review-details
func (c *Client) GetReviewDetails(
id string,
) (*ReviewDetails, error) {
tmdbURL := fmt.Sprintf(
"%s/review/%s?api_key=%s",
baseURL,
id,
c.apiKey,
)
reviewDetails := ReviewDetails{}
if err := c.get(tmdbURL, &reviewDetails); err != nil {
return nil, err
}
return &reviewDetails, nil
}