Skip to content

Commit

Permalink
Regenerate client from commit 5896c0ef of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Sep 6, 2023
1 parent 1411b9d commit 7524f5f
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.5",
"regenerated": "2023-09-06 13:01:03.250653",
"spec_repo_commit": "c0d26405"
"regenerated": "2023-09-06 13:49:24.907474",
"spec_repo_commit": "5896c0ef"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-09-06 13:01:03.265196",
"spec_repo_commit": "c0d26405"
"regenerated": "2023-09-06 13:49:24.919931",
"spec_repo_commit": "5896c0ef"
}
}
}
4 changes: 4 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25989,6 +25989,10 @@ paths:
summary: Get all teams
tags:
- Teams
x-pagination:
limitParam: page[size]
pageParam: page[number]
resultsPath: data
post:
description: 'Create a new team.

Expand Down
15 changes: 15 additions & 0 deletions examples/v2/teams/ListTeams_3592098458.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Get all teams returns "OK" response with pagination
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.teams_api import TeamsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = TeamsApi(api_client)
items = api_instance.list_teams_with_pagination(
page_size=2,
)
for item in items:
print(item)
65 changes: 65 additions & 0 deletions src/datadog_api_client/v2/api/teams_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

import collections
from typing import Any, Dict, List, Union

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import (
set_attribute_from_path,
get_attribute_from_path,
UnsetType,
unset,
)
from datadog_api_client.v2.model.teams_response import TeamsResponse
from datadog_api_client.v2.model.list_teams_sort import ListTeamsSort
from datadog_api_client.v2.model.list_teams_include import ListTeamsInclude
from datadog_api_client.v2.model.team import Team
from datadog_api_client.v2.model.team_response import TeamResponse
from datadog_api_client.v2.model.team_create_request import TeamCreateRequest
from datadog_api_client.v2.model.team_update_request import TeamUpdateRequest
Expand Down Expand Up @@ -829,6 +833,67 @@ def list_teams(

return self._list_teams_endpoint.call_with_http_info(**kwargs)

def list_teams_with_pagination(
self,
*,
page_number: Union[int, UnsetType] = unset,
page_size: Union[int, UnsetType] = unset,
sort: Union[ListTeamsSort, UnsetType] = unset,
include: Union[List[ListTeamsInclude], UnsetType] = unset,
filter_keyword: Union[str, UnsetType] = unset,
filter_me: Union[bool, UnsetType] = unset,
) -> collections.abc.Iterable[Team]:
"""Get all teams.
Provide a paginated version of :meth:`list_teams`, returning all items.
:param page_number: Specific page number to return.
:type page_number: int, optional
:param page_size: Size for a given page. The maximum allowed value is 100.
:type page_size: int, optional
:param sort: Specifies the order of the returned teams
:type sort: ListTeamsSort, optional
:param include: Included related resources optionally requested. Allowed enum values: ``team_links, user_team_permissions``
:type include: [ListTeamsInclude], optional
:param filter_keyword: Search query. Can be team name, team handle, or email of team member
:type filter_keyword: str, optional
:param filter_me: When true, only returns teams the current user belongs to
:type filter_me: bool, optional
:return: A generator of paginated results.
:rtype: collections.abc.Iterable[Team]
"""
kwargs: Dict[str, Any] = {}
if page_number is not unset:
kwargs["page_number"] = page_number

if page_size is not unset:
kwargs["page_size"] = page_size

if sort is not unset:
kwargs["sort"] = sort

if include is not unset:
kwargs["include"] = include

if filter_keyword is not unset:
kwargs["filter_keyword"] = filter_keyword

if filter_me is not unset:
kwargs["filter_me"] = filter_me

local_page_size = get_attribute_from_path(kwargs, "page_size", 10)
endpoint = self._list_teams_endpoint
set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map)
pagination = {
"limit_value": local_page_size,
"results_path": "data",
"page_param": "page_number",
"endpoint": endpoint,
"kwargs": kwargs,
}
return endpoint.call_with_http_info_paginated(pagination)

def update_team(
self,
team_id: str,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-09-05T14:20:30.333Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
interactions:
- request:
body: null
headers:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=0
response:
body:
string: '{"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"}}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/team?page%5Bsize%5D=2&page%5Bnumber%5D=1
response:
body:
string: '{"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"}}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
8 changes: 8 additions & 0 deletions tests/v2/features/teams.feature
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ Feature: Teams
Then the response status is 200 OK
And the response "data" has item with field "id" with value "{{ dd_team.data.id }}"

@replay-only @skip-validation @team:DataDog/core-app @with-pagination
Scenario: Get all teams returns "OK" response with pagination
Given new "ListTeams" request
And request contains "page[size]" parameter with value 2
When the request with pagination is sent
Then the response status is 200 OK
And the response has 3 items

@team:DataDog/core-app
Scenario: Get links for a team returns "API error response." response
Given new "GetTeamLinks" request
Expand Down

0 comments on commit 7524f5f

Please sign in to comment.