api: update api listing

Change from refresh token to list token
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:20 -08:00
1 parent 00c4f825c7
commit 3b54611d14
40 files changed
+231 -225

No files matched your search

+5 -5
View File
@@ -66,7 +66,7 @@ type ManagedGroupListResult struct {
Items []*ManagedGroup `json:"items,omitempty"`
EstItemCount uint `json:"est_item_count,omitempty"`
RemovedIds []string `json:"removed_ids,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
ListToken string `json:"list_token,omitempty"`
ResponseType string `json:"response_type,omitempty"`
response *api.Response
}
@@ -83,8 +83,8 @@ func (n ManagedGroupListResult) GetRemovedIds() []string {
return n.RemovedIds
}
func (n ManagedGroupListResult) GetRefreshToken() string {
return n.RefreshToken
func (n ManagedGroupListResult) GetListToken() string {
return n.ListToken
}
func (n ManagedGroupListResult) GetResponseType() string {
@@ -358,7 +358,7 @@ func (c *Client) List(ctx context.Context, authMethodId string, opt ...Option) (
return nil, fmt.Errorf("error creating List request: %w", err)
}
opts.queryMap["refresh_token"] = target.RefreshToken
opts.queryMap["list_token"] = target.ListToken
if len(opts.queryMap) > 0 {
q := url.Values{}
for k, v := range opts.queryMap {
@@ -391,7 +391,7 @@ func (c *Client) List(ctx context.Context, authMethodId string, opt ...Option) (
}
target.RemovedIds = append(target.RemovedIds, page.RemovedIds...)
target.EstItemCount = page.EstItemCount
target.RefreshToken = page.RefreshToken
target.ListToken = page.ListToken
target.ResponseType = page.ResponseType
target.response = resp
if target.ResponseType == "complete" {
+6 -6
View File
@@ -25,7 +25,7 @@ type options struct {
withAutomaticVersioning bool
withSkipCurlOutput bool
withFilter string
withRefreshToken string
withListToken string
}
func getDefaultOptions() options {
@@ -49,8 +49,8 @@ func getOpts(opt ...Option) (options, []api.Option) {
if opts.withFilter != "" {
opts.queryMap["filter"] = opts.withFilter
}
if opts.withRefreshToken != "" {
opts.queryMap["refresh_token"] = opts.withRefreshToken
if opts.withListToken != "" {
opts.queryMap["list_token"] = opts.withListToken
}
return opts, apiOpts
}
@@ -73,11 +73,11 @@ func WithSkipCurlOutput(skip bool) Option {
}
}
// WithRefreshToken tells the API to use the provided refresh token
// WithListToken tells the API to use the provided list token
// for listing operations on this resource.
func WithRefreshToken(refreshToken string) Option {
func WithListToken(listToken string) Option {
return func(o *options) {
o.withRefreshToken = refreshToken
o.withListToken = listToken
}
}