Skip to content

Commit

Permalink
Regenerate client from commit 8201a401 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jan 26, 2024
1 parent 73de2e2 commit b586d80
Show file tree
Hide file tree
Showing 8 changed files with 151 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.6",
"regenerated": "2024-01-26 15:59:24.698075",
"spec_repo_commit": "28baf464"
"regenerated": "2024-01-26 20:52:51.348013",
"spec_repo_commit": "8201a401"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-01-26 15:59:24.713107",
"spec_repo_commit": "28baf464"
"regenerated": "2024-01-26 20:52:51.362329",
"spec_repo_commit": "8201a401"
}
}
}
4 changes: 4 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31989,6 +31989,10 @@ paths:
summary: Get team memberships
tags:
- Teams
x-pagination:
limitParam: page[size]
pageParam: page[number]
resultsPath: data
post:
description: Add a user to a team.
operationId: CreateTeamMembership
Expand Down
16 changes: 16 additions & 0 deletions examples/v2/teams/GetTeamMemberships_1931613581.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Get team memberships 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.get_team_memberships_with_pagination(
team_id="2e06bf2c-193b-41d4-b3c2-afccc080458f",
page_size=2,
)
for item in items:
print(item)
15 changes: 15 additions & 0 deletions examples/v2/teams/GetTeamMemberships_3799131168.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Get team memberships returns "Represents a user's association to a team" 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.get_team_memberships_with_pagination(
team_id="team_id",
)
for item in items:
print(item)
55 changes: 55 additions & 0 deletions src/datadog_api_client/v2/api/teams_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from datadog_api_client.v2.model.team_link_create_request import TeamLinkCreateRequest
from datadog_api_client.v2.model.user_teams_response import UserTeamsResponse
from datadog_api_client.v2.model.get_team_memberships_sort import GetTeamMembershipsSort
from datadog_api_client.v2.model.user_team import UserTeam
from datadog_api_client.v2.model.user_team_response import UserTeamResponse
from datadog_api_client.v2.model.user_team_request import UserTeamRequest
from datadog_api_client.v2.model.user_team_update_request import UserTeamUpdateRequest
Expand Down Expand Up @@ -756,6 +757,60 @@ def get_team_memberships(

return self._get_team_memberships_endpoint.call_with_http_info(**kwargs)

def get_team_memberships_with_pagination(
self,
team_id: str,
*,
page_size: Union[int, UnsetType] = unset,
page_number: Union[int, UnsetType] = unset,
sort: Union[GetTeamMembershipsSort, UnsetType] = unset,
filter_keyword: Union[str, UnsetType] = unset,
) -> collections.abc.Iterable[UserTeam]:
"""Get team memberships.
Provide a paginated version of :meth:`get_team_memberships`, returning all items.
:param team_id: None
:type team_id: str
:param page_size: Size for a given page. The maximum allowed value is 100.
:type page_size: int, optional
:param page_number: Specific page number to return.
:type page_number: int, optional
:param sort: Specifies the order of returned team memberships
:type sort: GetTeamMembershipsSort, optional
:param filter_keyword: Search query, can be user email or name
:type filter_keyword: str, optional
:return: A generator of paginated results.
:rtype: collections.abc.Iterable[UserTeam]
"""
kwargs: Dict[str, Any] = {}
kwargs["team_id"] = team_id

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

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

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

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

local_page_size = get_attribute_from_path(kwargs, "page_size", 10)
endpoint = self._get_team_memberships_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 get_team_permission_settings(
self,
team_id: str,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-01-26T20:45:29.741Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
interactions:
- request:
body: null
headers:
accept:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page%5Bsize%5D=2&page%5Bnumber%5D=0
response:
body:
string: '{"data":[{"type":"team_memberships","id":"TeamMembership-2e06bf2c-193b-41d4-b3c2-afccc080458f-3736692","attributes":{"role":null,"provisioned_by":null,"provisioned_by_id":"6018c832-80a7-11ea-93dd-43183212bc7a"},"relationships":{"user":{"data":{"type":"users","id":"03b4bfc0-98b9-11ec-842d-da7ad0900002"}}}},{"type":"team_memberships","id":"TeamMembership-2e06bf2c-193b-41d4-b3c2-afccc080458f-4055096","attributes":{"role":null,"provisioned_by":null,"provisioned_by_id":"6018c832-80a7-11ea-93dd-43183212bc7a"},"relationships":{"user":{"data":{"type":"users","id":"170a64a1-d9c6-11ec-af01-da7ad0900002"}}}}],"included":[{"type":"users","id":"03b4bfc0-98b9-11ec-842d-da7ad0900002","attributes":{"name":"Datadog
API Client Python","handle":"example-create_a_user_returns_ok_response_1646068093@datadoghq.com","email":"example-create_a_user_returns_ok_response_1646068093@datadoghq.com","icon":"https://secure.gravatar.com/avatar/27fb863ad335246b65fe4989f1686f35?s=48&d=retro","disabled":false,"service_account":false}},{"type":"users","id":"170a64a1-d9c6-11ec-af01-da7ad0900002","attributes":{"name":"Datadog
API Client Python","handle":"example-create_a_user_returns_ok_response_1653220535@datadoghq.com","email":"example-create_a_user_returns_ok_response_1653220535@datadoghq.com","icon":"https://secure.gravatar.com/avatar/c5256983bba478dfd35e83bbb73621cc?s=48&d=retro","disabled":false,"service_account":false}}],"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/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page%5Bsize%5D=2&page%5Bnumber%5D=0","last":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=1&page[size]=2","next":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=1&page[size]=2","prev":null,"first":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?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/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page%5Bsize%5D=2&page%5Bnumber%5D=1
response:
body:
string: '{"data":[{"type":"team_memberships","id":"TeamMembership-2e06bf2c-193b-41d4-b3c2-afccc080458f-1445416","attributes":{"role":null,"provisioned_by":null,"provisioned_by_id":"6018c832-80a7-11ea-93dd-43183212bc7a"},"relationships":{"user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}],"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"[email protected]","email":"[email protected]","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","disabled":false,"service_account":false}}],"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/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page%5Bsize%5D=2&page%5Bnumber%5D=1","last":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=1&page[size]=2","next":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=2&page[size]=2","prev":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=0&page[size]=2","first":"https://api.datadoghq.com/api/v2/team/2e06bf2c-193b-41d4-b3c2-afccc080458f/memberships?page[number]=0&page[size]=2"}}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
16 changes: 16 additions & 0 deletions tests/v2/features/teams.feature
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ Feature: Teams
When the request is sent
Then the response status is 404 API error response.

@replay-only @skip-validation @team:DataDog/core-app @with-pagination
Scenario: Get team memberships returns "OK" response with pagination
Given new "GetTeamMemberships" request
And request contains "team_id" parameter with value "2e06bf2c-193b-41d4-b3c2-afccc080458f"
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 team memberships returns "Represents a user's association to a team" response
Given new "GetTeamMemberships" request
Expand All @@ -182,6 +191,13 @@ Feature: Teams
When the request is sent
Then the response status is 200 Represents a user's association to a team

@generated @skip @team:DataDog/core-app @with-pagination
Scenario: Get team memberships returns "Represents a user's association to a team" response with pagination
Given new "GetTeamMemberships" request
And request contains "team_id" parameter from "REPLACE.ME"
When the request with pagination is sent
Then the response status is 200 Represents a user's association to a team

@generated @skip @team:DataDog/core-app
Scenario: Get user memberships returns "API error response." response
Given new "GetUserMemberships" request
Expand Down

0 comments on commit b586d80

Please sign in to comment.