Skip to content

Commit f40aace

Browse files
feat(api): api update
1 parent e2a5229 commit f40aace

File tree

5 files changed

+17
-45
lines changed

5 files changed

+17
-45
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1807
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-88e489ffcdc25d2b600aabfddfc4509e020dda51b71624c4369eab50f5ac15a7.yml
3-
openapi_spec_hash: 26da5dec2367f3c63bded8a4a7caa937
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c42047fbab361b401a0b1c4e34f370b0131ace1fbd5c158ca49e14380902b0f2.yml
3+
openapi_spec_hash: 673783dfb96f15bec51a6b2952b10286
44
config_hash: 9f61e9f02b675e373b140471d52b670c

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9452,7 +9452,7 @@ Methods:
94529452

94539453
- <code title="post /accounts/{account_id}/iam/resource_groups">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/iam/resource_group_create_params.py">params</a>) -> <a href="./src/cloudflare/types/iam/resource_group_create_response.py">ResourceGroupCreateResponse</a></code>
94549454
- <code title="put /accounts/{account_id}/iam/resource_groups/{resource_group_id}">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">update</a>(resource_group_id, \*, account_id, \*\*<a href="src/cloudflare/types/iam/resource_group_update_params.py">params</a>) -> <a href="./src/cloudflare/types/iam/resource_group_update_response.py">ResourceGroupUpdateResponse</a></code>
9455-
- <code title="get /accounts/{account_id}/iam/resource_groups">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/iam/resource_group_list_params.py">params</a>) -> <a href="./src/cloudflare/types/iam/resource_group_list_response.py">SyncV4PagePaginationArray[ResourceGroupListResponse]</a></code>
9455+
- <code title="get /accounts/{account_id}/iam/resource_groups">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/iam/resource_group_list_params.py">params</a>) -> <a href="./src/cloudflare/types/iam/resource_group_list_response.py">SyncSinglePage[ResourceGroupListResponse]</a></code>
94569456
- <code title="delete /accounts/{account_id}/iam/resource_groups/{resource_group_id}">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">delete</a>(resource_group_id, \*, account_id) -> <a href="./src/cloudflare/types/iam/resource_group_delete_response.py">Optional[ResourceGroupDeleteResponse]</a></code>
94579457
- <code title="get /accounts/{account_id}/iam/resource_groups/{resource_group_id}">client.iam.resource_groups.<a href="./src/cloudflare/resources/iam/resource_groups.py">get</a>(resource_group_id, \*, account_id) -> <a href="./src/cloudflare/types/iam/resource_group_get_response.py">ResourceGroupGetResponse</a></code>
94589458

src/cloudflare/resources/iam/resource_groups.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)
1919
from ..._wrappers import ResultWrapper
2020
from ...types.iam import resource_group_list_params, resource_group_create_params, resource_group_update_params
21-
from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
21+
from ...pagination import SyncSinglePage, AsyncSinglePage
2222
from ..._base_client import AsyncPaginator, make_request_options
2323
from ...types.iam.resource_group_get_response import ResourceGroupGetResponse
2424
from ...types.iam.resource_group_list_response import ResourceGroupListResponse
@@ -156,15 +156,13 @@ def list(
156156
account_id: str,
157157
id: str | NotGiven = NOT_GIVEN,
158158
name: str | NotGiven = NOT_GIVEN,
159-
page: float | NotGiven = NOT_GIVEN,
160-
per_page: float | NotGiven = NOT_GIVEN,
161159
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
162160
# The extra values given here take precedence over values defined on the client or passed to this method.
163161
extra_headers: Headers | None = None,
164162
extra_query: Query | None = None,
165163
extra_body: Body | None = None,
166164
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
167-
) -> SyncV4PagePaginationArray[ResourceGroupListResponse]:
165+
) -> SyncSinglePage[ResourceGroupListResponse]:
168166
"""
169167
List all the resource groups for an account.
170168
@@ -175,10 +173,6 @@ def list(
175173
176174
name: Name of the resource group to be fetched.
177175
178-
page: Page number of paginated results.
179-
180-
per_page: Maximum number of results per page.
181-
182176
extra_headers: Send extra headers
183177
184178
extra_query: Add additional query parameters to the request
@@ -191,7 +185,7 @@ def list(
191185
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
192186
return self._get_api_list(
193187
f"/accounts/{account_id}/iam/resource_groups",
194-
page=SyncV4PagePaginationArray[ResourceGroupListResponse],
188+
page=SyncSinglePage[ResourceGroupListResponse],
195189
options=make_request_options(
196190
extra_headers=extra_headers,
197191
extra_query=extra_query,
@@ -201,8 +195,6 @@ def list(
201195
{
202196
"id": id,
203197
"name": name,
204-
"page": page,
205-
"per_page": per_page,
206198
},
207199
resource_group_list_params.ResourceGroupListParams,
208200
),
@@ -422,15 +414,13 @@ def list(
422414
account_id: str,
423415
id: str | NotGiven = NOT_GIVEN,
424416
name: str | NotGiven = NOT_GIVEN,
425-
page: float | NotGiven = NOT_GIVEN,
426-
per_page: float | NotGiven = NOT_GIVEN,
427417
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
428418
# The extra values given here take precedence over values defined on the client or passed to this method.
429419
extra_headers: Headers | None = None,
430420
extra_query: Query | None = None,
431421
extra_body: Body | None = None,
432422
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
433-
) -> AsyncPaginator[ResourceGroupListResponse, AsyncV4PagePaginationArray[ResourceGroupListResponse]]:
423+
) -> AsyncPaginator[ResourceGroupListResponse, AsyncSinglePage[ResourceGroupListResponse]]:
434424
"""
435425
List all the resource groups for an account.
436426
@@ -441,10 +431,6 @@ def list(
441431
442432
name: Name of the resource group to be fetched.
443433
444-
page: Page number of paginated results.
445-
446-
per_page: Maximum number of results per page.
447-
448434
extra_headers: Send extra headers
449435
450436
extra_query: Add additional query parameters to the request
@@ -457,7 +443,7 @@ def list(
457443
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
458444
return self._get_api_list(
459445
f"/accounts/{account_id}/iam/resource_groups",
460-
page=AsyncV4PagePaginationArray[ResourceGroupListResponse],
446+
page=AsyncSinglePage[ResourceGroupListResponse],
461447
options=make_request_options(
462448
extra_headers=extra_headers,
463449
extra_query=extra_query,
@@ -467,8 +453,6 @@ def list(
467453
{
468454
"id": id,
469455
"name": name,
470-
"page": page,
471-
"per_page": per_page,
472456
},
473457
resource_group_list_params.ResourceGroupListParams,
474458
),

src/cloudflare/types/iam/resource_group_list_params.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,3 @@ class ResourceGroupListParams(TypedDict, total=False):
1616

1717
name: str
1818
"""Name of the resource group to be fetched."""
19-
20-
page: float
21-
"""Page number of paginated results."""
22-
23-
per_page: float
24-
"""Maximum number of results per page."""

tests/api_resources/iam/test_resource_groups.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ResourceGroupDeleteResponse,
1717
ResourceGroupUpdateResponse,
1818
)
19-
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
19+
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
2020

2121
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
2222

@@ -148,18 +148,16 @@ def test_method_list(self, client: Cloudflare) -> None:
148148
resource_group = client.iam.resource_groups.list(
149149
account_id="023e105f4ecef8ad9ca31a8372d0c353",
150150
)
151-
assert_matches_type(SyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
151+
assert_matches_type(SyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
152152

153153
@parametrize
154154
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
155155
resource_group = client.iam.resource_groups.list(
156156
account_id="023e105f4ecef8ad9ca31a8372d0c353",
157157
id="023e105f4ecef8ad9ca31a8372d0c353",
158158
name="NameOfTheResourceGroup",
159-
page=1,
160-
per_page=5,
161159
)
162-
assert_matches_type(SyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
160+
assert_matches_type(SyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
163161

164162
@parametrize
165163
def test_raw_response_list(self, client: Cloudflare) -> None:
@@ -170,7 +168,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
170168
assert response.is_closed is True
171169
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
172170
resource_group = response.parse()
173-
assert_matches_type(SyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
171+
assert_matches_type(SyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
174172

175173
@parametrize
176174
def test_streaming_response_list(self, client: Cloudflare) -> None:
@@ -181,7 +179,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
181179
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
182180

183181
resource_group = response.parse()
184-
assert_matches_type(SyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
182+
assert_matches_type(SyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
185183

186184
assert cast(Any, response.is_closed) is True
187185

@@ -418,18 +416,16 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
418416
resource_group = await async_client.iam.resource_groups.list(
419417
account_id="023e105f4ecef8ad9ca31a8372d0c353",
420418
)
421-
assert_matches_type(AsyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
419+
assert_matches_type(AsyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
422420

423421
@parametrize
424422
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
425423
resource_group = await async_client.iam.resource_groups.list(
426424
account_id="023e105f4ecef8ad9ca31a8372d0c353",
427425
id="023e105f4ecef8ad9ca31a8372d0c353",
428426
name="NameOfTheResourceGroup",
429-
page=1,
430-
per_page=5,
431427
)
432-
assert_matches_type(AsyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
428+
assert_matches_type(AsyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
433429

434430
@parametrize
435431
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -440,7 +436,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
440436
assert response.is_closed is True
441437
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
442438
resource_group = await response.parse()
443-
assert_matches_type(AsyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"])
439+
assert_matches_type(AsyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
444440

445441
@parametrize
446442
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -451,9 +447,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
451447
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
452448

453449
resource_group = await response.parse()
454-
assert_matches_type(
455-
AsyncV4PagePaginationArray[ResourceGroupListResponse], resource_group, path=["response"]
456-
)
450+
assert_matches_type(AsyncSinglePage[ResourceGroupListResponse], resource_group, path=["response"])
457451

458452
assert cast(Any, response.is_closed) is True
459453

0 commit comments

Comments
 (0)