Skip to content

Commit

Permalink
Add context to all necessary methods (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
bretterer authored Apr 28, 2020
1 parent 2b15ccf commit 758fdac
Show file tree
Hide file tree
Showing 37 changed files with 859 additions and 824 deletions.
9 changes: 5 additions & 4 deletions okta/appUser.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package okta

import (
"context"
"fmt"
"github.com/okta/okta-sdk-golang/v2/okta/query"
"time"
Expand Down Expand Up @@ -52,7 +53,7 @@ func (a *AppUser) IsApplicationInstance() bool {
}

// Updates a user's profile for an application
func (m *AppUserResource) UpdateApplicationUser(appId string, userId string, body AppUser) (*AppUser, *Response, error) {
func (m *AppUserResource) UpdateApplicationUser(ctx context.Context, appId string, userId string, body AppUser) (*AppUser, *Response, error) {
url := fmt.Sprintf("/api/v1/apps/%v/users/%v", appId, userId)

req, err := m.client.requestExecutor.WithAccept("application/json").WithContentType("application/json").NewRequest("POST", url, body)
Expand All @@ -62,7 +63,7 @@ func (m *AppUserResource) UpdateApplicationUser(appId string, userId string, bod

var appUser *AppUser

resp, err := m.client.requestExecutor.Do(req, &appUser)
resp, err := m.client.requestExecutor.Do(ctx, req, &appUser)
if err != nil {
return nil, resp, err
}
Expand All @@ -71,7 +72,7 @@ func (m *AppUserResource) UpdateApplicationUser(appId string, userId string, bod
}

// Removes an assignment for a user from an application.
func (m *AppUserResource) DeleteApplicationUser(appId string, userId string, qp *query.Params) (*Response, error) {
func (m *AppUserResource) DeleteApplicationUser(ctx context.Context, appId string, userId string, qp *query.Params) (*Response, error) {
url := fmt.Sprintf("/api/v1/apps/%v/users/%v", appId, userId)
if qp != nil {
url = url + qp.String()
Expand All @@ -82,7 +83,7 @@ func (m *AppUserResource) DeleteApplicationUser(appId string, userId string, qp
return nil, err
}

resp, err := m.client.requestExecutor.Do(req, nil)
resp, err := m.client.requestExecutor.Do(ctx, req, nil)
if err != nil {
return resp, err
}
Expand Down
149 changes: 75 additions & 74 deletions okta/application.go

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions okta/applicationGroupAssignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package okta

import (
"context"
"fmt"
"time"
)
Expand All @@ -43,15 +44,15 @@ func (a *ApplicationGroupAssignment) IsApplicationInstance() bool {
}

// Removes a group assignment from an application.
func (m *ApplicationGroupAssignmentResource) DeleteApplicationGroupAssignment(appId string, groupId string) (*Response, error) {
func (m *ApplicationGroupAssignmentResource) DeleteApplicationGroupAssignment(ctx context.Context, appId string, groupId string) (*Response, error) {
url := fmt.Sprintf("/api/v1/apps/%v/groups/%v", appId, groupId)

req, err := m.client.requestExecutor.WithAccept("application/json").WithContentType("application/json").NewRequest("DELETE", url, nil)
if err != nil {
return nil, err
}

resp, err := m.client.requestExecutor.Do(req, nil)
resp, err := m.client.requestExecutor.Do(ctx, req, nil)
if err != nil {
return resp, err
}
Expand Down
Loading

0 comments on commit 758fdac

Please sign in to comment.