From 082604931c78e30bc8b3acca22c4fd65eff2efc5 Mon Sep 17 00:00:00 2001 From: Vragov Roman Date: Thu, 11 Aug 2022 16:08:54 +0300 Subject: [PATCH] Add UsersResponseItem field IsSupportAccount --- v1/client_test.go | 12 ++++++++++-- v1/types.go | 23 ++++++++++++----------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/v1/client_test.go b/v1/client_test.go index d5340a2..2f68ac8 100644 --- a/v1/client_test.go +++ b/v1/client_test.go @@ -214,7 +214,7 @@ func TestMgClient_Users(t *testing.T) { gock.New(mgURL). Get("/api/bot/v1/users"). Reply(200). - BodyString(`[{"id": 1, "external_id":"1", "username": "Test", "first_name":"Test", "last_name":"Test", "created_at": "2018-01-01T00:00:00.000000Z", "is_active": true, "is_online": true}]`) + BodyString(`[{"id": 1, "external_id":"1", "username": "Test", "first_name":"Test", "last_name":"Test", "created_at": "2018-01-01T00:00:00.000000Z", "is_active": true, "is_online": true, "is_support_account": true}]`) req := UsersRequest{Active: 1} @@ -227,7 +227,15 @@ func TestMgClient_Users(t *testing.T) { assert.NotEmpty(t, data) for _, user := range data { - assert.NotEmpty(t, user.FirstName) + assert.Equal(t, uint64(1), user.ID) + assert.Equal(t, "1", user.ExternalID) + assert.Equal(t, "Test", user.Username) + assert.Equal(t, "Test", user.FirstName) + assert.Equal(t, "Test", user.LastName) + assert.Equal(t, "2018-01-01T00:00:00.000000Z", user.CreatedAt) + assert.Equal(t, true, user.IsActive) + assert.Equal(t, true, user.IsOnline) + assert.Equal(t, true, user.IsSupportAccount) } } diff --git a/v1/types.go b/v1/types.go index e6daa79..4d066f5 100644 --- a/v1/types.go +++ b/v1/types.go @@ -256,17 +256,18 @@ type ( } UsersResponseItem struct { - ID uint64 `json:"id"` - ExternalID string `json:"external_id,omitempty"` - Username string `json:"username,omitempty"` - FirstName string `json:"first_name,omitempty"` - LastName string `json:"last_name,omitempty"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at,omitempty"` - RevokedAt string `json:"revoked_at,omitempty"` - IsOnline bool `json:"is_online"` - IsActive bool `json:"is_active"` - Avatar string `json:"avatar_url,omitempty"` + ID uint64 `json:"id"` + ExternalID string `json:"external_id,omitempty"` + Username string `json:"username,omitempty"` + FirstName string `json:"first_name,omitempty"` + LastName string `json:"last_name,omitempty"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at,omitempty"` + RevokedAt string `json:"revoked_at,omitempty"` + IsOnline bool `json:"is_online"` + IsActive bool `json:"is_active"` + IsSupportAccount bool `json:"is_support_account"` + Avatar string `json:"avatar_url,omitempty"` } CustomersResponseItem struct {