Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Apr 23, 2024
1 parent 42ae40b commit 90aad74
Show file tree
Hide file tree
Showing 112 changed files with 1,766 additions and 1,875 deletions.
104 changes: 37 additions & 67 deletions api.md

Large diffs are not rendered by default.

102 changes: 41 additions & 61 deletions src/cloudflare/resources/addressing/address_maps/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Optional, cast
from typing import Type, Optional, cast

import httpx

Expand Down Expand Up @@ -75,22 +75,17 @@ def update(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AccountUpdateResponse],
self._put(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=maybe_transform(body, account_update_params.AccountUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
return self._put(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=maybe_transform(body, account_update_params.AccountUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]),
)

def delete(
Expand Down Expand Up @@ -126,22 +121,17 @@ def delete(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AccountDeleteResponse],
self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=maybe_transform(body, account_delete_params.AccountDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=maybe_transform(body, account_delete_params.AccountDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]),
)


Expand Down Expand Up @@ -187,22 +177,17 @@ async def update(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AccountUpdateResponse],
await self._put(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=await async_maybe_transform(body, account_update_params.AccountUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._put(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=await async_maybe_transform(body, account_update_params.AccountUpdateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AccountUpdateResponse]], ResultWrapper[AccountUpdateResponse]),
)

async def delete(
Expand Down Expand Up @@ -238,22 +223,17 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AccountDeleteResponse],
await self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=await async_maybe_transform(body, account_delete_params.AccountDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}/accounts/{account_id}",
body=await async_maybe_transform(body, account_delete_params.AccountDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AccountDeleteResponse]], ResultWrapper[AccountDeleteResponse]),
)


Expand Down
88 changes: 39 additions & 49 deletions src/cloudflare/resources/addressing/address_maps/address_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Type, Optional, cast
from typing import Type, Optional, cast

import httpx

Expand Down Expand Up @@ -95,7 +95,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMapCreateResponse:
) -> Optional[AddressMapCreateResponse]:
"""
Create a new address map under the account.
Expand Down Expand Up @@ -132,9 +132,9 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper,
),
cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]),
cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]),
)

def list(
Expand Down Expand Up @@ -208,22 +208,17 @@ def delete(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AddressMapDeleteResponse],
self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}",
body=maybe_transform(body, address_map_delete_params.AddressMapDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AddressMapDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}",
body=maybe_transform(body, address_map_delete_params.AddressMapDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]),
)

def edit(
Expand All @@ -240,7 +235,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMap:
) -> Optional[AddressMap]:
"""
Modify properties of an address map owned by the account.
Expand Down Expand Up @@ -288,9 +283,9 @@ def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMap]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper,
),
cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]),
cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]),
)

def get(
Expand All @@ -304,7 +299,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMapGetResponse:
) -> Optional[AddressMapGetResponse]:
"""
Show a particular address map owned by the account.
Expand Down Expand Up @@ -332,9 +327,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper,
),
cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]),
cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]),
)


Expand Down Expand Up @@ -371,7 +366,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMapCreateResponse:
) -> Optional[AddressMapCreateResponse]:
"""
Create a new address map under the account.
Expand Down Expand Up @@ -408,9 +403,9 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapCreateResponse]]._unwrapper,
),
cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]),
cast_to=cast(Type[Optional[AddressMapCreateResponse]], ResultWrapper[AddressMapCreateResponse]),
)

def list(
Expand Down Expand Up @@ -484,22 +479,17 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not address_map_id:
raise ValueError(f"Expected a non-empty value for `address_map_id` but received {address_map_id!r}")
return cast(
Optional[AddressMapDeleteResponse],
await self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}",
body=await async_maybe_transform(body, address_map_delete_params.AddressMapDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AddressMapDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/accounts/{account_id}/addressing/address_maps/{address_map_id}",
body=await async_maybe_transform(body, address_map_delete_params.AddressMapDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[AddressMapDeleteResponse]], ResultWrapper[AddressMapDeleteResponse]),
)

async def edit(
Expand All @@ -516,7 +506,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMap:
) -> Optional[AddressMap]:
"""
Modify properties of an address map owned by the account.
Expand Down Expand Up @@ -564,9 +554,9 @@ async def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMap]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMap]]._unwrapper,
),
cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]),
cast_to=cast(Type[Optional[AddressMap]], ResultWrapper[AddressMap]),
)

async def get(
Expand All @@ -580,7 +570,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AddressMapGetResponse:
) -> Optional[AddressMapGetResponse]:
"""
Show a particular address map owned by the account.
Expand Down Expand Up @@ -608,9 +598,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapGetResponse]]._unwrapper,
),
cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]),
cast_to=cast(Type[Optional[AddressMapGetResponse]], ResultWrapper[AddressMapGetResponse]),
)


Expand Down
Loading

0 comments on commit 90aad74

Please sign in to comment.