Skip to content

Commit 704f35d

Browse files
authored
Add person translations name and primary (#72)
1 parent 9ca65b6 commit 704f35d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

people.go

+2
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ type PersonTranslations struct {
488488
Name string `json:"name"`
489489
Data struct {
490490
Biography string `json:"biography"`
491+
Name string `json:"name"`
492+
Primary bool `json:"primary"`
491493
} `json:"data"`
492494
EnglishName string `json:"english_name"`
493495
} `json:"translations"`

people_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ func (suite *TMBDTestSuite) TestGetPersonDetailsWithOptions() {
2424
suite.Equal("Jason Momoa", jasonMomoa.Name)
2525
}
2626

27+
func (suite *TMBDTestSuite) TestGetPersonDetailsWithAppend() {
28+
options := make(map[string]string)
29+
options["append_to_response"] = "translations"
30+
jasonMomoa, err := suite.client.GetPersonDetails(jasonMomoaID, options)
31+
suite.Nil(err)
32+
suite.NotNil(jasonMomoa.PersonTranslationsAppend)
33+
suite.NotNil(jasonMomoa.Translations)
34+
suite.NotEmpty(jasonMomoa.Translations.Translations)
35+
suite.Equal("Jason Momoa", jasonMomoa.Translations.Translations[0].Data.Name)
36+
}
37+
2738
func (suite *TMBDTestSuite) TestGetPersonChanges() {
2839
jasonMomoa, err := suite.client.GetPersonChanges(jasonMomoaID, nil)
2940
suite.Nil(err)
@@ -174,6 +185,8 @@ func (suite *TMBDTestSuite) TestGetPersonTranslationsWithOptions() {
174185
tomCruise, err := suite.client.GetPersonTranslations(tomCruiseID, options)
175186
suite.Nil(err)
176187
suite.NotNil(tomCruise.ID)
188+
suite.NotEmpty(tomCruise.Translations)
189+
suite.NotEmpty(tomCruise.Translations[0].Data.Name)
177190
}
178191

179192
func (suite *TMBDTestSuite) TestGetPersonLatest() {

0 commit comments

Comments
 (0)