Rename trophies methods
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
parent
33a14122bf
commit
b70253ec48
2 changed files with 11 additions and 11 deletions
14
user.go
14
user.go
|
@ -40,8 +40,8 @@ type UserService interface {
|
||||||
Unblock(ctx context.Context, username string) (*Response, error)
|
Unblock(ctx context.Context, username string) (*Response, error)
|
||||||
// UnblockByID(ctx context.Context, id string) (*Response, error)
|
// UnblockByID(ctx context.Context, id string) (*Response, error)
|
||||||
|
|
||||||
GetTrophies(ctx context.Context) (Trophies, *Response, error)
|
Trophies(ctx context.Context) (Trophies, *Response, error)
|
||||||
GetTrophiesOf(ctx context.Context, username string) (Trophies, *Response, error)
|
TrophiesOf(ctx context.Context, username string) (Trophies, *Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserServiceOp implements the UserService interface
|
// UserServiceOp implements the UserService interface
|
||||||
|
@ -545,13 +545,13 @@ func (s *UserServiceOp) Unblock(ctx context.Context, username string) (*Response
|
||||||
// return s.client.Do(ctx, req, nil)
|
// return s.client.Do(ctx, req, nil)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// GetTrophies returns a list of your trophies.
|
// Trophies returns a list of your trophies.
|
||||||
func (s *UserServiceOp) GetTrophies(ctx context.Context) (Trophies, *Response, error) {
|
func (s *UserServiceOp) Trophies(ctx context.Context) (Trophies, *Response, error) {
|
||||||
return s.GetTrophiesOf(ctx, s.client.Username)
|
return s.TrophiesOf(ctx, s.client.Username)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTrophiesOf returns a list of the specified user's trophies.
|
// TrophiesOf returns a list of the specified user's trophies.
|
||||||
func (s *UserServiceOp) GetTrophiesOf(ctx context.Context, username string) (Trophies, *Response, error) {
|
func (s *UserServiceOp) TrophiesOf(ctx context.Context, username string) (Trophies, *Response, error) {
|
||||||
path := fmt.Sprintf("api/v1/user/%s/trophies", username)
|
path := fmt.Sprintf("api/v1/user/%s/trophies", username)
|
||||||
|
|
||||||
req, err := s.client.NewRequest(http.MethodGet, path, nil)
|
req, err := s.client.NewRequest(http.MethodGet, path, nil)
|
||||||
|
|
|
@ -734,7 +734,7 @@ func TestUserService_Unblock(t *testing.T) {
|
||||||
// assert.NoError(t, err)
|
// assert.NoError(t, err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func TestUserService_GetTrophies(t *testing.T) {
|
func TestUserService_Trophies(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
|
@ -745,12 +745,12 @@ func TestUserService_GetTrophies(t *testing.T) {
|
||||||
fmt.Fprint(w, blob)
|
fmt.Fprint(w, blob)
|
||||||
})
|
})
|
||||||
|
|
||||||
trophies, _, err := client.User.GetTrophies(ctx)
|
trophies, _, err := client.User.Trophies(ctx)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedTrophies, trophies)
|
assert.Equal(t, expectedTrophies, trophies)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserService_GetTrophiesOf(t *testing.T) {
|
func TestUserService_TrophiesOf(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
|
@ -761,7 +761,7 @@ func TestUserService_GetTrophiesOf(t *testing.T) {
|
||||||
fmt.Fprint(w, blob)
|
fmt.Fprint(w, blob)
|
||||||
})
|
})
|
||||||
|
|
||||||
trophies, _, err := client.User.GetTrophiesOf(ctx, "test123")
|
trophies, _, err := client.User.TrophiesOf(ctx, "test123")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedTrophies, trophies)
|
assert.Equal(t, expectedTrophies, trophies)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue