Add ListResolvableAliases SDK changes (#4653)
* Add API changs for list resolvable aliases
This commit is contained in:
32 files changed
+614
-411
No files matched your search
+18
-20
@@ -33,13 +33,11 @@ type User struct {
|
||||
FullName string `json:"full_name,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
PrimaryAccountId string `json:"primary_account_id,omitempty"`
|
||||
|
||||
response *api.Response
|
||||
}
|
||||
|
||||
type UserReadResult struct {
|
||||
Item *User
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
func (n UserReadResult) GetItem() *User {
|
||||
@@ -47,14 +45,14 @@ func (n UserReadResult) GetItem() *User {
|
||||
}
|
||||
|
||||
func (n UserReadResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
type UserCreateResult = UserReadResult
|
||||
type UserUpdateResult = UserReadResult
|
||||
|
||||
type UserDeleteResult struct {
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
// GetItem will always be nil for UserDeleteResult
|
||||
@@ -63,7 +61,7 @@ func (n UserDeleteResult) GetItem() interface{} {
|
||||
}
|
||||
|
||||
func (n UserDeleteResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
type UserListResult struct {
|
||||
@@ -72,7 +70,7 @@ type UserListResult struct {
|
||||
RemovedIds []string `json:"removed_ids,omitempty"`
|
||||
ListToken string `json:"list_token,omitempty"`
|
||||
ResponseType string `json:"response_type,omitempty"`
|
||||
response *api.Response
|
||||
Response *api.Response
|
||||
}
|
||||
|
||||
func (n UserListResult) GetItems() []*User {
|
||||
@@ -96,7 +94,7 @@ func (n UserListResult) GetResponseType() string {
|
||||
}
|
||||
|
||||
func (n UserListResult) GetResponse() *api.Response {
|
||||
return n.response
|
||||
return n.Response
|
||||
}
|
||||
|
||||
// Client is a client for this collection
|
||||
@@ -157,7 +155,7 @@ func (c *Client) Create(ctx context.Context, scopeId string, opt ...Option) (*Us
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -198,7 +196,7 @@ func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*UserReadR
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -261,7 +259,7 @@ func (c *Client) Update(ctx context.Context, id string, version uint32, opt ...O
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -302,7 +300,7 @@ func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*UserDel
|
||||
}
|
||||
|
||||
target := &UserDeleteResult{
|
||||
response: resp,
|
||||
Response: resp,
|
||||
}
|
||||
return target, nil
|
||||
}
|
||||
@@ -344,7 +342,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*User
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
if target.ResponseType == "complete" || target.ResponseType == "" {
|
||||
return target, nil
|
||||
}
|
||||
@@ -402,7 +400,7 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*User
|
||||
target.EstItemCount = page.EstItemCount
|
||||
target.ListToken = page.ListToken
|
||||
target.ResponseType = page.ResponseType
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
if target.ResponseType == "complete" {
|
||||
break
|
||||
}
|
||||
@@ -437,11 +435,11 @@ func (c *Client) List(ctx context.Context, scopeId string, opt ...Option) (*User
|
||||
// Finally, since we made at least 2 requests to the server to fulfill this
|
||||
// function call, resp.Body and resp.Map will only contain the most recent response.
|
||||
// Overwrite them with the true response.
|
||||
target.response.Body.Reset()
|
||||
if err := json.NewEncoder(target.response.Body).Encode(target); err != nil {
|
||||
target.Response.Body.Reset()
|
||||
if err := json.NewEncoder(target.Response.Body).Encode(target); err != nil {
|
||||
return nil, fmt.Errorf("error encoding final JSON list response: %w", err)
|
||||
}
|
||||
if err := json.Unmarshal(target.response.Body.Bytes(), &target.response.Map); err != nil {
|
||||
if err := json.Unmarshal(target.Response.Body.Bytes(), &target.Response.Map); err != nil {
|
||||
return nil, fmt.Errorf("error encoding final map list response: %w", err)
|
||||
}
|
||||
// Note: the HTTP response body is consumed by resp.Decode in the loop,
|
||||
@@ -515,7 +513,7 @@ func (c *Client) AddAccounts(ctx context.Context, id string, version uint32, acc
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -581,7 +579,7 @@ func (c *Client) SetAccounts(ctx context.Context, id string, version uint32, acc
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
|
||||
@@ -651,6 +649,6 @@ func (c *Client) RemoveAccounts(ctx context.Context, id string, version uint32,
|
||||
if apiErr != nil {
|
||||
return nil, apiErr
|
||||
}
|
||||
target.response = resp
|
||||
target.Response = resp
|
||||
return target, nil
|
||||
}
|
||||
Reference in new issue
Block a user