mirror of
https://github.com/retailcrm/api-client-go.git
synced 2025-04-02 20:56:17 +03:00
fix for the UpdateScopes method (but this time it actually works)
This commit is contained in:
parent
735103b9bd
commit
3f0c52b109
3 changed files with 6 additions and 5 deletions
|
@ -2156,8 +2156,8 @@ func (c *Client) IntegrationModuleEdit(integrationModule IntegrationModule) (
|
|||
//
|
||||
// var client = retailcrm.New("https://demo.url", "09jIJ")
|
||||
//
|
||||
// data, status, err := client.UpdateScopes("moysklad3", retailcrm.UpdateScopesRequest{
|
||||
// Requires: retailcrm.ScopesRequired{Scopes: []string{"scope1", "scope2"}}},
|
||||
// data, status, err := client.UpdateScopes("moysklad3", retailcrm.ScopesRequired{
|
||||
// Scopes: []string{"scope1", "scope2"},
|
||||
// })
|
||||
//
|
||||
// if err.Error() != "" {
|
||||
|
@ -2179,8 +2179,7 @@ func (c *Client) UpdateScopes(code string, request ScopesRequired) (UpdateScopes
|
|||
"requires": {string(updateJSON)},
|
||||
}
|
||||
|
||||
data, status, err := c.PostRequest(
|
||||
fmt.Sprintf("/integration-modules/%s/update-scopes", code), p)
|
||||
data, status, err := c.PostRequest(fmt.Sprintf("/integration-modules/%s/update-scopes", code), p)
|
||||
if err != nil {
|
||||
return resp, status, err
|
||||
}
|
||||
|
|
|
@ -6573,6 +6573,7 @@ func TestClient_UpdateScopes(t *testing.T) {
|
|||
defer gock.Off()
|
||||
|
||||
request := ScopesRequired{Scopes: []string{"scope1", "scope2"}}
|
||||
|
||||
jr, _ := json.Marshal(&request)
|
||||
|
||||
gock.New(crmURL).
|
||||
|
@ -6605,6 +6606,7 @@ func TestClient_UpdateScopes_Fail(t *testing.T) {
|
|||
defer gock.Off()
|
||||
|
||||
request := ScopesRequired{Scopes: []string{"scope1", "scope2"}}
|
||||
|
||||
jr, _ := json.Marshal(&request)
|
||||
|
||||
gock.New(crmURL).
|
||||
|
|
2
types.go
2
types.go
|
@ -977,7 +977,7 @@ type IntegrationModule struct {
|
|||
}
|
||||
|
||||
type ScopesRequired struct {
|
||||
Scopes []string
|
||||
Scopes []string `json:"scopes"`
|
||||
}
|
||||
|
||||
// Integrations type.
|
||||
|
|
Loading…
Add table
Reference in a new issue