Skip to content

Commit

Permalink
Merge pull request #100 from gwatts/add-namespace-handling-rebase1
Browse files Browse the repository at this point in the history
Add AsAdminID
  • Loading branch information
rajatgoel authored Oct 5, 2021
2 parents 9dc7335 + ec2145c commit d3def53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions generator/go_rsrc/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ type Config struct {
Logger *log.Logger
// Used with APIs that support operations as another user
AsMemberID string
// Used with APIs that support operations as an admin
AsAdminID string
// Path relative to which action should be taken
PathRoot string
// No need to set -- for testing only
Expand Down Expand Up @@ -190,6 +192,9 @@ func (c *Context) Execute(req Request, body io.Reader) ([]byte, io.ReadCloser, e
if req.Auth != "team" && c.Config.AsMemberID != "" {
httpReq.Header.Add("Dropbox-API-Select-User", c.Config.AsMemberID)
}
if req.Auth != "team" && c.Config.AsAdminID != "" {
httpReq.Header.Add("Dropbox-API-Select-Admin", c.Config.AsAdminID)
}
if c.Config.PathRoot != "" {
httpReq.Header.Add("Dropbox-API-Path-Root", c.Config.PathRoot)
}
Expand Down
5 changes: 5 additions & 0 deletions v6/dropbox/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ type Config struct {
Logger *log.Logger
// Used with APIs that support operations as another user
AsMemberID string
// Used with APIs that support operations as an admin
AsAdminID string
// Path relative to which action should be taken
PathRoot string
// No need to set -- for testing only
Expand Down Expand Up @@ -190,6 +192,9 @@ func (c *Context) Execute(req Request, body io.Reader) ([]byte, io.ReadCloser, e
if req.Auth != "team" && c.Config.AsMemberID != "" {
httpReq.Header.Add("Dropbox-API-Select-User", c.Config.AsMemberID)
}
if req.Auth != "team" && c.Config.AsAdminID != "" {
httpReq.Header.Add("Dropbox-API-Select-Admin", c.Config.AsAdminID)
}
if c.Config.PathRoot != "" {
httpReq.Header.Add("Dropbox-API-Path-Root", c.Config.PathRoot)
}
Expand Down

0 comments on commit d3def53

Please sign in to comment.