Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 18, 2024
1 parent a3f387b commit 3971f26
Show file tree
Hide file tree
Showing 431 changed files with 2,150 additions and 2,143 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Repository = "https://github.com/cloudflare/cloudflare-python"
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright",
"pyright>=1.1.359",
"mypy",
"respx",
"pytest",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pydantic==2.4.2
# via cloudflare
pydantic-core==2.10.1
# via pydantic
pyright==1.1.353
pyright==1.1.359
pytest==7.1.1
# via pytest-asyncio
pytest-asyncio==0.21.1
Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def construct_type(*, value: object, type_: object) -> object:

# unwrap `Annotated[T, ...]` -> `T`
if is_annotated_type(type_):
meta = get_args(type_)[1:]
meta: tuple[Any, ...] = get_args(type_)[1:]
type_ = extract_type_arg(type_, 0)
else:
meta = tuple()
Expand Down
2 changes: 2 additions & 0 deletions src/cloudflare/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ def wrapper(*args: object, **kwargs: object) -> object:
)
msg = f"Missing required arguments; Expected either {variations} arguments to be given"
else:
assert len(variants) > 0

# TODO: this error message is not deterministic
missing = list(set(variants[0]) - given_params)
if len(missing) > 1:
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/accounts/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
Expand Down Expand Up @@ -204,7 +204,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AccountGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountGetResponse]
Expand Down Expand Up @@ -275,7 +275,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
Expand Down Expand Up @@ -370,7 +370,7 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AccountGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountGetResponse]
Expand Down
16 changes: 8 additions & 8 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[UserWithInviteCode]._unwrapper,
),
cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)
Expand Down Expand Up @@ -138,7 +138,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Member]._unwrapper,
),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)
Expand Down Expand Up @@ -240,7 +240,7 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[MemberDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[MemberDeleteResponse]], ResultWrapper[MemberDeleteResponse]),
)
Expand Down Expand Up @@ -280,7 +280,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Member]._unwrapper,
),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)
Expand Down Expand Up @@ -340,7 +340,7 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[UserWithInviteCode]._unwrapper,
),
cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)
Expand Down Expand Up @@ -384,7 +384,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Member]._unwrapper,
),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)
Expand Down Expand Up @@ -486,7 +486,7 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[MemberDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[MemberDeleteResponse]], ResultWrapper[MemberDeleteResponse]),
)
Expand Down Expand Up @@ -526,7 +526,7 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Member]._unwrapper,
),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)
Expand Down
4 changes: 2 additions & 2 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[RoleGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[RoleGetResponse]
Expand Down Expand Up @@ -184,7 +184,7 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[RoleGetResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[RoleGetResponse]
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/acm/total_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[TotalTLSCreateResponse]._unwrapper,
),
cast_to=cast(Type[TotalTLSCreateResponse], ResultWrapper[TotalTLSCreateResponse]),
)
Expand Down Expand Up @@ -125,7 +125,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[TotalTLSGetResponse]._unwrapper,
),
cast_to=cast(Type[TotalTLSGetResponse], ResultWrapper[TotalTLSGetResponse]),
)
Expand Down Expand Up @@ -188,7 +188,7 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[TotalTLSCreateResponse]._unwrapper,
),
cast_to=cast(Type[TotalTLSCreateResponse], ResultWrapper[TotalTLSCreateResponse]),
)
Expand Down Expand Up @@ -227,7 +227,7 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[TotalTLSGetResponse]._unwrapper,
),
cast_to=cast(Type[TotalTLSGetResponse], ResultWrapper[TotalTLSGetResponse]),
)
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/addressing/address_maps/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
Expand Down Expand Up @@ -136,7 +136,7 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountDeleteResponse]
Expand Down Expand Up @@ -197,7 +197,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AccountUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountUpdateResponse]
Expand Down Expand Up @@ -248,7 +248,7 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AccountDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AccountDeleteResponse]
Expand Down
16 changes: 8 additions & 8 deletions src/cloudflare/resources/addressing/address_maps/address_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper,
),
cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]),
)
Expand Down Expand Up @@ -218,7 +218,7 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AddressMapDeleteResponse]
Expand Down Expand Up @@ -288,7 +288,7 @@ def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMap]._unwrapper,
),
cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]),
)
Expand Down Expand Up @@ -332,7 +332,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper,
),
cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]),
)
Expand Down Expand Up @@ -408,7 +408,7 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMapCreateResponse]._unwrapper,
),
cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]),
)
Expand Down Expand Up @@ -494,7 +494,7 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[AddressMapDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[AddressMapDeleteResponse]
Expand Down Expand Up @@ -564,7 +564,7 @@ async def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMap]._unwrapper,
),
cast_to=cast(Type[AddressMap], ResultWrapper[AddressMap]),
)
Expand Down Expand Up @@ -608,7 +608,7 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[AddressMapGetResponse]._unwrapper,
),
cast_to=cast(Type[AddressMapGetResponse], ResultWrapper[AddressMapGetResponse]),
)
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/addressing/address_maps/ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IPUpdateResponse]
Expand Down Expand Up @@ -141,7 +141,7 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IPDeleteResponse]
Expand Down Expand Up @@ -207,7 +207,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[IPUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IPUpdateResponse]
Expand Down Expand Up @@ -263,7 +263,7 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[IPDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IPDeleteResponse]
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/addressing/address_maps/zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ZoneUpdateResponse]
Expand Down Expand Up @@ -146,7 +146,7 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ZoneDeleteResponse]
Expand Down Expand Up @@ -212,7 +212,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[ZoneUpdateResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ZoneUpdateResponse]
Expand Down Expand Up @@ -268,7 +268,7 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[Optional[ZoneDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ZoneDeleteResponse]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[LOADocumentCreateResponse]._unwrapper,
),
cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]),
)
Expand Down Expand Up @@ -146,7 +146,7 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
post_parser=ResultWrapper[LOADocumentCreateResponse]._unwrapper,
),
cast_to=cast(Type[LOADocumentCreateResponse], ResultWrapper[LOADocumentCreateResponse]),
)
Expand Down
Loading

0 comments on commit 3971f26

Please sign in to comment.