diff --git a/mal/user.go b/mal/user.go index e0d7f50..3de2c79 100644 --- a/mal/user.go +++ b/mal/user.go @@ -21,11 +21,14 @@ type UserService struct { type User struct { ID int64 `json:"id"` Name string `json:"name"` + Picture string `json:"picture"` Gender string `json:"gender"` + Birthday string `json:"birthday"` Location string `json:"location"` - Picture string `json:"picture"` JoinedAt time.Time `json:"joined_at"` AnimeStatistics AnimeStatistics `json:"anime_statistics"` + TimeZone string `json:"time_zone"` + IsSupporter bool `json:"is_supporter"` } // AnimeStatistics about the user. @@ -58,6 +61,11 @@ func (s *UserService) MyInfo(ctx context.Context, options ...MyInfoOption) (*Use if err != nil { return nil, nil, err } + q := req.URL.Query() + for _, o := range options { + o.myInfoApply(&q) + } + req.URL.RawQuery = q.Encode() u := new(User) resp, err := s.client.Do(ctx, req, u) diff --git a/mal/user_test.go b/mal/user_test.go index a18ebfc..e242e15 100644 --- a/mal/user_test.go +++ b/mal/user_test.go @@ -14,11 +14,16 @@ func TestUserServiceMyInfo(t *testing.T) { mux.HandleFunc("/users/@me", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) + testURLValues(t, r, urlValues{ + "fields": "time_zone,is_supporter", + }) fmt.Fprint(w, `{"id":1}`) }) ctx := context.Background() - u, _, err := client.User.MyInfo(ctx) + u, _, err := client.User.MyInfo(ctx, + Fields{"time_zone", "is_supporter"}, + ) if err != nil { t.Errorf("User.MyInfo returned error: %v", err) }