Fix for the UpdateScopes method

This commit is contained in:
Pavel 2022-04-13 17:32:26 +03:00 committed by GitHub
parent 735103b9bd
commit cd567755e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -2156,8 +2156,8 @@ func (c *Client) IntegrationModuleEdit(integrationModule IntegrationModule) (
// //
// var client = retailcrm.New("https://demo.url", "09jIJ") // var client = retailcrm.New("https://demo.url", "09jIJ")
// //
// data, status, err := client.UpdateScopes("moysklad3", retailcrm.UpdateScopesRequest{ // data, status, err := client.UpdateScopes("moysklad3", retailcrm.ScopesRequired{
// Requires: retailcrm.ScopesRequired{Scopes: []string{"scope1", "scope2"}}}, // Scopes: []string{"scope1", "scope2"},
// }) // })
// //
// if err.Error() != "" { // if err.Error() != "" {
@ -2179,8 +2179,7 @@ func (c *Client) UpdateScopes(code string, request ScopesRequired) (UpdateScopes
"requires": {string(updateJSON)}, "requires": {string(updateJSON)},
} }
data, status, err := c.PostRequest( data, status, err := c.PostRequest(fmt.Sprintf("/integration-modules/%s/update-scopes", code), p)
fmt.Sprintf("/integration-modules/%s/update-scopes", code), p)
if err != nil { if err != nil {
return resp, status, err return resp, status, err
} }

View File

@ -6573,6 +6573,7 @@ func TestClient_UpdateScopes(t *testing.T) {
defer gock.Off() defer gock.Off()
request := ScopesRequired{Scopes: []string{"scope1", "scope2"}} request := ScopesRequired{Scopes: []string{"scope1", "scope2"}}
jr, _ := json.Marshal(&request) jr, _ := json.Marshal(&request)
gock.New(crmURL). gock.New(crmURL).
@ -6605,6 +6606,7 @@ func TestClient_UpdateScopes_Fail(t *testing.T) {
defer gock.Off() defer gock.Off()
request := ScopesRequired{Scopes: []string{"scope1", "scope2"}} request := ScopesRequired{Scopes: []string{"scope1", "scope2"}}
jr, _ := json.Marshal(&request) jr, _ := json.Marshal(&request)
gock.New(crmURL). gock.New(crmURL).

View File

@ -977,7 +977,7 @@ type IntegrationModule struct {
} }
type ScopesRequired struct { type ScopesRequired struct {
Scopes []string Scopes []string `json:"scopes"`
} }
// Integrations type. // Integrations type.