-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pagination extension to team listing (#2169)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
24ceca4
commit 9e718ee
Showing
7 changed files
with
133 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Get all teams returns "OK" response with pagination | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" | ||
) | ||
|
||
func main() { | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV2.NewTeamsApi(apiClient) | ||
resp, _ := api.ListTeamsWithPagination(ctx, *datadogV2.NewListTeamsOptionalParameters().WithPageSize(2)) | ||
|
||
for paginationResult := range resp { | ||
if paginationResult.Error != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.ListTeams`: %v\n", paginationResult.Error) | ||
} | ||
responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ") | ||
fmt.Fprintf(os.Stdout, "%s\n", responseContent) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...narios/v2/Feature_Teams/Scenario_Get_all_teams_returns_OK_response_with_pagination.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-09-05T14:20:30.333Z |
39 changes: 39 additions & 0 deletions
39
...cenarios/v2/Feature_Teams/Scenario_Get_all_teams_returns_OK_response_with_pagination.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
interactions: | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
method: GET | ||
url: https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=0 | ||
response: | ||
body: '{"data":[{"type":"team","attributes":{"created_at":"2023-03-22T17:12:07.018313+00:00","user_count":0,"description":null,"link_count":0,"modified_at":"2023-03-22T17:12:07.018317+00:00","name":"Example | ||
Team","summary":null,"handle":"api-spec-test-team"},"relationships":{"team_links":{"links":{"related":"/api/v2/team/ac73040e-c8d4-11ed-b2ea-da7ad0900002/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/ac73040e-c8d4-11ed-b2ea-da7ad0900002/permission-settings"}}},"id":"ac73040e-c8d4-11ed-b2ea-da7ad0900002"},{"type":"team","attributes":{"created_at":"2023-08-21T19:49:10.718738+00:00","user_count":1,"description":"","link_count":0,"modified_at":"2023-08-21T19:49:10.718744+00:00","name":"test-name-12938712938","summary":null,"handle":"test-handle-12938712938"},"relationships":{"team_links":{"links":{"related":"/api/v2/team/cc338b02-405b-11ee-835e-da7ad0900002/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/cc338b02-405b-11ee-835e-da7ad0900002/permission-settings"}}},"id":"cc338b02-405b-11ee-835e-da7ad0900002"}],"meta":{"pagination":{"number":0,"first_number":0,"prev_number":0,"next_number":1,"last_number":1,"size":2,"type":"number_size","total":3}},"links":{"self":"https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=0","last":"https://api.datadoghq.com/api/v2/team?page[number]=1&page[size]=2","next":"https://api.datadoghq.com/api/v2/team?page[number]=1&page[size]=2","prev":null,"first":"https://api.datadoghq.com/api/v2/team?page[number]=0&page[size]=2"}} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
method: GET | ||
url: https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=1 | ||
response: | ||
body: '{"data":[{"type":"team","relationships":{"user_team_permissions":{"links":{"related":"/api/v2/team/ecc8affc-27d6-11ee-b33c-da7ad0900002/permission-settings"}},"team_links":{"links":{"related":"/api/v2/team/ecc8affc-27d6-11ee-b33c-da7ad0900002/links"}}},"attributes":{"link_count":0,"handle":"tf-testaccteamlinkbasic-local-1689951453","modified_at":"2023-07-21T14:57:34.412713+00:00","created_at":"2023-07-21T14:57:34.412707+00:00","summary":"123","name":"tf-testaccteamlinkbasic-local-1689951453","user_count":0,"description":"123"},"id":"ecc8affc-27d6-11ee-b33c-da7ad0900002"}],"meta":{"pagination":{"number":1,"first_number":0,"prev_number":0,"next_number":2,"last_number":1,"size":2,"type":"number_size","total":3}},"links":{"self":"https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=1","last":"https://api.datadoghq.com/api/v2/team?page[number]=1&page[size]=2","next":"https://api.datadoghq.com/api/v2/team?page[number]=2&page[size]=2","prev":"https://api.datadoghq.com/api/v2/team?page[number]=0&page[size]=2","first":"https://api.datadoghq.com/api/v2/team?page[number]=0&page[size]=2"}} | ||
|
||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters