diff --git a/openapi_specs/latest/openapi-v241104-MINOR-manually-fixed-trimmed-down.json b/openapi_specs/latest/openapi-v241104-MINOR-manually-fixed-trimmed-down.json index 4565459..8716f5d 100644 --- a/openapi_specs/latest/openapi-v241104-MINOR-manually-fixed-trimmed-down.json +++ b/openapi_specs/latest/openapi-v241104-MINOR-manually-fixed-trimmed-down.json @@ -932,6 +932,143 @@ } } }, + "/appStores/subscriptions": { + "get": { + "summary": "Search app store subscription", + "operationId": "searchAppStoreSubscriptions", + "security": [ + { + "plenigoToken": [] + } + ], + "tags": [ + "App Stores" + ], + "description": "Search all app store subscriptions that correspond to the given search conditions.\n", + "parameters": [ + { + "$ref": "#/components/parameters/sizeQuery" + }, + { + "$ref": "#/components/parameters/startTimeQuery" + }, + { + "$ref": "#/components/parameters/endTimeQuery" + }, + { + "$ref": "#/components/parameters/startingAfterQuery" + }, + { + "$ref": "#/components/parameters/endingBeforeQuery" + }, + { + "$ref": "#/components/parameters/sortQuery" + } + ], + "responses": { + "200": { + "description": "Returns search result.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppStoreSubscriptions" + } + } + } + }, + "400": { + "description": "Request is not formatted correctly or contains invalid data.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResult" + }, + "examples": { + "errorResultBadRequestExample": { + "$ref": "#/components/examples/errorResultBadRequestExample" + } + } + } + } + }, + "401": { + "description": "Plenigo api token provided is not valid or doesn't have necessary rights to access this method.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResultBase" + }, + "examples": { + "errorResultUnauthorizedExample": { + "$ref": "#/components/examples/errorResultUnauthorizedExample" + } + } + } + } + }, + "429": { + "description": "The rate limit for this endpoint is reached. Please try again later.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResultBase" + }, + "examples": { + "errorResultUnauthorizedExample": { + "$ref": "#/components/examples/errorResultTooManyRequestsExample" + } + } + } + } + }, + "500": { + "description": "Currently we are not able to answer your request but we are working hard to resolve this problem.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResultBase" + }, + "examples": { + "errorResultUnauthorizedExample": { + "$ref": "#/components/examples/errorResultInternalErrorExample" + } + } + } + } + }, + "502": { + "description": "Bad Gateway.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResultBase" + }, + "examples": { + "errorResultUnauthorizedExample": { + "$ref": "#/components/examples/errorResultBadGatewayErrorExample" + } + } + } + } + }, + "504": { + "description": "Processing of your request took to long. To prevent blocking we aborted the request. You can resend your request without any changes.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResultBase" + }, + "examples": { + "errorResultUnauthorizedExample": { + "$ref": "#/components/examples/errorResultGatewayTimeoutErrorExample" + } + } + } + } + } + } + } + }, "/customers": { "get": { "summary": "Search customers", @@ -5417,6 +5554,85 @@ } } }, + "AppStoreSubscription": { + "allOf": [ + { + "$ref": "#/components/schemas/ApiBase" + }, + { + "type": "object", + "properties": { + "appStoreSubscriptionId": { + "description": "unique identifier for the app store subscription", + "type": "integer", + "format": "int64" + }, + "chainId": { + "description": "all subscriptions that are in one chain because of some rules or cross selling share a unique chain id in the context of a company that is identically with the first subscription within the chain", + "type": "integer", + "format": "int64" + }, + "externalSystemId": { + "description": "subscription id from app store", + "type": "string" + }, + "customerId": { + "description": "id of the customer the subscription belongs to", + "type": "string" + }, + "startDate": { + "description": "date time the subscription started with date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z", + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "endDate": { + "description": "date time the subscription ended with date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z", + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "cancellationDate": { + "description": "date time the subscription was cancelled with date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z", + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "status": { + "description": "date time the order was created with date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z", + "type": "string", + "enum": [ + "ACTIVE", + "PAUSED", + "INACTIVE", + "IGNORED" + ] + }, + "accessRightUniqueId": { + "description": "unique id of the used access right", + "type": "string" + } + } + } + ] + }, + "AppStoreSubscriptions": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AppStoreSubscription" + } + } + } + }, "Utm": { "type": "object", "properties": { diff --git a/plenigo-client/plenigo/api/app_stores/search_app_store_subscriptions.py b/plenigo-client/plenigo/api/app_stores/search_app_store_subscriptions.py new file mode 100644 index 0000000..479a27a --- /dev/null +++ b/plenigo-client/plenigo/api/app_stores/search_app_store_subscriptions.py @@ -0,0 +1,385 @@ +import datetime +import logging +from http import HTTPStatus +from typing import Any, Dict, Optional, Union + +import httpx +from tenacity import RetryError, retry, retry_if_exception_type, stop_after_attempt, wait_exponential + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.app_store_subscriptions import AppStoreSubscriptions +from ...models.error_result import ErrorResult +from ...models.error_result_base import ErrorResultBase +from ...models.search_app_store_subscriptions_sort import SearchAppStoreSubscriptionsSort +from ...types import UNSET, Response, Unset + +log = logging.getLogger(__name__) + + +def _get_kwargs( + *, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Dict[str, Any]: + params: Dict[str, Any] = {} + + params["size"] = size + + json_start_time: Union[Unset, str] = UNSET + if not isinstance(start_time, Unset): + json_start_time = start_time.isoformat() + params["startTime"] = json_start_time + + json_end_time: Union[Unset, str] = UNSET + if not isinstance(end_time, Unset): + json_end_time = end_time.isoformat() + params["endTime"] = json_end_time + + params["startingAfter"] = starting_after + + params["endingBefore"] = ending_before + + json_sort: Union[Unset, str] = UNSET + if not isinstance(sort, Unset): + json_sort = sort.value + + params["sort"] = json_sort + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/appStores/subscriptions", + "params": params, + } + + log.debug(_kwargs) + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + if response.status_code == HTTPStatus.OK: + response_200 = AppStoreSubscriptions.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.BAD_REQUEST: + response_400 = ErrorResult.from_dict(response.json()) + + return response_400 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = ErrorResultBase.from_dict(response.json()) + + return response_401 + if response.status_code == HTTPStatus.TOO_MANY_REQUESTS: + response_429 = ErrorResultBase.from_dict(response.json()) + + return response_429 + if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR: + response_500 = ErrorResultBase.from_dict(response.json()) + + return response_500 + if response.status_code == HTTPStatus.BAD_GATEWAY: + response_502 = ErrorResultBase.from_dict(response.json()) + + return response_502 + if response.status_code == HTTPStatus.GATEWAY_TIMEOUT: + response_504 = ErrorResultBase.from_dict(response.json()) + + return response_504 + + if (response.status_code == HTTPStatus.BAD_GATEWAY) or (response.status_code == HTTPStatus.GATEWAY_TIMEOUT): + raise errors.RetryableError + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_all( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Optional[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + all_results = AppStoreSubscriptions(items=[]) + # type: ignore + + while True: + try: + results = sync_detailed( + client=client, + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ).parsed + + if results and not isinstance(results, ErrorResultBase) and not isinstance(results.items, Unset): + all_results.items.extend(results.items) # type: ignore + + cursor = results.additional_properties.get("startingAfterId") + + if not cursor: + break + + starting_after = cursor # noqa + else: + break + except RetryError: + break + + return all_results + + +@retry( + retry=retry_if_exception_type(errors.RetryableError), + stop=stop_after_attempt(3), + wait=wait_exponential(multiplier=1, min=2, max=30), +) +def sync_detailed( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + """Search app store subscription + + Search all app store subscriptions that correspond to the given search conditions. + + Args: + size (Union[Unset, int]): + start_time (Union[Unset, datetime.datetime]): + end_time (Union[Unset, datetime.datetime]): + starting_after (Union[Unset, str]): + ending_before (Union[Unset, str]): + sort (Union[Unset, SearchAppStoreSubscriptionsSort]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]] + """ + + kwargs = _get_kwargs( + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Optional[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + """Search app store subscription + + Search all app store subscriptions that correspond to the given search conditions. + + Args: + size (Union[Unset, int]): + start_time (Union[Unset, datetime.datetime]): + end_time (Union[Unset, datetime.datetime]): + starting_after (Union[Unset, str]): + ending_before (Union[Unset, str]): + sort (Union[Unset, SearchAppStoreSubscriptionsSort]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase] + """ + + return sync_detailed( + client=client, + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ).parsed + + +@retry( + retry=retry_if_exception_type(errors.RetryableError), + stop=stop_after_attempt(3), + wait=wait_exponential(multiplier=1, min=2, max=30), +) +async def asyncio_detailed( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + """Search app store subscription + + Search all app store subscriptions that correspond to the given search conditions. + + Args: + size (Union[Unset, int]): + start_time (Union[Unset, datetime.datetime]): + end_time (Union[Unset, datetime.datetime]): + starting_after (Union[Unset, str]): + ending_before (Union[Unset, str]): + sort (Union[Unset, SearchAppStoreSubscriptionsSort]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]] + """ + + kwargs = _get_kwargs( + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio_all( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Response[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + all_results = AppStoreSubscriptions(items=[]) + # type: ignore + + while True: + try: + results = ( + await asyncio_detailed( + client=client, + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ) + ).parsed + + if results and not isinstance(results, ErrorResultBase) and not isinstance(results.items, Unset): + all_results.items.extend(results.items) # type: ignore + + cursor = results.additional_properties.get("startingAfterId") + + if not cursor: + break + + starting_after = cursor # noqa + else: + break + except RetryError: + break + + return all_results + + +async def asyncio( + *, + client: AuthenticatedClient, + size: Union[Unset, int] = UNSET, + start_time: Union[Unset, datetime.datetime] = UNSET, + end_time: Union[Unset, datetime.datetime] = UNSET, + starting_after: Union[Unset, str] = UNSET, + ending_before: Union[Unset, str] = UNSET, + sort: Union[Unset, SearchAppStoreSubscriptionsSort] = UNSET, +) -> Optional[Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase]]: + """Search app store subscription + + Search all app store subscriptions that correspond to the given search conditions. + + Args: + size (Union[Unset, int]): + start_time (Union[Unset, datetime.datetime]): + end_time (Union[Unset, datetime.datetime]): + starting_after (Union[Unset, str]): + ending_before (Union[Unset, str]): + sort (Union[Unset, SearchAppStoreSubscriptionsSort]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[AppStoreSubscriptions, ErrorResult, ErrorResultBase] + """ + + return ( + await asyncio_detailed( + client=client, + size=size, + start_time=start_time, + end_time=end_time, + starting_after=starting_after, + ending_before=ending_before, + sort=sort, + ) + ).parsed diff --git a/plenigo-client/plenigo/models/__init__.py b/plenigo-client/plenigo/models/__init__.py index 6c11e59..72c2fb2 100644 --- a/plenigo-client/plenigo/models/__init__.py +++ b/plenigo-client/plenigo/models/__init__.py @@ -45,6 +45,9 @@ from .app_store_purchase import AppStorePurchase from .app_store_purchase_detail import AppStorePurchaseDetail from .app_store_purchase_list import AppStorePurchaseList +from .app_store_subscription import AppStoreSubscription +from .app_store_subscription_status import AppStoreSubscriptionStatus +from .app_store_subscriptions import AppStoreSubscriptions from .apple_app_store_purchase import AppleAppStorePurchase from .apple_app_store_purchase_addition import AppleAppStorePurchaseAddition from .apple_app_store_purchase_data import AppleAppStorePurchaseData @@ -180,6 +183,7 @@ from .schemas_status_history import SchemasStatusHistory from .search_access_rights_sort import SearchAccessRightsSort from .search_app_store_orders_sort import SearchAppStoreOrdersSort +from .search_app_store_subscriptions_sort import SearchAppStoreSubscriptionsSort from .search_apple_app_store_purchases_sort import SearchAppleAppStorePurchasesSort from .search_customers_sort import SearchCustomersSort from .search_google_play_store_purchases_sort import SearchGooglePlayStorePurchasesSort @@ -284,6 +288,9 @@ "AppStorePurchase", "AppStorePurchaseDetail", "AppStorePurchaseList", + "AppStoreSubscription", + "AppStoreSubscriptions", + "AppStoreSubscriptionStatus", "ArchiveSettings", "ArchiveSettingsArchiveType", "BankAccount", @@ -405,6 +412,7 @@ "SearchAccessRightsSort", "SearchAppleAppStorePurchasesSort", "SearchAppStoreOrdersSort", + "SearchAppStoreSubscriptionsSort", "SearchCustomersSort", "SearchGooglePlayStorePurchasesSort", "SearchInvoicesInvoiceType", diff --git a/plenigo-client/plenigo/models/app_store_subscription.py b/plenigo-client/plenigo/models/app_store_subscription.py new file mode 100644 index 0000000..7193bf7 --- /dev/null +++ b/plenigo-client/plenigo/models/app_store_subscription.py @@ -0,0 +1,364 @@ +import datetime +from typing import Any, Dict, List, Type, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.app_store_subscription_status import AppStoreSubscriptionStatus +from ..models.user_type import UserType +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AppStoreSubscription") + + +@_attrs_define +class AppStoreSubscription: + """ + Attributes: + created_date (Union[None, Unset, datetime.datetime]): time the object was created with time notation as defined + by RFC 3339, section 5.6, for + example, 17:32:28 + changed_date (Union[None, Unset, datetime.datetime]): time the object was changed with time notation as defined + by RFC 3339, section 5.6, for + example, 17:32:28 + created_by (Union[Unset, str]): id who created the object + created_by_type (Union[Unset, UserType]): type of user who performs the action + changed_by (Union[Unset, str]): id who changed the object + changed_by_type (Union[Unset, UserType]): type of user who performs the action + app_store_subscription_id (Union[Unset, int]): unique identifier for the app store subscription + chain_id (Union[Unset, int]): all subscriptions that are in one chain because of some rules or cross selling + share a unique chain id in the context of a company that is identically with the first subscription within the + chain + external_system_id (Union[Unset, str]): subscription id from app store + customer_id (Union[Unset, str]): id of the customer the subscription belongs to + start_date (Union[None, Unset, datetime.datetime]): date time the subscription started with date-time notation + as defined by RFC 3339, section + 5.6, for example, 2017-07-21T17:32:28Z + end_date (Union[None, Unset, datetime.datetime]): date time the subscription ended with date-time notation as + defined by RFC 3339, section 5.6, + for example, 2017-07-21T17:32:28Z + cancellation_date (Union[None, Unset, datetime.datetime]): date time the subscription was cancelled with date- + time notation as defined by RFC 3339, + section 5.6, for example, 2017-07-21T17:32:28Z + status (Union[Unset, AppStoreSubscriptionStatus]): date time the order was created with date-time notation as + defined by RFC 3339, section 5.6, + for example, 2017-07-21T17:32:28Z + access_right_unique_id (Union[Unset, str]): unique id of the used access right + """ + + created_date: Union[None, Unset, datetime.datetime] = UNSET + changed_date: Union[None, Unset, datetime.datetime] = UNSET + created_by: Union[Unset, str] = UNSET + created_by_type: Union[Unset, UserType] = UNSET + changed_by: Union[Unset, str] = UNSET + changed_by_type: Union[Unset, UserType] = UNSET + app_store_subscription_id: Union[Unset, int] = UNSET + chain_id: Union[Unset, int] = UNSET + external_system_id: Union[Unset, str] = UNSET + customer_id: Union[Unset, str] = UNSET + start_date: Union[None, Unset, datetime.datetime] = UNSET + end_date: Union[None, Unset, datetime.datetime] = UNSET + cancellation_date: Union[None, Unset, datetime.datetime] = UNSET + status: Union[Unset, AppStoreSubscriptionStatus] = UNSET + access_right_unique_id: Union[Unset, str] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + created_date: Union[None, Unset, str] + if isinstance(self.created_date, Unset) or self.created_date is None: + created_date = UNSET + elif isinstance(self.created_date, datetime.datetime): + created_date = self.created_date.isoformat() + else: + created_date = self.created_date + + changed_date: Union[None, Unset, str] + if isinstance(self.changed_date, Unset) or self.changed_date is None: + changed_date = UNSET + elif isinstance(self.changed_date, datetime.datetime): + changed_date = self.changed_date.isoformat() + else: + changed_date = self.changed_date + + created_by = self.created_by + + created_by_type: Union[Unset, str] = UNSET + if not isinstance(self.created_by_type, Unset): + created_by_type = self.created_by_type.value + + changed_by = self.changed_by + + changed_by_type: Union[Unset, str] = UNSET + if not isinstance(self.changed_by_type, Unset): + changed_by_type = self.changed_by_type.value + + app_store_subscription_id = self.app_store_subscription_id + + chain_id = self.chain_id + + external_system_id = self.external_system_id + + customer_id = self.customer_id + + start_date: Union[None, Unset, str] + if isinstance(self.start_date, Unset) or self.start_date is None: + start_date = UNSET + elif isinstance(self.start_date, datetime.datetime): + start_date = self.start_date.isoformat() + else: + start_date = self.start_date + + end_date: Union[None, Unset, str] + if isinstance(self.end_date, Unset) or self.end_date is None: + end_date = UNSET + elif isinstance(self.end_date, datetime.datetime): + end_date = self.end_date.isoformat() + else: + end_date = self.end_date + + cancellation_date: Union[None, Unset, str] + if isinstance(self.cancellation_date, Unset) or self.cancellation_date is None: + cancellation_date = UNSET + elif isinstance(self.cancellation_date, datetime.datetime): + cancellation_date = self.cancellation_date.isoformat() + else: + cancellation_date = self.cancellation_date + + status: Union[Unset, str] = UNSET + if not isinstance(self.status, Unset): + status = self.status.value + + access_right_unique_id = self.access_right_unique_id + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if created_date is not UNSET: + field_dict["createdDate"] = created_date + if changed_date is not UNSET: + field_dict["changedDate"] = changed_date + if created_by is not UNSET: + field_dict["createdBy"] = created_by + if created_by_type is not UNSET: + field_dict["createdByType"] = created_by_type + if changed_by is not UNSET: + field_dict["changedBy"] = changed_by + if changed_by_type is not UNSET: + field_dict["changedByType"] = changed_by_type + if app_store_subscription_id is not UNSET: + field_dict["appStoreSubscriptionId"] = app_store_subscription_id + if chain_id is not UNSET: + field_dict["chainId"] = chain_id + if external_system_id is not UNSET: + field_dict["externalSystemId"] = external_system_id + if customer_id is not UNSET: + field_dict["customerId"] = customer_id + if start_date is not UNSET: + field_dict["startDate"] = start_date + if end_date is not UNSET: + field_dict["endDate"] = end_date + if cancellation_date is not UNSET: + field_dict["cancellationDate"] = cancellation_date + if status is not UNSET: + field_dict["status"] = status + if access_right_unique_id is not UNSET: + field_dict["accessRightUniqueId"] = access_right_unique_id + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + + def _parse_created_date(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + + if data is None: + return data + + if isinstance(data, Unset): + return data + + # Try to parse the data as datetime.datetime + try: + if not isinstance(data, str): + raise TypeError() + created_date_type_0 = isoparse(data) + + return created_date_type_0 + except: # noqa: E722 + pass + + return cast(Union[None, Unset, datetime.datetime], data) + + created_date = _parse_created_date(d.pop("createdDate", UNSET)) + + def _parse_changed_date(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + + if data is None: + return data + + if isinstance(data, Unset): + return data + + # Try to parse the data as datetime.datetime + try: + if not isinstance(data, str): + raise TypeError() + changed_date_type_0 = isoparse(data) + + return changed_date_type_0 + except: # noqa: E722 + pass + + return cast(Union[None, Unset, datetime.datetime], data) + + changed_date = _parse_changed_date(d.pop("changedDate", UNSET)) + + created_by = d.pop("createdBy", UNSET) + + _created_by_type = d.pop("createdByType", UNSET) + created_by_type: Union[Unset, UserType] + if isinstance(_created_by_type, Unset) or not _created_by_type: + created_by_type = UNSET + else: + created_by_type = UserType(_created_by_type) + + changed_by = d.pop("changedBy", UNSET) + + _changed_by_type = d.pop("changedByType", UNSET) + changed_by_type: Union[Unset, UserType] + if isinstance(_changed_by_type, Unset) or not _changed_by_type: + changed_by_type = UNSET + else: + changed_by_type = UserType(_changed_by_type) + + app_store_subscription_id = d.pop("appStoreSubscriptionId", UNSET) + + chain_id = d.pop("chainId", UNSET) + + external_system_id = d.pop("externalSystemId", UNSET) + + customer_id = d.pop("customerId", UNSET) + + def _parse_start_date(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + + if data is None: + return data + + if isinstance(data, Unset): + return data + + # Try to parse the data as datetime.datetime + try: + if not isinstance(data, str): + raise TypeError() + start_date_type_0 = isoparse(data) + + return start_date_type_0 + except: # noqa: E722 + pass + + return cast(Union[None, Unset, datetime.datetime], data) + + start_date = _parse_start_date(d.pop("startDate", UNSET)) + + def _parse_end_date(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + + if data is None: + return data + + if isinstance(data, Unset): + return data + + # Try to parse the data as datetime.datetime + try: + if not isinstance(data, str): + raise TypeError() + end_date_type_0 = isoparse(data) + + return end_date_type_0 + except: # noqa: E722 + pass + + return cast(Union[None, Unset, datetime.datetime], data) + + end_date = _parse_end_date(d.pop("endDate", UNSET)) + + def _parse_cancellation_date(data: object) -> Union[None, Unset, datetime.datetime]: + if data is None: + return data + + if data is None: + return data + + if isinstance(data, Unset): + return data + + # Try to parse the data as datetime.datetime + try: + if not isinstance(data, str): + raise TypeError() + cancellation_date_type_0 = isoparse(data) + + return cancellation_date_type_0 + except: # noqa: E722 + pass + + return cast(Union[None, Unset, datetime.datetime], data) + + cancellation_date = _parse_cancellation_date(d.pop("cancellationDate", UNSET)) + + _status = d.pop("status", UNSET) + status: Union[Unset, AppStoreSubscriptionStatus] + if isinstance(_status, Unset) or not _status: + status = UNSET + else: + status = AppStoreSubscriptionStatus(_status) + + access_right_unique_id = d.pop("accessRightUniqueId", UNSET) + + app_store_subscription = cls( + created_date=created_date, + changed_date=changed_date, + created_by=created_by, + created_by_type=created_by_type, + changed_by=changed_by, + changed_by_type=changed_by_type, + app_store_subscription_id=app_store_subscription_id, + chain_id=chain_id, + external_system_id=external_system_id, + customer_id=customer_id, + start_date=start_date, + end_date=end_date, + cancellation_date=cancellation_date, + status=status, + access_right_unique_id=access_right_unique_id, + ) + + app_store_subscription.additional_properties = d + return app_store_subscription + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/plenigo-client/plenigo/models/app_store_subscription_status.py b/plenigo-client/plenigo/models/app_store_subscription_status.py new file mode 100644 index 0000000..d3b93e3 --- /dev/null +++ b/plenigo-client/plenigo/models/app_store_subscription_status.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class AppStoreSubscriptionStatus(str, Enum): + ACTIVE = "ACTIVE" + IGNORED = "IGNORED" + INACTIVE = "INACTIVE" + PAUSED = "PAUSED" + + def __str__(self) -> str: + return str(self.value) diff --git a/plenigo-client/plenigo/models/app_store_subscriptions.py b/plenigo-client/plenigo/models/app_store_subscriptions.py new file mode 100644 index 0000000..67cc738 --- /dev/null +++ b/plenigo-client/plenigo/models/app_store_subscriptions.py @@ -0,0 +1,74 @@ +from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.app_store_subscription import AppStoreSubscription + + +T = TypeVar("T", bound="AppStoreSubscriptions") + + +@_attrs_define +class AppStoreSubscriptions: + """ + Attributes: + items (Union[Unset, List['AppStoreSubscription']]): + """ + + items: Union[Unset, List["AppStoreSubscription"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> Dict[str, Any]: + items: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.items, Unset): + items = [] + for items_item_data in self.items: + items_item = items_item_data.to_dict() + items.append(items_item) + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if items is not UNSET: + field_dict["items"] = items + + return field_dict + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.app_store_subscription import AppStoreSubscription + + d = src_dict.copy() + items = [] + _items = d.pop("items", UNSET) + for items_item_data in _items or []: + items_item = AppStoreSubscription.from_dict(items_item_data) + + items.append(items_item) + + app_store_subscriptions = cls( + items=items, + ) + + app_store_subscriptions.additional_properties = d + return app_store_subscriptions + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/plenigo-client/plenigo/models/search_app_store_subscriptions_sort.py b/plenigo-client/plenigo/models/search_app_store_subscriptions_sort.py new file mode 100644 index 0000000..22dc6ec --- /dev/null +++ b/plenigo-client/plenigo/models/search_app_store_subscriptions_sort.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class SearchAppStoreSubscriptionsSort(str, Enum): + ASC = "ASC" + DESC = "DESC" + + def __str__(self) -> str: + return str(self.value) diff --git a/scripts/endpoints.json b/scripts/endpoints.json index a2d1fbc..01c1fdb 100644 --- a/scripts/endpoints.json +++ b/scripts/endpoints.json @@ -18,5 +18,6 @@ "/paymentMethods/bankAccounts/{bankAccountId}", "/subscriptions/{subscriptionId}", "/subscriptions/chain/{chainId}/additionalData", - "/vouchers/channels/{channelId}/vouchers" + "/vouchers/channels/{channelId}/vouchers", + "/appStores/subscriptions" ]