From 6be799d916b02451ee5772904e4695ddda7c1491 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 15 Nov 2024 02:06:16 +0000 Subject: [PATCH] feat(tokens): move token value model to shared --- api.md | 11 +++-------- src/cloudflare/resources/accounts/tokens/value.py | 6 +++--- src/cloudflare/resources/user/tokens/value.py | 6 +++--- src/cloudflare/types/__init__.py | 1 + .../types/accounts/token_create_response.py | 4 ++-- src/cloudflare/types/shared/__init__.py | 1 + .../{user/tokens/value.py => shared/token_value.py} | 4 ++-- src/cloudflare/types/user/token_create_response.py | 4 ++-- src/cloudflare/types/user/tokens/__init__.py | 1 - 9 files changed, 17 insertions(+), 21 deletions(-) rename src/cloudflare/types/{user/tokens/value.py => shared/token_value.py} (70%) diff --git a/api.md b/api.md index 5eeb93126a1..2739073db82 100644 --- a/api.md +++ b/api.md @@ -22,6 +22,7 @@ from cloudflare.types import ( Subscription, SubscriptionComponent, SubscriptionZone, + TokenValue, ) ``` @@ -117,7 +118,7 @@ Methods: Methods: -- client.accounts.tokens.value.update(token_id, \*, account_id, \*\*params) -> str +- client.accounts.tokens.value.update(token_id, \*, account_id, \*\*params) -> str # OriginCACertificates @@ -298,15 +299,9 @@ Methods: ### Value -Types: - -```python -from cloudflare.types.user.tokens import Value -``` - Methods: -- client.user.tokens.value.update(token_id, \*\*params) -> str +- client.user.tokens.value.update(token_id, \*\*params) -> str # Zones diff --git a/src/cloudflare/resources/accounts/tokens/value.py b/src/cloudflare/resources/accounts/tokens/value.py index a780c1fc5db..59dac86db7c 100644 --- a/src/cloudflare/resources/accounts/tokens/value.py +++ b/src/cloudflare/resources/accounts/tokens/value.py @@ -22,7 +22,7 @@ from ...._wrappers import ResultWrapper from ...._base_client import make_request_options from ....types.accounts.tokens import value_update_params -from ....types.user.tokens.value import Value +from ....types.shared.token_value import TokenValue __all__ = ["ValueResource", "AsyncValueResource"] @@ -88,7 +88,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Value]]._unwrapper, + post_parser=ResultWrapper[Optional[TokenValue]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -155,7 +155,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Value]]._unwrapper, + post_parser=ResultWrapper[Optional[TokenValue]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) diff --git a/src/cloudflare/resources/user/tokens/value.py b/src/cloudflare/resources/user/tokens/value.py index 33e41e78af2..4a399fba20a 100644 --- a/src/cloudflare/resources/user/tokens/value.py +++ b/src/cloudflare/resources/user/tokens/value.py @@ -22,7 +22,7 @@ from ...._wrappers import ResultWrapper from ...._base_client import make_request_options from ....types.user.tokens import value_update_params -from ....types.user.tokens.value import Value +from ....types.shared.token_value import TokenValue __all__ = ["ValueResource", "AsyncValueResource"] @@ -83,7 +83,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Value]]._unwrapper, + post_parser=ResultWrapper[Optional[TokenValue]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -145,7 +145,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Value]]._unwrapper, + post_parser=ResultWrapper[Optional[TokenValue]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index a241fecb148..d4ddad011f2 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -12,6 +12,7 @@ ErrorData as ErrorData, Identifier as Identifier, Permission as Permission, + TokenValue as TokenValue, ResponseInfo as ResponseInfo, Subscription as Subscription, CertificateCA as CertificateCA, diff --git a/src/cloudflare/types/accounts/token_create_response.py b/src/cloudflare/types/accounts/token_create_response.py index f173d0ce22f..da2f9782044 100644 --- a/src/cloudflare/types/accounts/token_create_response.py +++ b/src/cloudflare/types/accounts/token_create_response.py @@ -9,7 +9,7 @@ from ..._models import BaseModel from ..user.policy import Policy from ..user.cidr_list import CIDRList -from ..user.tokens.value import Value +from ..shared.token_value import TokenValue __all__ = ["TokenCreateResponse", "Condition", "ConditionRequestIP"] @@ -60,5 +60,5 @@ class TokenCreateResponse(BaseModel): status: Optional[Literal["active", "disabled", "expired"]] = None """Status of the token.""" - value: Optional[Value] = None + value: Optional[TokenValue] = None """The token value.""" diff --git a/src/cloudflare/types/shared/__init__.py b/src/cloudflare/types/shared/__init__.py index 6610a90e94f..f24960f0c8b 100644 --- a/src/cloudflare/types/shared/__init__.py +++ b/src/cloudflare/types/shared/__init__.py @@ -9,6 +9,7 @@ from .error_data import ErrorData as ErrorData from .identifier import Identifier as Identifier from .permission import Permission as Permission +from .token_value import TokenValue as TokenValue from .subscription import Subscription as Subscription from .response_info import ResponseInfo as ResponseInfo from .certificate_ca import CertificateCA as CertificateCA diff --git a/src/cloudflare/types/user/tokens/value.py b/src/cloudflare/types/shared/token_value.py similarity index 70% rename from src/cloudflare/types/user/tokens/value.py rename to src/cloudflare/types/shared/token_value.py index 0b594a7796e..051fa9147df 100644 --- a/src/cloudflare/types/user/tokens/value.py +++ b/src/cloudflare/types/shared/token_value.py @@ -2,6 +2,6 @@ from typing_extensions import TypeAlias -__all__ = ["Value"] +__all__ = ["TokenValue"] -Value: TypeAlias = str +TokenValue: TypeAlias = str diff --git a/src/cloudflare/types/user/token_create_response.py b/src/cloudflare/types/user/token_create_response.py index 9cff14c7d1a..96ff448b8ac 100644 --- a/src/cloudflare/types/user/token_create_response.py +++ b/src/cloudflare/types/user/token_create_response.py @@ -9,7 +9,7 @@ from .policy import Policy from ..._models import BaseModel from .cidr_list import CIDRList -from .tokens.value import Value +from ..shared.token_value import TokenValue __all__ = ["TokenCreateResponse", "Condition", "ConditionRequestIP"] @@ -60,5 +60,5 @@ class TokenCreateResponse(BaseModel): status: Optional[Literal["active", "disabled", "expired"]] = None """Status of the token.""" - value: Optional[Value] = None + value: Optional[TokenValue] = None """The token value.""" diff --git a/src/cloudflare/types/user/tokens/__init__.py b/src/cloudflare/types/user/tokens/__init__.py index b2609995ed7..8945db29b3e 100644 --- a/src/cloudflare/types/user/tokens/__init__.py +++ b/src/cloudflare/types/user/tokens/__init__.py @@ -2,5 +2,4 @@ from __future__ import annotations -from .value import Value as Value from .value_update_params import ValueUpdateParams as ValueUpdateParams