diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 41988c95..3fb92c21 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -507,5 +507,3 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_webhooks_subscription_config.py -test/test_webhooks_subscription_mapping.py diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 73a86b19..3769235d 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.1.0 \ No newline at end of file diff --git a/README.md b/README.md index d4ad11f7..1cbd98a2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The Fatture in Cloud API is based on REST, and makes possible to interact with t This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2.0.30 -- Package version: 2.0.16 +- Package version: 2.0.17 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://www.fattureincloud.it](https://www.fattureincloud.it) diff --git a/fattureincloud_python_sdk/__init__.py b/fattureincloud_python_sdk/__init__.py index 99a55717..4932a6b6 100644 --- a/fattureincloud_python_sdk/__init__.py +++ b/fattureincloud_python_sdk/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "2.0.16" +__version__ = "2.0.17" # import apis into sdk package from fattureincloud_python_sdk.api.archive_api import ArchiveApi diff --git a/fattureincloud_python_sdk/api/archive_api.py b/fattureincloud_python_sdk/api/archive_api.py index 25f3aa3c..c0de415e 100644 --- a/fattureincloud_python_sdk/api/archive_api.py +++ b/fattureincloud_python_sdk/api/archive_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBytes, StrictInt, StrictStr, conint +from pydantic import StrictBytes, StrictInt, StrictStr, field_validator from typing import Optional, Union @@ -48,10 +54,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class ArchiveApi: @@ -66,370 +69,552 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_archive_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_archive_document_request: Annotated[ Optional[CreateArchiveDocumentRequest], Field(description="The Archive Document."), ] = None, - **kwargs - ) -> CreateArchiveDocumentResponse: # noqa: E501 - """Create Archive Document # noqa: E501 - - Creates a new archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateArchiveDocumentResponse: + """Create Archive Document - >>> thread = api.create_archive_document(company_id, create_archive_document_request, async_req=True) - >>> result = thread.get() + Creates a new archive document. :param company_id: The ID of the company. (required) :type company_id: int :param create_archive_document_request: The Archive Document. :type create_archive_document_request: CreateArchiveDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateArchiveDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_archive_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_archive_document_with_http_info( - company_id, create_archive_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_archive_document_serialize( + company_id=company_id, + create_archive_document_request=create_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_archive_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_archive_document_request: Annotated[ Optional[CreateArchiveDocumentRequest], Field(description="The Archive Document."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Archive Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateArchiveDocumentResponse]: + """Create Archive Document - Creates a new archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Creates a new archive document. - >>> thread = api.create_archive_document_with_http_info(company_id, create_archive_document_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_archive_document_request: The Archive Document. + :type create_archive_document_request: CreateArchiveDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_archive_document_serialize( + company_id=company_id, + create_archive_document_request=create_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_archive_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_archive_document_request: Annotated[ + Optional[CreateArchiveDocumentRequest], + Field(description="The Archive Document."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Archive Document + + Creates a new archive document. :param company_id: The ID of the company. (required) :type company_id: int :param create_archive_document_request: The Archive Document. :type create_archive_document_request: CreateArchiveDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateArchiveDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_archive_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._create_archive_document_serialize( + company_id=company_id, + create_archive_document_request=create_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_archive_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _create_archive_document_serialize( + self, + company_id, + create_archive_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_archive_document_request"] is not None: - _body_params = _params["create_archive_document_request"] + if create_archive_document_request is not None: + _body_params = create_archive_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateArchiveDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/archive", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/archive", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_archive_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Archive Document # noqa: E501 - - Deletes the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_archive_document(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Archive Document + + Deletes the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_archive_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_archive_document_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_archive_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_archive_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Archive Document # noqa: E501 - - Deletes the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_archive_document_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Archive Document + + Deletes the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_archive_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_archive_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_archive_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Archive Document - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Deletes the specified archive document. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_archive_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_archive_document_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/archive/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/archive/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_archive_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetArchiveDocumentResponse: # noqa: E501 - """Get Archive Document # noqa: E501 - - Gets the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetArchiveDocumentResponse: + """Get Archive Document - >>> thread = api.get_archive_document(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int @@ -439,50 +624,79 @@ def get_archive_document( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetArchiveDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_archive_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_archive_document_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_archive_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_archive_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Archive Document # noqa: E501 - - Gets the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetArchiveDocumentResponse]: + """Get Archive Document - >>> thread = api.get_archive_document_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int @@ -492,120 +706,196 @@ def get_archive_document_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetArchiveDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_archive_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_archive_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + def get_archive_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Archive Document - _collection_formats = {} + Gets the specified archive document. - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_archive_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_archive_document_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetArchiveDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/archive/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/archive/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_archive_documents( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -622,22 +912,27 @@ def list_archive_documents( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListArchiveDocumentsResponse: # noqa: E501 - """List Archive Documents # noqa: E501 - - Lists the archive documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListArchiveDocumentsResponse: + """List Archive Documents - >>> thread = api.list_archive_documents(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the archive documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -653,31 +948,60 @@ def list_archive_documents( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListArchiveDocumentsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_archive_documents_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_archive_documents_with_http_info( - company_id, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_archive_documents_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_archive_documents_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -694,22 +1018,133 @@ def list_archive_documents_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Archive Documents # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListArchiveDocumentsResponse]: + """List Archive Documents - Lists the archive documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Lists the archive documents. - >>> thread = api.list_archive_documents_with_http_info(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_archive_documents_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_archive_documents_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Archive Documents + + Lists the archive documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -725,154 +1160,150 @@ def list_archive_documents_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListArchiveDocumentsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_archive_documents_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_archive_documents" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_archive_documents_serialize( + self, + company_id, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListArchiveDocumentsResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/archive", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/archive", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_archive_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_archive_document_request: Annotated[ Optional[ModifyArchiveDocumentRequest], Field(description="Modified Archive Document"), ] = None, - **kwargs - ) -> ModifyArchiveDocumentResponse: # noqa: E501 - """Modify Archive Document # noqa: E501 - - Modifies the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyArchiveDocumentResponse: + """Modify Archive Document - >>> thread = api.modify_archive_document(company_id, document_id, modify_archive_document_request, async_req=True) - >>> result = thread.get() + Modifies the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int @@ -880,48 +1311,76 @@ def modify_archive_document( :type document_id: int :param modify_archive_document_request: Modified Archive Document :type modify_archive_document_request: ModifyArchiveDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyArchiveDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_archive_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_archive_document_with_http_info( - company_id, document_id, modify_archive_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_archive_document_serialize( + company_id=company_id, + document_id=document_id, + modify_archive_document_request=modify_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_archive_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_archive_document_request: Annotated[ Optional[ModifyArchiveDocumentRequest], Field(description="Modified Archive Document"), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Archive Document # noqa: E501 - - Modifies the specified archive document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyArchiveDocumentResponse]: + """Modify Archive Document - >>> thread = api.modify_archive_document_with_http_info(company_id, document_id, modify_archive_document_request, async_req=True) - >>> result = thread.get() + Modifies the specified archive document. :param company_id: The ID of the company. (required) :type company_id: int @@ -929,125 +1388,195 @@ def modify_archive_document_with_http_info( :type document_id: int :param modify_archive_document_request: Modified Archive Document :type modify_archive_document_request: ModifyArchiveDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyArchiveDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_archive_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._modify_archive_document_serialize( + company_id=company_id, + document_id=document_id, + modify_archive_document_request=modify_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_archive_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_archive_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + modify_archive_document_request: Annotated[ + Optional[ModifyArchiveDocumentRequest], + Field(description="Modified Archive Document"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Archive Document - _collection_formats = {} + Modifies the specified archive document. - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param modify_archive_document_request: Modified Archive Document + :type modify_archive_document_request: ModifyArchiveDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_archive_document_serialize( + company_id=company_id, + document_id=document_id, + modify_archive_document_request=modify_archive_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyArchiveDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _modify_archive_document_serialize( + self, + company_id, + document_id, + modify_archive_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_archive_document_request"] is not None: - _body_params = _params["modify_archive_document_request"] + if modify_archive_document_request is not None: + _body_params = modify_archive_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyArchiveDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/archive/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/archive/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def upload_archive_document_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1057,16 +1586,21 @@ def upload_archive_document_attachment( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> UploadArchiveAttachmentResponse: # noqa: E501 - """Upload Archive Document Attachment # noqa: E501 - - Uploads an attachment destined to an archive document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UploadArchiveAttachmentResponse: + """Upload Archive Document Attachment - >>> thread = api.upload_archive_document_attachment(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to an archive document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1074,31 +1608,56 @@ def upload_archive_document_attachment( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UploadArchiveAttachmentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the upload_archive_document_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.upload_archive_document_attachment_with_http_info( - company_id, filename, attachment, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._upload_archive_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadArchiveAttachmentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def upload_archive_document_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1108,16 +1667,102 @@ def upload_archive_document_attachment_with_http_info( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Upload Archive Document Attachment # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UploadArchiveAttachmentResponse]: + """Upload Archive Document Attachment + + Uploads an attachment destined to an archive document. The actual association between the document and the attachment must be implemented separately, using the returned token. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param filename: Attachment file name + :type filename: str + :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] + :type attachment: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_archive_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Uploads an attachment destined to an archive document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadArchiveAttachmentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def upload_archive_document_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + filename: Annotated[ + Optional[StrictStr], Field(description="Attachment file name") + ] = None, + attachment: Annotated[ + Optional[Union[StrictBytes, StrictStr]], + Field( + description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upload Archive Document Attachment - >>> thread = api.upload_archive_document_attachment_with_http_info(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to an archive document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1125,115 +1770,110 @@ def upload_archive_document_attachment_with_http_info( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UploadArchiveAttachmentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "filename", "attachment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._upload_archive_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_archive_document_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadArchiveAttachmentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _upload_archive_document_attachment_serialize( + self, + company_id, + filename, + attachment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} - if _params["filename"]: - _form_params.append(("filename", _params["filename"])) - - if _params["attachment"]: - _files["attachment"] = _params["attachment"] - + if filename is not None: + _form_params.append(("filename", filename)) + if attachment is not None: + _files["attachment"] = attachment # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["multipart/form-data"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "UploadArchiveAttachmentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/archive/attachment", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/archive/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/cashbook_api.py b/fattureincloud_python_sdk/api/cashbook_api.py index 5e5b733a..d0246514 100644 --- a/fattureincloud_python_sdk/api/cashbook_api.py +++ b/fattureincloud_python_sdk/api/cashbook_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -45,10 +51,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class CashbookApi: @@ -63,368 +66,549 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_cashbook_entry( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_cashbook_entry_request: Annotated[ Optional[CreateCashbookEntryRequest], Field(description="Cashbook entry. ") ] = None, - **kwargs - ) -> CreateCashbookEntryResponse: # noqa: E501 - """Create Cashbook Entry # noqa: E501 - - Creates a new cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateCashbookEntryResponse: + """Create Cashbook Entry - >>> thread = api.create_cashbook_entry(company_id, create_cashbook_entry_request, async_req=True) - >>> result = thread.get() + Creates a new cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int :param create_cashbook_entry_request: Cashbook entry. :type create_cashbook_entry_request: CreateCashbookEntryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateCashbookEntryResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_cashbook_entry_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_cashbook_entry_with_http_info( - company_id, create_cashbook_entry_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_cashbook_entry_serialize( + company_id=company_id, + create_cashbook_entry_request=create_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_cashbook_entry_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_cashbook_entry_request: Annotated[ Optional[CreateCashbookEntryRequest], Field(description="Cashbook entry. ") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Cashbook Entry # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateCashbookEntryResponse]: + """Create Cashbook Entry - Creates a new cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Creates a new cashbook entry. - >>> thread = api.create_cashbook_entry_with_http_info(company_id, create_cashbook_entry_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_cashbook_entry_request: Cashbook entry. + :type create_cashbook_entry_request: CreateCashbookEntryRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_cashbook_entry_serialize( + company_id=company_id, + create_cashbook_entry_request=create_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_cashbook_entry_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_cashbook_entry_request: Annotated[ + Optional[CreateCashbookEntryRequest], Field(description="Cashbook entry. ") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Cashbook Entry + + Creates a new cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int :param create_cashbook_entry_request: Cashbook entry. :type create_cashbook_entry_request: CreateCashbookEntryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateCashbookEntryResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_cashbook_entry_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_cashbook_entry" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_cashbook_entry_serialize( + company_id=company_id, + create_cashbook_entry_request=create_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_cashbook_entry_serialize( + self, + company_id, + create_cashbook_entry_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_cashbook_entry_request"] is not None: - _body_params = _params["create_cashbook_entry_request"] + if create_cashbook_entry_request is not None: + _body_params = create_cashbook_entry_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateCashbookEntryResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/cashbook", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/cashbook", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_cashbook_entry( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Cashbook Entry # noqa: E501 - - Deletes the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_cashbook_entry(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Cashbook Entry + + Deletes the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_cashbook_entry_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_cashbook_entry_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_cashbook_entry_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Cashbook Entry # noqa: E501 - - Deletes the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_cashbook_entry_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Cashbook Entry + + Deletes the specified cashbook entry. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_cashbook_entry_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Cashbook Entry + + Deletes the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_cashbook_entry" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _delete_cashbook_entry_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/cashbook/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/cashbook/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_cashbook_entry( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetCashbookEntryResponse: # noqa: E501 - """Get Cashbook Entry # noqa: E501 - - Gets the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCashbookEntryResponse: + """Get Cashbook Entry - >>> thread = api.get_cashbook_entry(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int @@ -434,50 +618,161 @@ def get_cashbook_entry( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetCashbookEntryResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_cashbook_entry_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_cashbook_entry_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_cashbook_entry_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Cashbook Entry # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCashbookEntryResponse]: + """Get Cashbook Entry + + Gets the specified cashbook entry. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: str + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Gets the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_cashbook_entry_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Cashbook Entry - >>> thread = api.get_cashbook_entry_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int @@ -487,122 +782,116 @@ def get_cashbook_entry_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetCashbookEntryResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_cashbook_entry" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_cashbook_entry_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetCashbookEntryResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/cashbook/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/cashbook/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_cashbook_entries( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - date_from: Annotated[StrictStr, Field(..., description="Start date.")], - date_to: Annotated[StrictStr, Field(..., description="End date.")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + date_from: Annotated[StrictStr, Field(description="Start date.")], + date_to: Annotated[StrictStr, Field(description="End date.")], year: Annotated[ Optional[StrictInt], Field(description="Filter cashbook by year.") ] = None, @@ -612,16 +901,21 @@ def list_cashbook_entries( payment_account_id: Annotated[ Optional[StrictInt], Field(description="Filter by payment account.") ] = None, - **kwargs - ) -> ListCashbookEntriesResponse: # noqa: E501 - """List Cashbook Entries # noqa: E501 - - Lists the cashbook entries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCashbookEntriesResponse: + """List Cashbook Entries - >>> thread = api.list_cashbook_entries(company_id, date_from, date_to, year, type, payment_account_id, async_req=True) - >>> result = thread.get() + Lists the cashbook entries. :param company_id: The ID of the company. (required) :type company_id: int @@ -635,33 +929,61 @@ def list_cashbook_entries( :type type: str :param payment_account_id: Filter by payment account. :type payment_account_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListCashbookEntriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_cashbook_entries_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_cashbook_entries_with_http_info( - company_id, date_from, date_to, year, type, payment_account_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_cashbook_entries_serialize( + company_id=company_id, + date_from=date_from, + date_to=date_to, + year=year, + type=type, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCashbookEntriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_cashbook_entries_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - date_from: Annotated[StrictStr, Field(..., description="Start date.")], - date_to: Annotated[StrictStr, Field(..., description="End date.")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + date_from: Annotated[StrictStr, Field(description="Start date.")], + date_to: Annotated[StrictStr, Field(description="End date.")], year: Annotated[ Optional[StrictInt], Field(description="Filter cashbook by year.") ] = None, @@ -671,16 +993,113 @@ def list_cashbook_entries_with_http_info( payment_account_id: Annotated[ Optional[StrictInt], Field(description="Filter by payment account.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Cashbook Entries # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCashbookEntriesResponse]: + """List Cashbook Entries - Lists the cashbook entries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Lists the cashbook entries. - >>> thread = api.list_cashbook_entries_with_http_info(company_id, date_from, date_to, year, type, payment_account_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param date_from: Start date. (required) + :type date_from: str + :param date_to: End date. (required) + :type date_to: str + :param year: Filter cashbook by year. + :type year: int + :param type: Filter cashbook by type. + :type type: str + :param payment_account_id: Filter by payment account. + :type payment_account_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_cashbook_entries_serialize( + company_id=company_id, + date_from=date_from, + date_to=date_to, + year=year, + type=type, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCashbookEntriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_cashbook_entries_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + date_from: Annotated[StrictStr, Field(description="Start date.")], + date_to: Annotated[StrictStr, Field(description="End date.")], + year: Annotated[ + Optional[StrictInt], Field(description="Filter cashbook by year.") + ] = None, + type: Annotated[ + Optional[StrictStr], Field(description="Filter cashbook by type.") + ] = None, + payment_account_id: Annotated[ + Optional[StrictInt], Field(description="Filter by payment account.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Cashbook Entries + + Lists the cashbook entries. :param company_id: The ID of the company. (required) :type company_id: int @@ -694,149 +1113,144 @@ def list_cashbook_entries_with_http_info( :type type: str :param payment_account_id: Filter by payment account. :type payment_account_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListCashbookEntriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "date_from", - "date_to", - "year", - "type", - "payment_account_id", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_cashbook_entries" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_cashbook_entries_serialize( + company_id=company_id, + date_from=date_from, + date_to=date_to, + year=year, + type=type, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCashbookEntriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_cashbook_entries_serialize( + self, + company_id, + date_from, + date_to, + year, + type, + payment_account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("date_from") is not None: # noqa: E501 - _query_params.append(("date_from", _params["date_from"])) + if date_from is not None: + _query_params.append(("date_from", date_from)) - if _params.get("date_to") is not None: # noqa: E501 - _query_params.append(("date_to", _params["date_to"])) + if date_to is not None: + _query_params.append(("date_to", date_to)) - if _params.get("year") is not None: # noqa: E501 - _query_params.append(("year", _params["year"])) + if year is not None: + _query_params.append(("year", year)) - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) - if _params.get("payment_account_id") is not None: # noqa: E501 - _query_params.append(("payment_account_id", _params["payment_account_id"])) + if payment_account_id is not None: + _query_params.append(("payment_account_id", payment_account_id)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListCashbookEntriesResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/cashbook", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/cashbook", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_cashbook_entry( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], modify_cashbook_entry_request: Annotated[ Optional[ModifyCashbookEntryRequest], Field(description="Cashbook Entry") ] = None, - **kwargs - ) -> ModifyCashbookEntryResponse: # noqa: E501 - """Modify Cashbook Entry # noqa: E501 - - Modifies the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyCashbookEntryResponse: + """Modify Cashbook Entry - >>> thread = api.modify_cashbook_entry(company_id, document_id, modify_cashbook_entry_request, async_req=True) - >>> result = thread.get() + Modifies the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int @@ -844,47 +1258,151 @@ def modify_cashbook_entry( :type document_id: str :param modify_cashbook_entry_request: Cashbook Entry :type modify_cashbook_entry_request: ModifyCashbookEntryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyCashbookEntryResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_cashbook_entry_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_cashbook_entry_with_http_info( - company_id, document_id, modify_cashbook_entry_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + modify_cashbook_entry_request=modify_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_cashbook_entry_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictStr, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], modify_cashbook_entry_request: Annotated[ Optional[ModifyCashbookEntryRequest], Field(description="Cashbook Entry") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Cashbook Entry # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyCashbookEntryResponse]: + """Modify Cashbook Entry - Modifies the specified cashbook entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Modifies the specified cashbook entry. - >>> thread = api.modify_cashbook_entry_with_http_info(company_id, document_id, modify_cashbook_entry_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: str + :param modify_cashbook_entry_request: Cashbook Entry + :type modify_cashbook_entry_request: ModifyCashbookEntryRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + modify_cashbook_entry_request=modify_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_cashbook_entry_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictStr, Field(description="The ID of the document.")], + modify_cashbook_entry_request: Annotated[ + Optional[ModifyCashbookEntryRequest], Field(description="Cashbook Entry") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Cashbook Entry + + Modifies the specified cashbook entry. :param company_id: The ID of the company. (required) :type company_id: int @@ -892,115 +1410,110 @@ def modify_cashbook_entry_with_http_info( :type document_id: str :param modify_cashbook_entry_request: Cashbook Entry :type modify_cashbook_entry_request: ModifyCashbookEntryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyCashbookEntryResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_cashbook_entry_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_cashbook_entry" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_cashbook_entry_serialize( + company_id=company_id, + document_id=document_id, + modify_cashbook_entry_request=modify_cashbook_entry_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyCashbookEntryResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _modify_cashbook_entry_serialize( + self, + company_id, + document_id, + modify_cashbook_entry_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_cashbook_entry_request"] is not None: - _body_params = _params["modify_cashbook_entry_request"] + if modify_cashbook_entry_request is not None: + _body_params = modify_cashbook_entry_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyCashbookEntryResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/cashbook/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/cashbook/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/clients_api.py b/fattureincloud_python_sdk/api/clients_api.py index bfb63328..35b334ae 100644 --- a/fattureincloud_python_sdk/api/clients_api.py +++ b/fattureincloud_python_sdk/api/clients_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, conint +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -33,10 +39,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class ClientsApi: @@ -51,366 +54,537 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_client( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_client_request: Annotated[ Optional[CreateClientRequest], Field(description="The client to create") ] = None, - **kwargs - ) -> CreateClientResponse: # noqa: E501 - """Create Client # noqa: E501 - - Creates a new client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateClientResponse: + """Create Client - >>> thread = api.create_client(company_id, create_client_request, async_req=True) - >>> result = thread.get() + Creates a new client. :param company_id: The ID of the company. (required) :type company_id: int :param create_client_request: The client to create :type create_client_request: CreateClientRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateClientResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_client_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_client_with_http_info( - company_id, create_client_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_client_serialize( + company_id=company_id, + create_client_request=create_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateClientResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_client_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_client_request: Annotated[ Optional[CreateClientRequest], Field(description="The client to create") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Client # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateClientResponse]: + """Create Client - Creates a new client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Creates a new client. - >>> thread = api.create_client_with_http_info(company_id, create_client_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_client_request: The client to create + :type create_client_request: CreateClientRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_client_serialize( + company_id=company_id, + create_client_request=create_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateClientResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_client_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_client_request: Annotated[ + Optional[CreateClientRequest], Field(description="The client to create") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Client + + Creates a new client. :param company_id: The ID of the company. (required) :type company_id: int :param create_client_request: The client to create :type create_client_request: CreateClientRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateClientResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_client_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._create_client_serialize( + company_id=company_id, + create_client_request=create_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_client" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateClientResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _create_client_serialize( + self, + company_id, + create_client_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_client_request"] is not None: - _body_params = _params["create_client_request"] + if create_client_request is not None: + _body_params = create_client_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateClientResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/entities/clients", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/entities/clients", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_client( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Client # noqa: E501 - - Deletes the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_client(company_id, client_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Client + + Deletes the specified client. :param company_id: The ID of the company. (required) :type company_id: int :param client_id: The ID of the client. (required) :type client_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_client_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_client_with_http_info( - company_id, client_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_client_serialize( + company_id=company_id, + client_id=client_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_client_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Client # noqa: E501 - - Deletes the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_client_with_http_info(company_id, client_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Client + + Deletes the specified client. :param company_id: The ID of the company. (required) :type company_id: int :param client_id: The ID of the client. (required) :type client_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "client_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_client_serialize( + company_id=company_id, + client_id=client_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_client" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_client_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Client - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Deletes the specified client. - if _params["client_id"]: - _path_params["client_id"] = _params["client_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param client_id: The ID of the client. (required) + :type client_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_client_serialize( + company_id=company_id, + client_id=client_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_client_serialize( + self, + company_id, + client_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if client_id is not None: + _path_params["client_id"] = client_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/entities/clients/{client_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/entities/clients/{client_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_client( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetClientResponse: # noqa: E501 - """Get Client # noqa: E501 - - Gets the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetClientResponse: + """Get Client - >>> thread = api.get_client(company_id, client_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified client. :param company_id: The ID of the company. (required) :type company_id: int @@ -420,50 +594,79 @@ def get_client( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetClientResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_client_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_client_with_http_info( - company_id, client_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_client_serialize( + company_id=company_id, + client_id=client_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_client_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Client # noqa: E501 - - Gets the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetClientResponse]: + """Get Client - >>> thread = api.get_client_with_http_info(company_id, client_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified client. :param company_id: The ID of the company. (required) :type company_id: int @@ -473,120 +676,196 @@ def get_client_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetClientResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "client_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_client_serialize( + company_id=company_id, + client_id=client_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_client" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def get_client_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Client - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Gets the specified client. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param client_id: The ID of the client. (required) + :type client_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_client_serialize( + company_id=company_id, + client_id=client_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - if _params["client_id"]: - _path_params["client_id"] = _params["client_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_client_serialize( + self, + company_id, + client_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if client_id is not None: + _path_params["client_id"] = client_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetClientResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/clients/{client_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/entities/clients/{client_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_clients( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -603,22 +882,27 @@ def list_clients( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListClientsResponse: # noqa: E501 - """List Clients # noqa: E501 - - Lists the clients. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListClientsResponse: + """List Clients - >>> thread = api.list_clients(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the clients. :param company_id: The ID of the company. (required) :type company_id: int @@ -634,31 +918,59 @@ def list_clients( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListClientsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_clients_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_clients_with_http_info( - company_id, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_clients_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListClientsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_clients_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -675,22 +987,132 @@ def list_clients_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Clients # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListClientsResponse]: + """List Clients + + Lists the clients. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_clients_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the clients. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListClientsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.list_clients_with_http_info(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + @validate_call + def list_clients_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Clients + + Lists the clients. :param company_id: The ID of the company. (required) :type company_id: int @@ -706,155 +1128,151 @@ def list_clients_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListClientsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_clients_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_clients" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListClientsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_clients_serialize( + self, + company_id, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListClientsResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/clients", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/entities/clients", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_client( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], modify_client_request: Annotated[ Optional[ModifyClientRequest], Field( description="The modified Client. First level parameters are managed in delta mode." ), ] = None, - **kwargs - ) -> ModifyClientResponse: # noqa: E501 - """Modify Client # noqa: E501 - - Modifies the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyClientResponse: + """Modify Client - >>> thread = api.modify_client(company_id, client_id, modify_client_request, async_req=True) - >>> result = thread.get() + Modifies the specified client. :param company_id: The ID of the company. (required) :type company_id: int @@ -862,50 +1280,78 @@ def modify_client( :type client_id: int :param modify_client_request: The modified Client. First level parameters are managed in delta mode. :type modify_client_request: ModifyClientRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyClientResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_client_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_client_with_http_info( - company_id, client_id, modify_client_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_client_serialize( + company_id=company_id, + client_id=client_id, + modify_client_request=modify_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_client_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - client_id: Annotated[ - StrictInt, Field(..., description="The ID of the client.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], modify_client_request: Annotated[ Optional[ModifyClientRequest], Field( description="The modified Client. First level parameters are managed in delta mode." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Client # noqa: E501 - - Modifies the specified client. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyClientResponse]: + """Modify Client - >>> thread = api.modify_client_with_http_info(company_id, client_id, modify_client_request, async_req=True) - >>> result = thread.get() + Modifies the specified client. :param company_id: The ID of the company. (required) :type company_id: int @@ -913,115 +1359,189 @@ def modify_client_with_http_info( :type client_id: int :param modify_client_request: The modified Client. First level parameters are managed in delta mode. :type modify_client_request: ModifyClientRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyClientResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "client_id", "modify_client_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._modify_client_serialize( + company_id=company_id, + client_id=client_id, + modify_client_request=modify_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_client" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def modify_client_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + client_id: Annotated[StrictInt, Field(description="The ID of the client.")], + modify_client_request: Annotated[ + Optional[ModifyClientRequest], + Field( + description="The modified Client. First level parameters are managed in delta mode." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Client - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Modifies the specified client. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param client_id: The ID of the client. (required) + :type client_id: int + :param modify_client_request: The modified Client. First level parameters are managed in delta mode. + :type modify_client_request: ModifyClientRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_client_serialize( + company_id=company_id, + client_id=client_id, + modify_client_request=modify_client_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyClientResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["client_id"]: - _path_params["client_id"] = _params["client_id"] + def _modify_client_serialize( + self, + company_id, + client_id, + modify_client_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if client_id is not None: + _path_params["client_id"] = client_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_client_request"] is not None: - _body_params = _params["modify_client_request"] + if modify_client_request is not None: + _body_params = modify_client_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyClientResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/clients/{client_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/entities/clients/{client_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/companies_api.py b/fattureincloud_python_sdk/api/companies_api.py index cdcd80da..518557cb 100644 --- a/fattureincloud_python_sdk/api/companies_api.py +++ b/fattureincloud_python_sdk/api/companies_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt +from pydantic import StrictInt from fattureincloud_python_sdk.models.get_company_info_response import ( GetCompanyInfoResponse, @@ -28,10 +34,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class CompaniesApi: @@ -46,155 +49,243 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def get_company_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> GetCompanyInfoResponse: # noqa: E501 - """Get Company Info # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetCompanyInfoResponse: + """Get Company Info - Gets the company detailed info. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_company_info(company_id, async_req=True) - >>> result = thread.get() + Gets the company detailed info. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetCompanyInfoResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_company_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_company_info_with_http_info(company_id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_company_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCompanyInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_company_info_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Company Info # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetCompanyInfoResponse]: + """Get Company Info - Gets the company detailed info. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the company detailed info. - >>> thread = api.get_company_info_with_http_info(company_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_company_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCompanyInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_company_info_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Company Info + + Gets the company detailed info. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetCompanyInfoResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_company_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_company_info" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetCompanyInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _get_company_info_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetCompanyInfoResponse", - "401": None, - } + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] - return self.api_client.call_api( - "/c/{company_id}/company/info", - "GET", - _path_params, - _query_params, - _header_params, + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/company/info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/emails_api.py b/fattureincloud_python_sdk/api/emails_api.py index 64b7867f..bf35face 100644 --- a/fattureincloud_python_sdk/api/emails_api.py +++ b/fattureincloud_python_sdk/api/emails_api.py @@ -13,23 +13,26 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt +from pydantic import StrictInt from fattureincloud_python_sdk.models.list_emails_response import ListEmailsResponse from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class EmailsApi: @@ -44,154 +47,234 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def list_emails( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListEmailsResponse: # noqa: E501 - """List Emails # noqa: E501 - - List Emails. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListEmailsResponse: + """List Emails - >>> thread = api.list_emails(company_id, async_req=True) - >>> result = thread.get() + List Emails. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListEmailsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_emails_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_emails_with_http_info(company_id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_emails_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "ListEmailsResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_emails_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Emails # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListEmailsResponse]: + """List Emails + + List Emails. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_emails_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - List Emails. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {"200": "ListEmailsResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_emails_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Emails - >>> thread = api.list_emails_with_http_info(company_id, async_req=True) - >>> result = thread.get() + List Emails. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListEmailsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_emails_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_emails" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {"200": "ListEmailsResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_emails_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListEmailsResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/emails", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/emails", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/info_api.py b/fattureincloud_python_sdk/api/info_api.py index 5f101a12..c79b7cc4 100644 --- a/fattureincloud_python_sdk/api/info_api.py +++ b/fattureincloud_python_sdk/api/info_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictInt, StrictStr +from pydantic import StrictBool, StrictInt, StrictStr, field_validator from typing import Optional @@ -73,10 +79,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class InfoApi: @@ -91,163 +94,251 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def list_archive_categories( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListArchiveCategoriesResponse: # noqa: E501 - """List Archive Categories # noqa: E501 - - Lists the archive categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListArchiveCategoriesResponse: + """List Archive Categories - >>> thread = api.list_archive_categories(company_id, async_req=True) - >>> result = thread.get() + Lists the archive categories. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListArchiveCategoriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_archive_categories_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_archive_categories_with_http_info( - company_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_archive_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_archive_categories_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Archive Categories # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListArchiveCategoriesResponse]: + """List Archive Categories + + Lists the archive categories. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_archive_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the archive categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_archive_categories_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Archive Categories - >>> thread = api.list_archive_categories_with_http_info(company_id, async_req=True) - >>> result = thread.get() + Lists the archive categories. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListArchiveCategoriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_archive_categories" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_archive_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListArchiveCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_archive_categories_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListArchiveCategoriesResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/archive_categories", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/archive_categories", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_cities( self, postal_code: Annotated[ @@ -257,41 +348,68 @@ def list_cities( Optional[StrictStr], Field(description="City for filtering (ignored if postal_code is passed)."), ] = None, - **kwargs - ) -> ListCitiesResponse: # noqa: E501 - """List Cities # noqa: E501 - - Lists the Italian cities. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCitiesResponse: + """List Cities - >>> thread = api.list_cities(postal_code, city, async_req=True) - >>> result = thread.get() + Lists the Italian cities. :param postal_code: Postal code for filtering. :type postal_code: str :param city: City for filtering (ignored if postal_code is passed). :type city: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListCitiesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_cities_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_cities_with_http_info( - postal_code, city, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_cities_serialize( + postal_code=postal_code, + city=city, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "ListCitiesResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_cities_with_http_info( self, postal_code: Annotated[ @@ -301,967 +419,1654 @@ def list_cities_with_http_info( Optional[StrictStr], Field(description="City for filtering (ignored if postal_code is passed)."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Cities # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCitiesResponse]: + """List Cities + + Lists the Italian cities. + + :param postal_code: Postal code for filtering. + :type postal_code: str + :param city: City for filtering (ignored if postal_code is passed). + :type city: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_cities_serialize( + postal_code=postal_code, + city=city, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "ListCitiesResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the Italian cities. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_cities_without_preload_content( + self, + postal_code: Annotated[ + Optional[StrictStr], Field(description="Postal code for filtering.") + ] = None, + city: Annotated[ + Optional[StrictStr], + Field(description="City for filtering (ignored if postal_code is passed)."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Cities - >>> thread = api.list_cities_with_http_info(postal_code, city, async_req=True) - >>> result = thread.get() + Lists the Italian cities. :param postal_code: Postal code for filtering. :type postal_code: str :param city: City for filtering (ignored if postal_code is passed). :type city: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListCitiesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["postal_code", "city"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_cities" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_cities_serialize( + postal_code=postal_code, + city=city, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = {"200": "ListCitiesResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_cities_serialize( + self, + postal_code, + city, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] - if _params.get("postal_code") is not None: # noqa: E501 - _query_params.append(("postal_code", _params["postal_code"])) + if postal_code is not None: + _query_params.append(("postal_code", postal_code)) - if _params.get("city") is not None: # noqa: E501 - _query_params.append(("city", _params["city"])) + if city is not None: + _query_params.append(("city", city)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListCitiesResponse", - } - - return self.api_client.call_api( - "/info/cities", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/cities", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_cost_centers( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListCostCentersResponse: # noqa: E501 - """List Cost Centers # noqa: E501 - - Lists the cost centers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCostCentersResponse: + """List Cost Centers - >>> thread = api.list_cost_centers(company_id, async_req=True) - >>> result = thread.get() + Lists the cost centers. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListCostCentersResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_cost_centers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_cost_centers_with_http_info(company_id, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_cost_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCostCentersResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_cost_centers_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Cost Centers # noqa: E501 - - Lists the cost centers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCostCentersResponse]: + """List Cost Centers - >>> thread = api.list_cost_centers_with_http_info(company_id, async_req=True) - >>> result = thread.get() + Lists the cost centers. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListCostCentersResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_cost_centers" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 + """ # noqa: E501 + + _param = self._list_cost_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { "200": "ListCostCentersResponse", "401": None, "404": None, } - - return self.api_client.call_api( - "/c/{company_id}/info/cost_centers", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - def list_countries(self, **kwargs) -> ListCountriesResponse: # noqa: E501 - """List Countries # noqa: E501 - - Lists the supported countries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_cost_centers_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Cost Centers - >>> thread = api.list_countries(async_req=True) - >>> result = thread.get() + Lists the cost centers. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListCountriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_countries_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_countries_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_countries_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """List Countries # noqa: E501 - - Lists the supported countries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_countries_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param company_id: The ID of the company. (required) + :type company_id: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListCountriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_countries" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_cost_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCostCentersResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_cost_centers_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListCountriesResponse", - "401": None, - } - - return self.api_client.call_api( - "/info/countries", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/cost_centers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - def list_currencies(self, **kwargs) -> ListCurrenciesResponse: # noqa: E501 - """List Currencies # noqa: E501 - - Lists the supported currencies. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_countries( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCountriesResponse: + """List Countries - >>> thread = api.list_currencies(async_req=True) - >>> result = thread.get() + Lists the supported countries. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListCurrenciesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_currencies_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_currencies_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_currencies_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """List Currencies # noqa: E501 - - Lists the supported currencies. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_currencies_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListCurrenciesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_currencies" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + """ # noqa: E501 - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 + _param = self._list_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "ListCurrenciesResponse", + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCountriesResponse", "401": None, } - - return self.api_client.call_api( - "/info/currencies", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_countries_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCountriesResponse]: + """List Countries + + Lists the supported countries. - @validate_arguments - def list_delivery_notes_default_causals( - self, **kwargs - ) -> ListDeliveryNotesDefaultCausalsResponse: # noqa: E501 - """List Delivery Notes Default Causals # noqa: E501 - - Lists the delivery note default causals. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_delivery_notes_default_causals(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListDeliveryNotesDefaultCausalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_delivery_notes_default_causals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_delivery_notes_default_causals_with_http_info( - **kwargs - ) # noqa: E501 - - @validate_arguments - def list_delivery_notes_default_causals_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """List Delivery Notes Default Causals # noqa: E501 - - Lists the delivery note default causals. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_delivery_notes_default_causals_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListDeliveryNotesDefaultCausalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_notes_default_causals" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 + """ # noqa: E501 - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 + _param = self._list_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "ListDeliveryNotesDefaultCausalsResponse", + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCountriesResponse", "401": None, } - - return self.api_client.call_api( - "/info/dn_causals", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - def list_detailed_countries( - self, **kwargs - ) -> ListDetailedCountriesResponse: # noqa: E501 - """List Detailed Countries # noqa: E501 - - Lists the supported countries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_detailed_countries(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListDetailedCountriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_detailed_countries_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_detailed_countries_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_detailed_countries_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """List Detailed Countries # noqa: E501 - - Lists the supported countries. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_detailed_countries_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + @validate_call + def list_countries_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Countries + + Lists the supported countries. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListDetailedCountriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_detailed_countries" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._list_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCountriesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_countries_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListDetailedCountriesResponse", - "401": None, - } - - return self.api_client.call_api( - "/info/detailed_countries", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/countries", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - def list_languages(self, **kwargs) -> ListLanguagesResponse: # noqa: E501 - """List Languages # noqa: E501 + @validate_call + def list_currencies( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListCurrenciesResponse: + """List Currencies + + Lists the supported currencies. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_currencies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCurrenciesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_currencies_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListCurrenciesResponse]: + """List Currencies + + Lists the supported currencies. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_currencies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCurrenciesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_currencies_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Currencies - Lists the supported languages. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Lists the supported currencies. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_currencies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListCurrenciesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_currencies_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/currencies", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_delivery_notes_default_causals( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListDeliveryNotesDefaultCausalsResponse: + """List Delivery Notes Default Causals + + Lists the delivery note default causals. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_delivery_notes_default_causals_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDeliveryNotesDefaultCausalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_delivery_notes_default_causals_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListDeliveryNotesDefaultCausalsResponse]: + """List Delivery Notes Default Causals + + Lists the delivery note default causals. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_delivery_notes_default_causals_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDeliveryNotesDefaultCausalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_delivery_notes_default_causals_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Delivery Notes Default Causals + + Lists the delivery note default causals. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_delivery_notes_default_causals_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDeliveryNotesDefaultCausalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_delivery_notes_default_causals_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/dn_causals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_detailed_countries( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListDetailedCountriesResponse: + """List Detailed Countries + + Lists the supported countries. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detailed_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDetailedCountriesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_detailed_countries_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListDetailedCountriesResponse]: + """List Detailed Countries + + Lists the supported countries. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detailed_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDetailedCountriesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_detailed_countries_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Detailed Countries + + Lists the supported countries. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_detailed_countries_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListDetailedCountriesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_detailed_countries_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/detailed_countries", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_languages( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListLanguagesResponse: + """List Languages + + Lists the supported languages. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_languages_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListLanguagesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_languages_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListLanguagesResponse]: + """List Languages + + Lists the supported languages. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_languages_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListLanguagesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_languages_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Languages + + Lists the supported languages. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_languages_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListLanguagesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_languages_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/languages", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def list_payment_accounts( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListPaymentAccountsResponse: + """List Payment Accounts - >>> thread = api.list_languages(async_req=True) - >>> result = thread.get() + Lists the available payment accounts. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListLanguagesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_languages_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_languages_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_languages_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """List Languages # noqa: E501 - - Lists the supported languages. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_languages_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListLanguagesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_languages" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 + """ # noqa: E501 + + _param = self._list_payment_accounts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "ListLanguagesResponse", + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentAccountsResponse", "401": None, + "404": None, } - - return self.api_client.call_api( - "/info/languages", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - def list_payment_accounts( + @validate_call + def list_payment_accounts_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -1274,16 +2079,21 @@ def list_payment_accounts( description="List of comma-separated fields for result sorting (minus for desc sorting)." ), ] = None, - **kwargs - ) -> ListPaymentAccountsResponse: # noqa: E501 - """List Payment Accounts # noqa: E501 - - Lists the available payment accounts. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListPaymentAccountsResponse]: + """List Payment Accounts - >>> thread = api.list_payment_accounts(company_id, fields, fieldset, sort, async_req=True) - >>> result = thread.get() + Lists the available payment accounts. :param company_id: The ID of the company. (required) :type company_id: int @@ -1293,31 +2103,57 @@ def list_payment_accounts( :type fieldset: str :param sort: List of comma-separated fields for result sorting (minus for desc sorting). :type sort: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListPaymentAccountsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_payment_accounts_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_payment_accounts_with_http_info( - company_id, fields, fieldset, sort, **kwargs - ) # noqa: E501 - - @validate_arguments - def list_payment_accounts_with_http_info( + """ # noqa: E501 + + _param = self._list_payment_accounts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentAccountsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_payment_accounts_without_preload_content( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -1330,16 +2166,21 @@ def list_payment_accounts_with_http_info( description="List of comma-separated fields for result sorting (minus for desc sorting)." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Payment Accounts # noqa: E501 - - Lists the available payment accounts. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Payment Accounts - >>> thread = api.list_payment_accounts_with_http_info(company_id, fields, fieldset, sort, async_req=True) - >>> result = thread.get() + Lists the available payment accounts. :param company_id: The ID of the company. (required) :type company_id: int @@ -1349,120 +2190,115 @@ def list_payment_accounts_with_http_info( :type fieldset: str :param sort: List of comma-separated fields for result sorting (minus for desc sorting). :type sort: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListPaymentAccountsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "fields", "fieldset", "sort"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_payment_accounts" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_payment_accounts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentAccountsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_payment_accounts_serialize( + self, + company_id, + fields, + fieldset, + sort, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListPaymentAccountsResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/payment_accounts", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/payment_accounts", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_payment_methods( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -1475,16 +2311,21 @@ def list_payment_methods( description="List of comma-separated fields for result sorting (minus for desc sorting)." ), ] = None, - **kwargs - ) -> ListPaymentMethodsResponse: # noqa: E501 - """List Payment Methods # noqa: E501 - - Lists the available payment methods. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListPaymentMethodsResponse: + """List Payment Methods - >>> thread = api.list_payment_methods(company_id, fields, fieldset, sort, async_req=True) - >>> result = thread.get() + Lists the available payment methods. :param company_id: The ID of the company. (required) :type company_id: int @@ -1494,31 +2335,57 @@ def list_payment_methods( :type fieldset: str :param sort: List of comma-separated fields for result sorting (minus for desc sorting). :type sort: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListPaymentMethodsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_payment_methods_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_payment_methods_with_http_info( - company_id, fields, fieldset, sort, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_payment_methods_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentMethodsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_payment_methods_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -1531,16 +2398,108 @@ def list_payment_methods_with_http_info( description="List of comma-separated fields for result sorting (minus for desc sorting)." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Payment Methods # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListPaymentMethodsResponse]: + """List Payment Methods + + Lists the available payment methods. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_payment_methods_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the available payment methods. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentMethodsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_payment_methods_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Payment Methods - >>> thread = api.list_payment_methods_with_http_info(company_id, fields, fieldset, sort, async_req=True) - >>> result = thread.get() + Lists the available payment methods. :param company_id: The ID of the company. (required) :type company_id: int @@ -1550,594 +2509,854 @@ def list_payment_methods_with_http_info( :type fieldset: str :param sort: List of comma-separated fields for result sorting (minus for desc sorting). :type sort: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListPaymentMethodsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "fields", "fieldset", "sort"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_payment_methods" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_payment_methods_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPaymentMethodsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_payment_methods_serialize( + self, + company_id, + fields, + fieldset, + sort, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListPaymentMethodsResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/payment_methods", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/payment_methods", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_product_categories( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - context: Annotated[ - StrictStr, Field(..., description="Categories resource type.") - ], - **kwargs - ) -> ListProductCategoriesResponse: # noqa: E501 - """List Product Categories # noqa: E501 - - Lists the product categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + context: Annotated[StrictStr, Field(description="Categories resource type.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListProductCategoriesResponse: + """List Product Categories - >>> thread = api.list_product_categories(company_id, context, async_req=True) - >>> result = thread.get() + Lists the product categories. :param company_id: The ID of the company. (required) :type company_id: int :param context: Categories resource type. (required) :type context: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListProductCategoriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_product_categories_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_product_categories_with_http_info( - company_id, context, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_product_categories_serialize( + company_id=company_id, + context=context, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_product_categories_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - context: Annotated[ - StrictStr, Field(..., description="Categories resource type.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Product Categories # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + context: Annotated[StrictStr, Field(description="Categories resource type.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListProductCategoriesResponse]: + """List Product Categories + + Lists the product categories. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param context: Categories resource type. (required) + :type context: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_product_categories_serialize( + company_id=company_id, + context=context, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the product categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_product_categories_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + context: Annotated[StrictStr, Field(description="Categories resource type.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Product Categories - >>> thread = api.list_product_categories_with_http_info(company_id, context, async_req=True) - >>> result = thread.get() + Lists the product categories. :param company_id: The ID of the company. (required) :type company_id: int :param context: Categories resource type. (required) :type context: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListProductCategoriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "context"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_product_categories" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_product_categories_serialize( + company_id=company_id, + context=context, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductCategoriesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_product_categories_serialize( + self, + company_id, + context, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("context") is not None: # noqa: E501 - _query_params.append(("context", _params["context"])) + if context is not None: + _query_params.append(("context", context)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListProductCategoriesResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/product_categories", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/product_categories", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_received_document_categories( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListReceivedDocumentCategoriesResponse: # noqa: E501 - """List Received Document Categories # noqa: E501 - - Lists the received document categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListReceivedDocumentCategoriesResponse: + """List Received Document Categories - >>> thread = api.list_received_document_categories(company_id, async_req=True) - >>> result = thread.get() + Lists the received document categories. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListReceivedDocumentCategoriesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_received_document_categories_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_received_document_categories_with_http_info( - company_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_received_document_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentCategoriesResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_received_document_categories_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Received Document Categories # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListReceivedDocumentCategoriesResponse]: + """List Received Document Categories + + Lists the received document categories. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_received_document_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentCategoriesResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the received document categories. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_received_document_categories_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Received Document Categories - >>> thread = api.list_received_document_categories_with_http_info(company_id, async_req=True) - >>> result = thread.get() + Lists the received document categories. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListReceivedDocumentCategoriesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_received_document_categories" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_received_document_categories_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentCategoriesResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_received_document_categories_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListReceivedDocumentCategoriesResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/info/received_document_categories", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/received_document_categories", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_revenue_centers( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListRevenueCentersResponse: # noqa: E501 - """List Revenue Centers # noqa: E501 - - Lists the revenue centers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListRevenueCentersResponse: + """List Revenue Centers - >>> thread = api.list_revenue_centers(company_id, async_req=True) - >>> result = thread.get() + Lists the revenue centers. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListRevenueCentersResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_revenue_centers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_revenue_centers_with_http_info( - company_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_revenue_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListRevenueCentersResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_revenue_centers_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Revenue Centers # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListRevenueCentersResponse]: + """List Revenue Centers + + Lists the revenue centers. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_revenue_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListRevenueCentersResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the revenue centers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_revenue_centers_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Revenue Centers - >>> thread = api.list_revenue_centers_with_http_info(company_id, async_req=True) - >>> result = thread.get() + Lists the revenue centers. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListRevenueCentersResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_revenue_centers" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_revenue_centers_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListRevenueCentersResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_revenue_centers_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListRevenueCentersResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/revenue_centers", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/revenue_centers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_templates( self, type: Annotated[ @@ -2149,39 +3368,71 @@ def list_templates( description="[Only if type=all] If true, splits the list in objects, grouping templates by type." ), ] = None, - **kwargs - ) -> ListTemplatesResponse: # noqa: E501 - """List Templates # noqa: E501 - - Lists the available templates. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListTemplatesResponse: + """List Templates - >>> thread = api.list_templates(type, by_type, async_req=True) - >>> result = thread.get() + Lists the available templates. :param type: Type of the templates. :type type: str :param by_type: [Only if type=all] If true, splits the list in objects, grouping templates by type. :type by_type: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListTemplatesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_templates_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_templates_with_http_info(type, by_type, **kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_templates_serialize( + type=type, + by_type=by_type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListTemplatesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_templates_with_http_info( self, type: Annotated[ @@ -2193,427 +3444,685 @@ def list_templates_with_http_info( description="[Only if type=all] If true, splits the list in objects, grouping templates by type." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Templates # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListTemplatesResponse]: + """List Templates + + Lists the available templates. + + :param type: Type of the templates. + :type type: str + :param by_type: [Only if type=all] If true, splits the list in objects, grouping templates by type. + :type by_type: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_templates_serialize( + type=type, + by_type=by_type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListTemplatesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the available templates. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_templates_without_preload_content( + self, + type: Annotated[ + Optional[StrictStr], Field(description="Type of the templates.") + ] = None, + by_type: Annotated[ + Optional[StrictBool], + Field( + description="[Only if type=all] If true, splits the list in objects, grouping templates by type." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Templates - >>> thread = api.list_templates_with_http_info(type, by_type, async_req=True) - >>> result = thread.get() + Lists the available templates. :param type: Type of the templates. :type type: str :param by_type: [Only if type=all] If true, splits the list in objects, grouping templates by type. :type by_type: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListTemplatesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["type", "by_type"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_templates" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_templates_serialize( + type=type, + by_type=by_type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListTemplatesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_templates_serialize( + self, + type, + by_type, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) - if _params.get("by_type") is not None: # noqa: E501 - _query_params.append(("by_type", _params["by_type"])) + if by_type is not None: + _query_params.append(("by_type", by_type)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListTemplatesResponse", - "401": None, - } - - return self.api_client.call_api( - "/info/templates", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/templates", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_units_of_measure( - self, **kwargs - ) -> ListUnitsOfMeasureResponse: # noqa: E501 - """List Units of Measure # noqa: E501 - - Lists the units of measure. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_units_of_measure(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListUnitsOfMeasureResponse: + """List Units of Measure + + Lists the units of measure. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListUnitsOfMeasureResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_units_of_measure_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_units_of_measure_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_units_of_measure_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUnitsOfMeasureResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_units_of_measure_with_http_info( - self, **kwargs - ) -> ApiResponse: # noqa: E501 - """List Units of Measure # noqa: E501 - - Lists the units of measure. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_units_of_measure_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListUnitsOfMeasureResponse]: + """List Units of Measure + + Lists the units of measure. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListUnitsOfMeasureResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_units_of_measure" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 - # process the path parameters - _path_params = {} + _param = self._list_units_of_measure_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUnitsOfMeasureResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_units_of_measure_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Units of Measure + + Lists the units of measure. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_units_of_measure_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUnitsOfMeasureResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_units_of_measure_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListUnitsOfMeasureResponse", - "401": None, - } - - return self.api_client.call_api( - "/info/measures", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/info/measures", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_vat_types( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ListVatTypesResponse: # noqa: E501 - """List Vat Types # noqa: E501 - - Lists the available vat types. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListVatTypesResponse: + """List Vat Types - >>> thread = api.list_vat_types(company_id, fieldset, async_req=True) - >>> result = thread.get() + Lists the available vat types. :param company_id: The ID of the company. (required) :type company_id: int :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListVatTypesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_vat_types_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_vat_types_with_http_info( - company_id, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_vat_types_serialize( + company_id=company_id, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListVatTypesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_vat_types_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Vat Types # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListVatTypesResponse]: + """List Vat Types + + Lists the available vat types. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_vat_types_serialize( + company_id=company_id, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the available vat types. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListVatTypesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_vat_types_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Vat Types - >>> thread = api.list_vat_types_with_http_info(company_id, fieldset, async_req=True) - >>> result = thread.get() + Lists the available vat types. :param company_id: The ID of the company. (required) :type company_id: int :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListVatTypesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_vat_types" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_vat_types_serialize( + company_id=company_id, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListVatTypesResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_vat_types_serialize( + self, + company_id, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListVatTypesResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/info/vat_types", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/info/vat_types", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/issued_documents_api.py b/fattureincloud_python_sdk/api/issued_documents_api.py index dd96d75a..ca823128 100644 --- a/fattureincloud_python_sdk/api/issued_documents_api.py +++ b/fattureincloud_python_sdk/api/issued_documents_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBytes, StrictInt, StrictStr, conint +from pydantic import StrictBytes, StrictInt, StrictStr, field_validator from typing import Optional, Union @@ -73,10 +79,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class IssuedDocumentsApi: @@ -91,693 +94,1035 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_issued_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_issued_document_request: Annotated[ Optional[CreateIssuedDocumentRequest], Field(description="The Issued Document"), ] = None, - **kwargs - ) -> CreateIssuedDocumentResponse: # noqa: E501 - """Create Issued Document # noqa: E501 - - Creates a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateIssuedDocumentResponse: + """Create Issued Document - >>> thread = api.create_issued_document(company_id, create_issued_document_request, async_req=True) - >>> result = thread.get() + Creates a new document. :param company_id: The ID of the company. (required) :type company_id: int :param create_issued_document_request: The Issued Document :type create_issued_document_request: CreateIssuedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateIssuedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_issued_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_issued_document_with_http_info( - company_id, create_issued_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_issued_document_serialize( + company_id=company_id, + create_issued_document_request=create_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateIssuedDocumentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_issued_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_issued_document_request: Annotated[ Optional[CreateIssuedDocumentRequest], Field(description="The Issued Document"), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Issued Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateIssuedDocumentResponse]: + """Create Issued Document + + Creates a new document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_issued_document_request: The Issued Document + :type create_issued_document_request: CreateIssuedDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_issued_document_serialize( + company_id=company_id, + create_issued_document_request=create_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateIssuedDocumentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_issued_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_issued_document_request: Annotated[ + Optional[CreateIssuedDocumentRequest], + Field(description="The Issued Document"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Issued Document - >>> thread = api.create_issued_document_with_http_info(company_id, create_issued_document_request, async_req=True) - >>> result = thread.get() + Creates a new document. :param company_id: The ID of the company. (required) :type company_id: int :param create_issued_document_request: The Issued Document :type create_issued_document_request: CreateIssuedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateIssuedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_issued_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_issued_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_issued_document_serialize( + company_id=company_id, + create_issued_document_request=create_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateIssuedDocumentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_issued_document_serialize( + self, + company_id, + create_issued_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_issued_document_request"] is not None: - _body_params = _params["create_issued_document_request"] + if create_issued_document_request is not None: + _body_params = create_issued_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateIssuedDocumentResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_issued_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Issued Document # noqa: E501 - - Deletes the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Issued Document - >>> thread = api.delete_issued_document(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_issued_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_issued_document_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_issued_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_issued_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Issued Document # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Issued Document + + Deletes the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_issued_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Deletes the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_issued_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Issued Document - >>> thread = api.delete_issued_document_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_issued_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_issued_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _delete_issued_document_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/issued_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_issued_document_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Issued Document Attachment # noqa: E501 - - Removes the attachment of the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Issued Document Attachment - >>> thread = api.delete_issued_document_attachment(company_id, document_id, async_req=True) - >>> result = thread.get() + Removes the attachment of the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_issued_document_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_issued_document_attachment_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_issued_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_issued_document_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Issued Document Attachment # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Issued Document Attachment + + Removes the attachment of the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_issued_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Removes the attachment of the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_issued_document_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Issued Document Attachment - >>> thread = api.delete_issued_document_attachment_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Removes the attachment of the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_issued_document_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_issued_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _delete_issued_document_attachment_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/attachment", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/issued_documents/{document_id}/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_email_data( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> GetEmailDataResponse: # noqa: E501 - """Get Email Data # noqa: E501 - - Gets the pre-compiled email details. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetEmailDataResponse: + """Get Email Data - >>> thread = api.get_email_data(company_id, document_id, async_req=True) - >>> result = thread.get() + Gets the pre-compiled email details. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetEmailDataResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_email_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_email_data_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_email_data_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "GetEmailDataResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_email_data_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Email Data # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetEmailDataResponse]: + """Get Email Data + + Gets the pre-compiled email details. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_email_data_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Gets the pre-compiled email details. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {"200": "GetEmailDataResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_email_data_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Email Data - >>> thread = api.get_email_data_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Gets the pre-compiled email details. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetEmailDataResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_email_data" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_email_data_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {"200": "GetEmailDataResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_email_data_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetEmailDataResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/email", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/{document_id}/email", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_existing_issued_document_totals( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], get_existing_issued_document_totals_request: Optional[ GetExistingIssuedDocumentTotalsRequest ] = None, - **kwargs - ) -> GetExistingIssuedDocumentTotalsResponse: # noqa: E501 - """Get Existing Issued Document Totals # noqa: E501 - - Returns the totals for a specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetExistingIssuedDocumentTotalsResponse: + """Get Existing Issued Document Totals - >>> thread = api.get_existing_issued_document_totals(company_id, document_id, get_existing_issued_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for a specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -785,50 +1130,75 @@ def get_existing_issued_document_totals( :type document_id: int :param get_existing_issued_document_totals_request: :type get_existing_issued_document_totals_request: GetExistingIssuedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetExistingIssuedDocumentTotalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_existing_issued_document_totals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_existing_issued_document_totals_with_http_info( - company_id, - document_id, - get_existing_issued_document_totals_request, - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_existing_issued_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_issued_document_totals_request=get_existing_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetExistingIssuedDocumentTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_existing_issued_document_totals_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], get_existing_issued_document_totals_request: Optional[ GetExistingIssuedDocumentTotalsRequest ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Existing Issued Document Totals # noqa: E501 - - Returns the totals for a specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetExistingIssuedDocumentTotalsResponse]: + """Get Existing Issued Document Totals - >>> thread = api.get_existing_issued_document_totals_with_http_info(company_id, document_id, get_existing_issued_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for a specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -836,148 +1206,216 @@ def get_existing_issued_document_totals_with_http_info( :type document_id: int :param get_existing_issued_document_totals_request: :type get_existing_issued_document_totals_request: GetExistingIssuedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetExistingIssuedDocumentTotalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "document_id", - "get_existing_issued_document_totals_request", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_existing_issued_document_totals" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["get_existing_issued_document_totals_request"] is not None: - _body_params = _params["get_existing_issued_document_totals_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + """ # noqa: E501 + + _param = self._get_existing_issued_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_issued_document_totals_request=get_existing_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { "200": "GetExistingIssuedDocumentTotalsResponse", "401": None, "404": None, } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/totals", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - def get_issued_document( + @validate_call + def get_existing_issued_document_totals_without_preload_content( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + get_existing_issued_document_totals_request: Optional[ + GetExistingIssuedDocumentTotalsRequest + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Existing Issued Document Totals + + Returns the totals for a specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param get_existing_issued_document_totals_request: + :type get_existing_issued_document_totals_request: GetExistingIssuedDocumentTotalsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_existing_issued_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_issued_document_totals_request=get_existing_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetExistingIssuedDocumentTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_existing_issued_document_totals_serialize( + self, + company_id, + document_id, + get_existing_issued_document_totals_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if get_existing_issued_document_totals_request is not None: + _body_params = get_existing_issued_document_totals_request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents/{document_id}/totals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_issued_document( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetIssuedDocumentResponse: # noqa: E501 - """Get Issued Document # noqa: E501 - - Gets the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetIssuedDocumentResponse: + """Get Issued Document - >>> thread = api.get_issued_document(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -987,50 +1425,161 @@ def get_issued_document( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetIssuedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_issued_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_issued_document_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_issued_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_issued_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Issued Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetIssuedDocumentResponse]: + """Get Issued Document - Gets the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the specified document. - >>> thread = api.get_issued_document_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_issued_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_issued_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Issued Document + + Gets the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -1040,478 +1589,666 @@ def get_issued_document_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetIssuedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_issued_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_issued_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_issued_document_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetIssuedDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_issued_document_pre_create_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the issued document.") + StrictStr, Field(description="The type of the issued document.") ], - **kwargs - ) -> GetIssuedDocumentPreCreateInfoResponse: # noqa: E501 - """Get Issued Document Pre-Create Info # noqa: E501 - - Retrieves the information useful while creating a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetIssuedDocumentPreCreateInfoResponse: + """Get Issued Document Pre-Create Info - >>> thread = api.get_issued_document_pre_create_info(company_id, type, async_req=True) - >>> result = thread.get() + Retrieves the information useful while creating a new document. :param company_id: The ID of the company. (required) :type company_id: int :param type: The type of the issued document. (required) :type type: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetIssuedDocumentPreCreateInfoResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_issued_document_pre_create_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_issued_document_pre_create_info_with_http_info( - company_id, type, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_issued_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_issued_document_pre_create_info_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the issued document.") + StrictStr, Field(description="The type of the issued document.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Issued Document Pre-Create Info # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetIssuedDocumentPreCreateInfoResponse]: + """Get Issued Document Pre-Create Info + + Retrieves the information useful while creating a new document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param type: The type of the issued document. (required) + :type type: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_issued_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Retrieves the information useful while creating a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_issued_document_pre_create_info_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[ + StrictStr, Field(description="The type of the issued document.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Issued Document Pre-Create Info - >>> thread = api.get_issued_document_pre_create_info_with_http_info(company_id, type, async_req=True) - >>> result = thread.get() + Retrieves the information useful while creating a new document. :param company_id: The ID of the company. (required) :type company_id: int :param type: The type of the issued document. (required) :type type: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetIssuedDocumentPreCreateInfoResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "type"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_issued_document_pre_create_info" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_issued_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetIssuedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_issued_document_pre_create_info_serialize( + self, + company_id, + type, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetIssuedDocumentPreCreateInfoResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/info", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_new_issued_document_totals( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], get_new_issued_document_totals_request: Optional[ GetNewIssuedDocumentTotalsRequest ] = None, - **kwargs - ) -> GetNewIssuedDocumentTotalsResponse: # noqa: E501 - """Get New Issued Document Totals # noqa: E501 - - Returns the totals for a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetNewIssuedDocumentTotalsResponse: + """Get New Issued Document Totals - >>> thread = api.get_new_issued_document_totals(company_id, get_new_issued_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for a new document. :param company_id: The ID of the company. (required) :type company_id: int :param get_new_issued_document_totals_request: :type get_new_issued_document_totals_request: GetNewIssuedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetNewIssuedDocumentTotalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_new_issued_document_totals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_new_issued_document_totals_with_http_info( - company_id, get_new_issued_document_totals_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_new_issued_document_totals_serialize( + company_id=company_id, + get_new_issued_document_totals_request=get_new_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetNewIssuedDocumentTotalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_new_issued_document_totals_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], get_new_issued_document_totals_request: Optional[ GetNewIssuedDocumentTotalsRequest ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get New Issued Document Totals # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetNewIssuedDocumentTotalsResponse]: + """Get New Issued Document Totals - Returns the totals for a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Returns the totals for a new document. - >>> thread = api.get_new_issued_document_totals_with_http_info(company_id, get_new_issued_document_totals_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param get_new_issued_document_totals_request: + :type get_new_issued_document_totals_request: GetNewIssuedDocumentTotalsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_new_issued_document_totals_serialize( + company_id=company_id, + get_new_issued_document_totals_request=get_new_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetNewIssuedDocumentTotalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_new_issued_document_totals_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + get_new_issued_document_totals_request: Optional[ + GetNewIssuedDocumentTotalsRequest + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get New Issued Document Totals + + Returns the totals for a new document. :param company_id: The ID of the company. (required) :type company_id: int :param get_new_issued_document_totals_request: :type get_new_issued_document_totals_request: GetNewIssuedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetNewIssuedDocumentTotalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "get_new_issued_document_totals_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_new_issued_document_totals" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_new_issued_document_totals_serialize( + company_id=company_id, + get_new_issued_document_totals_request=get_new_issued_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetNewIssuedDocumentTotalsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_new_issued_document_totals_serialize( + self, + company_id, + get_new_issued_document_totals_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["get_new_issued_document_totals_request"] is not None: - _body_params = _params["get_new_issued_document_totals_request"] + if get_new_issued_document_totals_request is not None: + _body_params = get_new_issued_document_totals_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetNewIssuedDocumentTotalsResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/totals", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents/totals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def join_issued_documents( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - ids: Annotated[StrictStr, Field(..., description="Ids of the documents.")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + ids: Annotated[StrictStr, Field(description="Ids of the documents.")], group: Annotated[Optional[StrictInt], Field(description="Group items.")] = None, e_invoice: Annotated[ Optional[StrictInt], Field(description="New document e_invoice.") ] = None, - **kwargs - ) -> JoinIssuedDocumentsResponse: # noqa: E501 - """Join Issued Documents # noqa: E501 - - Joins issued documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> JoinIssuedDocumentsResponse: + """Join Issued Documents - >>> thread = api.join_issued_documents(company_id, ids, group, e_invoice, async_req=True) - >>> result = thread.get() + Joins issued documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1521,46 +2258,153 @@ def join_issued_documents( :type group: int :param e_invoice: New document e_invoice. :type e_invoice: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: JoinIssuedDocumentsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the join_issued_documents_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.join_issued_documents_with_http_info( - company_id, ids, group, e_invoice, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._join_issued_documents_serialize( + company_id=company_id, + ids=ids, + group=group, + e_invoice=e_invoice, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "JoinIssuedDocumentsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def join_issued_documents_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - ids: Annotated[StrictStr, Field(..., description="Ids of the documents.")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + ids: Annotated[StrictStr, Field(description="Ids of the documents.")], group: Annotated[Optional[StrictInt], Field(description="Group items.")] = None, e_invoice: Annotated[ Optional[StrictInt], Field(description="New document e_invoice.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Join Issued Documents # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[JoinIssuedDocumentsResponse]: + """Join Issued Documents + + Joins issued documents. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param ids: Ids of the documents. (required) + :type ids: str + :param group: Group items. + :type group: int + :param e_invoice: New document e_invoice. + :type e_invoice: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._join_issued_documents_serialize( + company_id=company_id, + ids=ids, + group=group, + e_invoice=e_invoice, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Joins issued documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "JoinIssuedDocumentsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.join_issued_documents_with_http_info(company_id, ids, group, e_invoice, async_req=True) - >>> result = thread.get() + @validate_call + def join_issued_documents_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + ids: Annotated[StrictStr, Field(description="Ids of the documents.")], + group: Annotated[Optional[StrictInt], Field(description="Group items.")] = None, + e_invoice: Annotated[ + Optional[StrictInt], Field(description="New document e_invoice.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Join Issued Documents + + Joins issued documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1570,120 +2414,115 @@ def join_issued_documents_with_http_info( :type group: int :param e_invoice: New document e_invoice. :type e_invoice: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(JoinIssuedDocumentsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "ids", "group", "e_invoice"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method join_issued_documents" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._join_issued_documents_serialize( + company_id=company_id, + ids=ids, + group=group, + e_invoice=e_invoice, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "JoinIssuedDocumentsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _join_issued_documents_serialize( + self, + company_id, + ids, + group, + e_invoice, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("ids") is not None: # noqa: E501 - _query_params.append(("ids", _params["ids"])) + if ids is not None: + _query_params.append(("ids", ids)) - if _params.get("group") is not None: # noqa: E501 - _query_params.append(("group", _params["group"])) + if group is not None: + _query_params.append(("group", group)) - if _params.get("e_invoice") is not None: # noqa: E501 - _query_params.append(("e_invoice", _params["e_invoice"])) + if e_invoice is not None: + _query_params.append(("e_invoice", e_invoice)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "JoinIssuedDocumentsResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/join", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/join", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_issued_documents( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the issued document.") + StrictStr, Field(description="The type of the issued document.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1701,7 +2540,7 @@ def list_issued_documents( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ @@ -1713,16 +2552,21 @@ def list_issued_documents( description="(Only for type = delivery_notes) Include invoices delivery notes." ), ] = None, - **kwargs - ) -> ListIssuedDocumentsResponse: # noqa: E501 - """List Issued Documents # noqa: E501 - - Lists the issued documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListIssuedDocumentsResponse: + """List Issued Documents - >>> thread = api.list_issued_documents(company_id, type, fields, fieldset, sort, page, per_page, q, inclusive, async_req=True) - >>> result = thread.get() + Lists the issued documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1742,42 +2586,64 @@ def list_issued_documents( :type q: str :param inclusive: (Only for type = delivery_notes) Include invoices delivery notes. :type inclusive: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListIssuedDocumentsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_issued_documents_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_issued_documents_with_http_info( - company_id, - type, - fields, - fieldset, - sort, - page, - per_page, - q, - inclusive, - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_issued_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + inclusive=inclusive, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListIssuedDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_issued_documents_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the issued document.") + StrictStr, Field(description="The type of the issued document.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1795,7 +2661,7 @@ def list_issued_documents_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ @@ -1807,16 +2673,142 @@ def list_issued_documents_with_http_info( description="(Only for type = delivery_notes) Include invoices delivery notes." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Issued Documents # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListIssuedDocumentsResponse]: + """List Issued Documents + + Lists the issued documents. - Lists the issued documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param company_id: The ID of the company. (required) + :type company_id: int + :param type: The type of the issued document. (required) + :type type: str + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param inclusive: (Only for type = delivery_notes) Include invoices delivery notes. + :type inclusive: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_issued_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + inclusive=inclusive, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListIssuedDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_issued_documents_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[ + StrictStr, Field(description="The type of the issued document.") + ], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + inclusive: Annotated[ + Optional[StrictInt], + Field( + description="(Only for type = delivery_notes) Include invoices delivery notes." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Issued Documents - >>> thread = api.list_issued_documents_with_http_info(company_id, type, fields, fieldset, sort, page, per_page, q, inclusive, async_req=True) - >>> result = thread.get() + Lists the issued documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1836,162 +2828,237 @@ def list_issued_documents_with_http_info( :type q: str :param inclusive: (Only for type = delivery_notes) Include invoices delivery notes. :type inclusive: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListIssuedDocumentsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "type", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - "inclusive", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_issued_documents" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_issued_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + inclusive=inclusive, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListIssuedDocumentsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_issued_documents_serialize( + self, + company_id, + type, + fields, + fieldset, + sort, + page, + per_page, + q, + inclusive, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) - if _params.get("inclusive") is not None: # noqa: E501 - _query_params.append(("inclusive", _params["inclusive"])) + if inclusive is not None: + _query_params.append(("inclusive", inclusive)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def modify_issued_document( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + modify_issued_document_request: Annotated[ + Optional[ModifyIssuedDocumentRequest], + Field(description="The modified document"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyIssuedDocumentResponse: + """Modify Issued Document + + Modifies the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param modify_issued_document_request: The modified document + :type modify_issued_document_request: ModifyIssuedDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_issued_document_serialize( + company_id=company_id, + document_id=document_id, + modify_issued_document_request=modify_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - _response_types_map = { - "200": "ListIssuedDocumentsResponse", + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyIssuedDocumentResponse", "401": None, "404": None, } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - @validate_arguments - def modify_issued_document( + @validate_call + def modify_issued_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_issued_document_request: Annotated[ Optional[ModifyIssuedDocumentRequest], Field(description="The modified document"), ] = None, - **kwargs - ) -> ModifyIssuedDocumentResponse: # noqa: E501 - """Modify Issued Document # noqa: E501 - - Modifies the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyIssuedDocumentResponse]: + """Modify Issued Document - >>> thread = api.modify_issued_document(company_id, document_id, modify_issued_document_request, async_req=True) - >>> result = thread.get() + Modifies the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -1999,48 +3066,76 @@ def modify_issued_document( :type document_id: int :param modify_issued_document_request: The modified document :type modify_issued_document_request: ModifyIssuedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyIssuedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_issued_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_issued_document_with_http_info( - company_id, document_id, modify_issued_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments - def modify_issued_document_with_http_info( + """ # noqa: E501 + + _param = self._modify_issued_document_serialize( + company_id=company_id, + document_id=document_id, + modify_issued_document_request=modify_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyIssuedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_issued_document_without_preload_content( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_issued_document_request: Annotated[ Optional[ModifyIssuedDocumentRequest], Field(description="The modified document"), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Issued Document # noqa: E501 - - Modifies the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Issued Document - >>> thread = api.modify_issued_document_with_http_info(company_id, document_id, modify_issued_document_request, async_req=True) - >>> result = thread.get() + Modifies the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -2048,141 +3143,137 @@ def modify_issued_document_with_http_info( :type document_id: int :param modify_issued_document_request: The modified document :type modify_issued_document_request: ModifyIssuedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyIssuedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_issued_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_issued_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_issued_document_serialize( + company_id=company_id, + document_id=document_id, + modify_issued_document_request=modify_issued_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyIssuedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _modify_issued_document_serialize( + self, + company_id, + document_id, + modify_issued_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_issued_document_request"] is not None: - _body_params = _params["modify_issued_document_request"] + if modify_issued_document_request is not None: + _body_params = modify_issued_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyIssuedDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/issued_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def schedule_email( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], schedule_email_request: Annotated[ Optional[ScheduleEmailRequest], Field(description="Email Schedule") ] = None, - **kwargs - ) -> None: # noqa: E501 - """Schedule Email # noqa: E501 - - Schedules the sending of a document by email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Schedule Email - >>> thread = api.schedule_email(company_id, document_id, schedule_email_request, async_req=True) - >>> result = thread.get() + Schedules the sending of a document by email. :param company_id: The ID of the company. (required) :type company_id: int @@ -2190,47 +3281,143 @@ def schedule_email( :type document_id: int :param schedule_email_request: Email Schedule :type schedule_email_request: ScheduleEmailRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the schedule_email_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.schedule_email_with_http_info( - company_id, document_id, schedule_email_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._schedule_email_serialize( + company_id=company_id, + document_id=document_id, + schedule_email_request=schedule_email_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def schedule_email_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], schedule_email_request: Annotated[ Optional[ScheduleEmailRequest], Field(description="Email Schedule") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Schedule Email # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Schedule Email + + Schedules the sending of a document by email. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param schedule_email_request: Email Schedule + :type schedule_email_request: ScheduleEmailRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._schedule_email_serialize( + company_id=company_id, + document_id=document_id, + schedule_email_request=schedule_email_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Schedules the sending of a document by email. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def schedule_email_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + schedule_email_request: Annotated[ + Optional[ScheduleEmailRequest], Field(description="Email Schedule") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Schedule Email - >>> thread = api.schedule_email_with_http_info(company_id, document_id, schedule_email_request, async_req=True) - >>> result = thread.get() + Schedules the sending of a document by email. :param company_id: The ID of the company. (required) :type company_id: int @@ -2238,136 +3425,134 @@ def schedule_email_with_http_info( :type document_id: int :param schedule_email_request: Email Schedule :type schedule_email_request: ScheduleEmailRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "schedule_email_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method schedule_email" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._schedule_email_serialize( + company_id=company_id, + document_id=document_id, + schedule_email_request=schedule_email_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _schedule_email_serialize( + self, + company_id, + document_id, + schedule_email_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["schedule_email_request"] is not None: - _body_params = _params["schedule_email_request"] + if schedule_email_request is not None: + _body_params = schedule_email_request # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/email", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents/{document_id}/email", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def transform_issued_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], original_document_id: Annotated[ - StrictInt, Field(..., description="Original document id.") + StrictInt, Field(description="Original document id.") ], - new_type: Annotated[StrictStr, Field(..., description="New document type.")], + new_type: Annotated[StrictStr, Field(description="New document type.")], e_invoice: Annotated[ Optional[StrictInt], Field(description="New document e_invoice.") ] = None, transform_keep_copy: Annotated[ Optional[StrictInt], Field(description="Keep the old document.") ] = None, - **kwargs - ) -> TransformIssuedDocumentResponse: # noqa: E501 - """Transform Issued Document # noqa: E501 - - Transforms the document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TransformIssuedDocumentResponse: + """Transform Issued Document - >>> thread = api.transform_issued_document(company_id, original_document_id, new_type, e_invoice, transform_keep_copy, async_req=True) - >>> result = thread.get() + Transforms the document. :param company_id: The ID of the company. (required) :type company_id: int @@ -2379,56 +3564,167 @@ def transform_issued_document( :type e_invoice: int :param transform_keep_copy: Keep the old document. :type transform_keep_copy: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: TransformIssuedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the transform_issued_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.transform_issued_document_with_http_info( - company_id, - original_document_id, - new_type, - e_invoice, - transform_keep_copy, - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._transform_issued_document_serialize( + company_id=company_id, + original_document_id=original_document_id, + new_type=new_type, + e_invoice=e_invoice, + transform_keep_copy=transform_keep_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TransformIssuedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def transform_issued_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], original_document_id: Annotated[ - StrictInt, Field(..., description="Original document id.") + StrictInt, Field(description="Original document id.") ], - new_type: Annotated[StrictStr, Field(..., description="New document type.")], + new_type: Annotated[StrictStr, Field(description="New document type.")], e_invoice: Annotated[ Optional[StrictInt], Field(description="New document e_invoice.") ] = None, transform_keep_copy: Annotated[ Optional[StrictInt], Field(description="Keep the old document.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Transform Issued Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TransformIssuedDocumentResponse]: + """Transform Issued Document + + Transforms the document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param original_document_id: Original document id. (required) + :type original_document_id: int + :param new_type: New document type. (required) + :type new_type: str + :param e_invoice: New document e_invoice. + :type e_invoice: int + :param transform_keep_copy: Keep the old document. + :type transform_keep_copy: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._transform_issued_document_serialize( + company_id=company_id, + original_document_id=original_document_id, + new_type=new_type, + e_invoice=e_invoice, + transform_keep_copy=transform_keep_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Transforms the document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "TransformIssuedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def transform_issued_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + original_document_id: Annotated[ + StrictInt, Field(description="Original document id.") + ], + new_type: Annotated[StrictStr, Field(description="New document type.")], + e_invoice: Annotated[ + Optional[StrictInt], Field(description="New document e_invoice.") + ] = None, + transform_keep_copy: Annotated[ + Optional[StrictInt], Field(description="Keep the old document.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Transform Issued Document - >>> thread = api.transform_issued_document_with_http_info(company_id, original_document_id, new_type, e_invoice, transform_keep_copy, async_req=True) - >>> result = thread.get() + Transforms the document. :param company_id: The ID of the company. (required) :type company_id: int @@ -2440,131 +3736,118 @@ def transform_issued_document_with_http_info( :type e_invoice: int :param transform_keep_copy: Keep the old document. :type transform_keep_copy: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(TransformIssuedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "original_document_id", - "new_type", - "e_invoice", - "transform_keep_copy", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method transform_issued_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._transform_issued_document_serialize( + company_id=company_id, + original_document_id=original_document_id, + new_type=new_type, + e_invoice=e_invoice, + transform_keep_copy=transform_keep_copy, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "TransformIssuedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _transform_issued_document_serialize( + self, + company_id, + original_document_id, + new_type, + e_invoice, + transform_keep_copy, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("original_document_id") is not None: # noqa: E501 - _query_params.append( - ("original_document_id", _params["original_document_id"]) - ) + if original_document_id is not None: + _query_params.append(("original_document_id", original_document_id)) - if _params.get("new_type") is not None: # noqa: E501 - _query_params.append(("new_type", _params["new_type"])) + if new_type is not None: + _query_params.append(("new_type", new_type)) - if _params.get("e_invoice") is not None: # noqa: E501 - _query_params.append(("e_invoice", _params["e_invoice"])) + if e_invoice is not None: + _query_params.append(("e_invoice", e_invoice)) - if _params.get("transform_keep_copy") is not None: # noqa: E501 - _query_params.append( - ("transform_keep_copy", _params["transform_keep_copy"]) - ) + if transform_keep_copy is not None: + _query_params.append(("transform_keep_copy", transform_keep_copy)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "TransformIssuedDocumentResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/transform", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/transform", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def upload_issued_document_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -2574,16 +3857,21 @@ def upload_issued_document_attachment( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> UploadIssuedDocumentAttachmentResponse: # noqa: E501 - """Upload Issued Document Attachment # noqa: E501 - - Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UploadIssuedDocumentAttachmentResponse: + """Upload Issued Document Attachment - >>> thread = api.upload_issued_document_attachment(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -2591,31 +3879,55 @@ def upload_issued_document_attachment( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UploadIssuedDocumentAttachmentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the upload_issued_document_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.upload_issued_document_attachment_with_http_info( - company_id, filename, attachment, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._upload_issued_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadIssuedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def upload_issued_document_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -2625,16 +3937,101 @@ def upload_issued_document_attachment_with_http_info( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Upload Issued Document Attachment # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UploadIssuedDocumentAttachmentResponse]: + """Upload Issued Document Attachment + + Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param filename: Attachment file name + :type filename: str + :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] + :type attachment: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_issued_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadIssuedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def upload_issued_document_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + filename: Annotated[ + Optional[StrictStr], Field(description="Attachment file name") + ] = None, + attachment: Annotated[ + Optional[Union[StrictBytes, StrictStr]], + Field( + description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upload Issued Document Attachment - >>> thread = api.upload_issued_document_attachment_with_http_info(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -2642,114 +4039,109 @@ def upload_issued_document_attachment_with_http_info( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UploadIssuedDocumentAttachmentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "filename", "attachment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_issued_document_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._upload_issued_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadIssuedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _upload_issued_document_attachment_serialize( + self, + company_id, + filename, + attachment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} - if _params["filename"]: - _form_params.append(("filename", _params["filename"])) - - if _params["attachment"]: - _files["attachment"] = _params["attachment"] - + if filename is not None: + _form_params.append(("filename", filename)) + if attachment is not None: + _files["attachment"] = attachment # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["multipart/form-data"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "UploadIssuedDocumentAttachmentResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/attachment", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/issued_e_invoices_api.py b/fattureincloud_python_sdk/api/issued_e_invoices_api.py index ba0928ed..9aa04537 100644 --- a/fattureincloud_python_sdk/api/issued_e_invoices_api.py +++ b/fattureincloud_python_sdk/api/issued_e_invoices_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictInt +from pydantic import StrictBool, StrictInt from typing import Optional @@ -37,10 +43,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class IssuedEInvoicesApi: @@ -55,196 +58,283 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def get_e_invoice_rejection_reason( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> GetEInvoiceRejectionReasonResponse: # noqa: E501 - """Get E-Invoice Rejection Reason # noqa: E501 - - Get e-invoice rejection reason # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_e_invoice_rejection_reason(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetEInvoiceRejectionReasonResponse: + """Get E-Invoice Rejection Reason + + Get e-invoice rejection reason :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetEInvoiceRejectionReasonResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_e_invoice_rejection_reason_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_e_invoice_rejection_reason_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_e_invoice_rejection_reason_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetEInvoiceRejectionReasonResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_e_invoice_rejection_reason_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get E-Invoice Rejection Reason # noqa: E501 - - Get e-invoice rejection reason # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_e_invoice_rejection_reason_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetEInvoiceRejectionReasonResponse]: + """Get E-Invoice Rejection Reason + + Get e-invoice rejection reason :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetEInvoiceRejectionReasonResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_e_invoice_rejection_reason" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_e_invoice_rejection_reason_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetEInvoiceRejectionReasonResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_e_invoice_rejection_reason_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get E-Invoice Rejection Reason + + Get e-invoice rejection reason + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_e_invoice_rejection_reason_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetEInvoiceRejectionReasonResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_e_invoice_rejection_reason_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetEInvoiceRejectionReasonResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/e_invoice/error_reason", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/{document_id}/e_invoice/error_reason", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_e_invoice_xml( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], include_attachment: Annotated[ Optional[StrictBool], Field(description="Include the attachment to the XML e-invoice."), ] = None, - **kwargs - ) -> str: # noqa: E501 - """Get E-Invoice XML # noqa: E501 - - Downloads the e-invoice in XML format. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> str: + """Get E-Invoice XML - >>> thread = api.get_e_invoice_xml(company_id, document_id, include_attachment, async_req=True) - >>> result = thread.get() + Downloads the e-invoice in XML format. :param company_id: The ID of the company. (required) :type company_id: int @@ -252,48 +342,153 @@ def get_e_invoice_xml( :type document_id: int :param include_attachment: Include the attachment to the XML e-invoice. :type include_attachment: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_e_invoice_xml_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_e_invoice_xml_with_http_info( - company_id, document_id, include_attachment, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + include_attachment=include_attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "str", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_e_invoice_xml_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], include_attachment: Annotated[ Optional[StrictBool], Field(description="Include the attachment to the XML e-invoice."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get E-Invoice XML # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[str]: + """Get E-Invoice XML + + Downloads the e-invoice in XML format. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param include_attachment: Include the attachment to the XML e-invoice. + :type include_attachment: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + include_attachment=include_attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "str", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Downloads the e-invoice in XML format. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_e_invoice_xml_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + include_attachment: Annotated[ + Optional[StrictBool], + Field(description="Include the attachment to the XML e-invoice."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get E-Invoice XML - >>> thread = api.get_e_invoice_xml_with_http_info(company_id, document_id, include_attachment, async_req=True) - >>> result = thread.get() + Downloads the e-invoice in XML format. :param company_id: The ID of the company. (required) :type company_id: int @@ -301,131 +496,124 @@ def get_e_invoice_xml_with_http_info( :type document_id: int :param include_attachment: Include the attachment to the XML e-invoice. :type include_attachment: bool - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "include_attachment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_e_invoice_xml" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + include_attachment=include_attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "str", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_e_invoice_xml_serialize( + self, + company_id, + document_id, + include_attachment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("include_attachment") is not None: # noqa: E501 - _query_params.append(("include_attachment", _params["include_attachment"])) + if include_attachment is not None: + _query_params.append(("include_attachment", include_attachment)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["text/xml"] - ) # noqa: E501 + _header_params["Accept"] = self.api_client.select_header_accept(["text/xml"]) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "str", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/e_invoice/xml", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/{document_id}/e_invoice/xml", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def send_e_invoice( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], send_e_invoice_request: Optional[SendEInvoiceRequest] = None, - **kwargs - ) -> SendEInvoiceResponse: # noqa: E501 - """Send E-Invoice # noqa: E501 - - Sends the e-invoice to SDI. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SendEInvoiceResponse: + """Send E-Invoice - >>> thread = api.send_e_invoice(company_id, document_id, send_e_invoice_request, async_req=True) - >>> result = thread.get() + Sends the e-invoice to SDI. :param company_id: The ID of the company. (required) :type company_id: int @@ -433,45 +621,147 @@ def send_e_invoice( :type document_id: int :param send_e_invoice_request: :type send_e_invoice_request: SendEInvoiceRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: SendEInvoiceResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the send_e_invoice_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.send_e_invoice_with_http_info( - company_id, document_id, send_e_invoice_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._send_e_invoice_serialize( + company_id=company_id, + document_id=document_id, + send_e_invoice_request=send_e_invoice_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SendEInvoiceResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def send_e_invoice_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], send_e_invoice_request: Optional[SendEInvoiceRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Send E-Invoice # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SendEInvoiceResponse]: + """Send E-Invoice + + Sends the e-invoice to SDI. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param send_e_invoice_request: + :type send_e_invoice_request: SendEInvoiceRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._send_e_invoice_serialize( + company_id=company_id, + document_id=document_id, + send_e_invoice_request=send_e_invoice_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SendEInvoiceResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Sends the e-invoice to SDI. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def send_e_invoice_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + send_e_invoice_request: Optional[SendEInvoiceRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Send E-Invoice - >>> thread = api.send_e_invoice_with_http_info(company_id, document_id, send_e_invoice_request, async_req=True) - >>> result = thread.get() + Sends the e-invoice to SDI. :param company_id: The ID of the company. (required) :type company_id: int @@ -479,285 +769,372 @@ def send_e_invoice_with_http_info( :type document_id: int :param send_e_invoice_request: :type send_e_invoice_request: SendEInvoiceRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(SendEInvoiceResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "send_e_invoice_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method send_e_invoice" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._send_e_invoice_serialize( + company_id=company_id, + document_id=document_id, + send_e_invoice_request=send_e_invoice_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "SendEInvoiceResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _send_e_invoice_serialize( + self, + company_id, + document_id, + send_e_invoice_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["send_e_invoice_request"] is not None: - _body_params = _params["send_e_invoice_request"] + if send_e_invoice_request is not None: + _body_params = send_e_invoice_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "SendEInvoiceResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/e_invoice/send", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/issued_documents/{document_id}/e_invoice/send", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def verify_e_invoice_xml( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> VerifyEInvoiceXmlResponse: # noqa: E501 - """Verify E-Invoice XML # noqa: E501 - - Verifies the e-invoice XML format. Checks if all of the mandatory fields are filled and compliant to the right format. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.verify_e_invoice_xml(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> VerifyEInvoiceXmlResponse: + """Verify E-Invoice XML + + Verifies the e-invoice XML format. Checks if all of the mandatory fields are filled and compliant to the right format. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: VerifyEInvoiceXmlResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the verify_e_invoice_xml_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.verify_e_invoice_xml_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._verify_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VerifyEInvoiceXmlResponse", + "401": None, + "404": None, + "422": "VerifyEInvoiceXmlErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def verify_e_invoice_xml_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Verify E-Invoice XML # noqa: E501 - - Verifies the e-invoice XML format. Checks if all of the mandatory fields are filled and compliant to the right format. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.verify_e_invoice_xml_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[VerifyEInvoiceXmlResponse]: + """Verify E-Invoice XML + + Verifies the e-invoice XML format. Checks if all of the mandatory fields are filled and compliant to the right format. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(VerifyEInvoiceXmlResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method verify_e_invoice_xml" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._verify_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "VerifyEInvoiceXmlResponse", + "401": None, + "404": None, + "422": "VerifyEInvoiceXmlErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def verify_e_invoice_xml_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Verify E-Invoice XML - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + Verifies the e-invoice XML format. Checks if all of the mandatory fields are filled and compliant to the right format. + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._verify_e_invoice_xml_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "VerifyEInvoiceXmlResponse", + "401": None, + "404": None, + "422": "VerifyEInvoiceXmlErrorResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _verify_e_invoice_xml_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "VerifyEInvoiceXmlResponse", - "401": None, - "404": None, - "422": "VerifyEInvoiceXmlErrorResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/issued_documents/{document_id}/e_invoice/xml_verify", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/issued_documents/{document_id}/e_invoice/xml_verify", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/products_api.py b/fattureincloud_python_sdk/api/products_api.py index 0468953a..fb806d6c 100644 --- a/fattureincloud_python_sdk/api/products_api.py +++ b/fattureincloud_python_sdk/api/products_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, conint +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -37,10 +43,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class ProductsApi: @@ -55,362 +58,531 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_product( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_product_request: Optional[CreateProductRequest] = None, - **kwargs - ) -> CreateProductResponse: # noqa: E501 - """Create Product # noqa: E501 - - Creates a new product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateProductResponse: + """Create Product - >>> thread = api.create_product(company_id, create_product_request, async_req=True) - >>> result = thread.get() + Creates a new product. :param company_id: The ID of the company. (required) :type company_id: int :param create_product_request: :type create_product_request: CreateProductRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateProductResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_product_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_product_with_http_info( - company_id, create_product_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_product_serialize( + company_id=company_id, + create_product_request=create_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateProductResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_product_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_product_request: Optional[CreateProductRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Product # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateProductResponse]: + """Create Product + + Creates a new product. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_product_request: + :type create_product_request: CreateProductRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_product_serialize( + company_id=company_id, + create_product_request=create_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Creates a new product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateProductResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_product_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_product_request: Optional[CreateProductRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Product - >>> thread = api.create_product_with_http_info(company_id, create_product_request, async_req=True) - >>> result = thread.get() + Creates a new product. :param company_id: The ID of the company. (required) :type company_id: int :param create_product_request: :type create_product_request: CreateProductRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateProductResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_product_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_product" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_product_serialize( + company_id=company_id, + create_product_request=create_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateProductResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _create_product_serialize( + self, + company_id, + create_product_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_product_request"] is not None: - _body_params = _params["create_product_request"] + if create_product_request is not None: + _body_params = create_product_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateProductResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/products", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/products", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_product( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Product # noqa: E501 - - Deletes the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_product(company_id, product_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Product + + Deletes the specified product. :param company_id: The ID of the company. (required) :type company_id: int :param product_id: The ID of the product. (required) :type product_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_product_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_product_with_http_info( - company_id, product_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_product_serialize( + company_id=company_id, + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_product_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Product # noqa: E501 - - Deletes the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_product_with_http_info(company_id, product_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Product + + Deletes the specified product. :param company_id: The ID of the company. (required) :type company_id: int :param product_id: The ID of the product. (required) :type product_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "product_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_product" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_product_serialize( + company_id=company_id, + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_product_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Product - if _params["product_id"]: - _path_params["product_id"] = _params["product_id"] + Deletes the specified product. + :param company_id: The ID of the company. (required) + :type company_id: int + :param product_id: The ID of the product. (required) + :type product_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_product_serialize( + company_id=company_id, + product_id=product_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_product_serialize( + self, + company_id, + product_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if product_id is not None: + _path_params["product_id"] = product_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/products/{product_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/products/{product_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_product( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetProductResponse: # noqa: E501 - """Get Product # noqa: E501 - - Gets the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetProductResponse: + """Get Product - >>> thread = api.get_product(company_id, product_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified product. :param company_id: The ID of the company. (required) :type company_id: int @@ -420,50 +592,161 @@ def get_product( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetProductResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_product_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_product_with_http_info( - company_id, product_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_product_serialize( + company_id=company_id, + product_id=product_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_product_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Product # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetProductResponse]: + """Get Product - Gets the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the specified product. - >>> thread = api.get_product_with_http_info(company_id, product_id, fields, fieldset, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param product_id: The ID of the product. (required) + :type product_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_product_serialize( + company_id=company_id, + product_id=product_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_product_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Product + + Gets the specified product. :param company_id: The ID of the company. (required) :type company_id: int @@ -473,120 +756,114 @@ def get_product_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetProductResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "product_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_product" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_product_serialize( + company_id=company_id, + product_id=product_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["product_id"]: - _path_params["product_id"] = _params["product_id"] + def _get_product_serialize( + self, + company_id, + product_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if product_id is not None: + _path_params["product_id"] = product_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetProductResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/products/{product_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/products/{product_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_products( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -603,22 +880,27 @@ def list_products( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListProductsResponse: # noqa: E501 - """List Products # noqa: E501 - - Lists the products. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListProductsResponse: + """List Products - >>> thread = api.list_products(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the products. :param company_id: The ID of the company. (required) :type company_id: int @@ -634,31 +916,59 @@ def list_products( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListProductsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_products_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_products_with_http_info( - company_id, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_products_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_products_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -675,22 +985,132 @@ def list_products_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Products # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListProductsResponse]: + """List Products + + Lists the products. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_products_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Lists the products. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_products_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Products - >>> thread = api.list_products_with_http_info(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the products. :param company_id: The ID of the company. (required) :type company_id: int @@ -706,153 +1126,149 @@ def list_products_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListProductsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_products" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_products_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListProductsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _list_products_serialize( + self, + company_id, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListProductsResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/products", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/products", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_product( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], modify_product_request: Annotated[ Optional[ModifyProductRequest], Field(description="Modified product details."), ] = None, - **kwargs - ) -> ModifyProductResponse: # noqa: E501 - """Modify Product # noqa: E501 - - Modifies the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyProductResponse: + """Modify Product - >>> thread = api.modify_product(company_id, product_id, modify_product_request, async_req=True) - >>> result = thread.get() + Modifies the specified product. :param company_id: The ID of the company. (required) :type company_id: int @@ -860,48 +1276,153 @@ def modify_product( :type product_id: int :param modify_product_request: Modified product details. :type modify_product_request: ModifyProductRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyProductResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_product_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_product_with_http_info( - company_id, product_id, modify_product_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_product_serialize( + company_id=company_id, + product_id=product_id, + modify_product_request=modify_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_product_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - product_id: Annotated[ - StrictInt, Field(..., description="The ID of the product.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], modify_product_request: Annotated[ Optional[ModifyProductRequest], Field(description="Modified product details."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Product # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyProductResponse]: + """Modify Product - Modifies the specified product. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Modifies the specified product. - >>> thread = api.modify_product_with_http_info(company_id, product_id, modify_product_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param product_id: The ID of the product. (required) + :type product_id: int + :param modify_product_request: Modified product details. + :type modify_product_request: ModifyProductRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_product_serialize( + company_id=company_id, + product_id=product_id, + modify_product_request=modify_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_product_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + product_id: Annotated[StrictInt, Field(description="The ID of the product.")], + modify_product_request: Annotated[ + Optional[ModifyProductRequest], + Field(description="Modified product details."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Product + + Modifies the specified product. :param company_id: The ID of the company. (required) :type company_id: int @@ -909,115 +1430,110 @@ def modify_product_with_http_info( :type product_id: int :param modify_product_request: Modified product details. :type modify_product_request: ModifyProductRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyProductResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "product_id", "modify_product_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_product" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_product_serialize( + company_id=company_id, + product_id=product_id, + modify_product_request=modify_product_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyProductResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["product_id"]: - _path_params["product_id"] = _params["product_id"] + def _modify_product_serialize( + self, + company_id, + product_id, + modify_product_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if product_id is not None: + _path_params["product_id"] = product_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_product_request"] is not None: - _body_params = _params["modify_product_request"] + if modify_product_request is not None: + _body_params = modify_product_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyProductResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/products/{product_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/products/{product_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/receipts_api.py b/fattureincloud_python_sdk/api/receipts_api.py index 0a88a16d..c149006a 100644 --- a/fattureincloud_python_sdk/api/receipts_api.py +++ b/fattureincloud_python_sdk/api/receipts_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, conint +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -43,10 +49,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class ReceiptsApi: @@ -61,367 +64,546 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_receipt( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_receipt_request: Annotated[ Optional[CreateReceiptRequest], Field(description="The Receipt to create.") ] = None, - **kwargs - ) -> CreateReceiptResponse: # noqa: E501 - """Create Receipt # noqa: E501 - - Creates a new receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateReceiptResponse: + """Create Receipt - >>> thread = api.create_receipt(company_id, create_receipt_request, async_req=True) - >>> result = thread.get() + Creates a new receipt. :param company_id: The ID of the company. (required) :type company_id: int :param create_receipt_request: The Receipt to create. :type create_receipt_request: CreateReceiptRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateReceiptResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_receipt_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_receipt_with_http_info( - company_id, create_receipt_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_receipt_serialize( + company_id=company_id, + create_receipt_request=create_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceiptResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_receipt_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_receipt_request: Annotated[ Optional[CreateReceiptRequest], Field(description="The Receipt to create.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Receipt # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateReceiptResponse]: + """Create Receipt + + Creates a new receipt. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_receipt_request: The Receipt to create. + :type create_receipt_request: CreateReceiptRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_receipt_serialize( + company_id=company_id, + create_receipt_request=create_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Creates a new receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceiptResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.create_receipt_with_http_info(company_id, create_receipt_request, async_req=True) - >>> result = thread.get() + @validate_call + def create_receipt_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_receipt_request: Annotated[ + Optional[CreateReceiptRequest], Field(description="The Receipt to create.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Receipt + + Creates a new receipt. :param company_id: The ID of the company. (required) :type company_id: int :param create_receipt_request: The Receipt to create. :type create_receipt_request: CreateReceiptRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateReceiptResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_receipt_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._create_receipt_serialize( + company_id=company_id, + create_receipt_request=create_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_receipt" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceiptResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _create_receipt_serialize( + self, + company_id, + create_receipt_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_receipt_request"] is not None: - _body_params = _params["create_receipt_request"] + if create_receipt_request is not None: + _body_params = create_receipt_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateReceiptResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/receipts", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_receipt( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Receipt # noqa: E501 - - Deletes the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Receipt - >>> thread = api.delete_receipt(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_receipt_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_receipt_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_receipt_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_receipt_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Receipt # noqa: E501 - - Deletes the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Receipt - >>> thread = api.delete_receipt_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_receipt_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_receipt" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_receipt_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Receipt - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Deletes the specified receipt. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_receipt_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_receipt_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/receipts/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/receipts/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_receipt( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetReceiptResponse: # noqa: E501 - """Get Receipt # noqa: E501 - - Gets the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetReceiptResponse: + """Get Receipt - >>> thread = api.get_receipt(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int @@ -431,50 +613,79 @@ def get_receipt( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetReceiptResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_receipt_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_receipt_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_receipt_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_receipt_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Receipt # noqa: E501 - - Gets the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetReceiptResponse]: + """Get Receipt - >>> thread = api.get_receipt_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int @@ -484,290 +695,459 @@ def get_receipt_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetReceiptResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_receipt_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_receipt" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def get_receipt_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Receipt - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Gets the specified receipt. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_receipt_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_receipt_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetReceiptResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/receipts/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_receipt_pre_create_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> GetReceiptPreCreateInfoResponse: # noqa: E501 - """Get Receipt Pre-Create Info # noqa: E501 - - Retrieves the information useful while creating a new receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetReceiptPreCreateInfoResponse: + """Get Receipt Pre-Create Info - >>> thread = api.get_receipt_pre_create_info(company_id, async_req=True) - >>> result = thread.get() + Retrieves the information useful while creating a new receipt. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetReceiptPreCreateInfoResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_receipt_pre_create_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_receipt_pre_create_info_with_http_info( - company_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_receipt_pre_create_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptPreCreateInfoResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_receipt_pre_create_info_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Receipt Pre-Create Info # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetReceiptPreCreateInfoResponse]: + """Get Receipt Pre-Create Info - Retrieves the information useful while creating a new receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Retrieves the information useful while creating a new receipt. - >>> thread = api.get_receipt_pre_create_info_with_http_info(company_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_receipt_pre_create_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptPreCreateInfoResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_receipt_pre_create_info_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Receipt Pre-Create Info + + Retrieves the information useful while creating a new receipt. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetReceiptPreCreateInfoResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_receipt_pre_create_info_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_receipt_pre_create_info" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptPreCreateInfoResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _get_receipt_pre_create_info_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetReceiptPreCreateInfoResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts/info", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/receipts/info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_receipts_monthly_totals( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - type: Annotated[StrictStr, Field(..., description="Receipt Type")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[StrictStr, Field(description="Receipt Type")], year: Annotated[ - StrictStr, Field(..., description="Year for which you want monthly totals") + StrictStr, Field(description="Year for which you want monthly totals") ], - **kwargs - ) -> GetReceiptsMonthlyTotalsResponse: # noqa: E501 - """Get Receipts Monthly Totals # noqa: E501 - - Returns the monthly totals by year and receipt type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetReceiptsMonthlyTotalsResponse: + """Get Receipts Monthly Totals - >>> thread = api.get_receipts_monthly_totals(company_id, type, year, async_req=True) - >>> result = thread.get() + Returns the monthly totals by year and receipt type. :param company_id: The ID of the company. (required) :type company_id: int @@ -775,45 +1155,151 @@ def get_receipts_monthly_totals( :type type: str :param year: Year for which you want monthly totals (required) :type year: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetReceiptsMonthlyTotalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_receipts_monthly_totals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_receipts_monthly_totals_with_http_info( - company_id, type, year, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_receipts_monthly_totals_serialize( + company_id=company_id, + type=type, + year=year, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptsMonthlyTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_receipts_monthly_totals_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - type: Annotated[StrictStr, Field(..., description="Receipt Type")], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[StrictStr, Field(description="Receipt Type")], year: Annotated[ - StrictStr, Field(..., description="Year for which you want monthly totals") + StrictStr, Field(description="Year for which you want monthly totals") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Receipts Monthly Totals # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetReceiptsMonthlyTotalsResponse]: + """Get Receipts Monthly Totals - Returns the monthly totals by year and receipt type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Returns the monthly totals by year and receipt type. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param type: Receipt Type (required) + :type type: str + :param year: Year for which you want monthly totals (required) + :type year: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_receipts_monthly_totals_serialize( + company_id=company_id, + type=type, + year=year, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptsMonthlyTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_receipts_monthly_totals_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[StrictStr, Field(description="Receipt Type")], + year: Annotated[ + StrictStr, Field(description="Year for which you want monthly totals") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Receipts Monthly Totals - >>> thread = api.get_receipts_monthly_totals_with_http_info(company_id, type, year, async_req=True) - >>> result = thread.get() + Returns the monthly totals by year and receipt type. :param company_id: The ID of the company. (required) :type company_id: int @@ -821,117 +1307,110 @@ def get_receipts_monthly_totals_with_http_info( :type type: str :param year: Year for which you want monthly totals (required) :type year: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetReceiptsMonthlyTotalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "type", "year"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_receipts_monthly_totals_serialize( + company_id=company_id, + type=type, + year=year, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_receipts_monthly_totals" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceiptsMonthlyTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _get_receipts_monthly_totals_serialize( + self, + company_id, + type, + year, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) - if _params.get("year") is not None: # noqa: E501 - _query_params.append(("year", _params["year"])) + if year is not None: + _query_params.append(("year", year)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetReceiptsMonthlyTotalsResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts/monthly_totals", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/receipts/monthly_totals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_receipts( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -942,7 +1421,7 @@ def list_receipts( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, sort: Annotated[ @@ -954,16 +1433,21 @@ def list_receipts( q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListReceiptsResponse: # noqa: E501 - """List Receipts # noqa: E501 - - Lists the receipts. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListReceiptsResponse: + """List Receipts - >>> thread = api.list_receipts(company_id, fields, fieldset, page, per_page, sort, q, async_req=True) - >>> result = thread.get() + Lists the receipts. :param company_id: The ID of the company. (required) :type company_id: int @@ -979,31 +1463,59 @@ def list_receipts( :type sort: str :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListReceiptsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_receipts_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_receipts_with_http_info( - company_id, fields, fieldset, page, per_page, sort, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_receipts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + page=page, + per_page=per_page, + sort=sort, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceiptsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_receipts_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -1014,7 +1526,7 @@ def list_receipts_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, sort: Annotated[ @@ -1026,16 +1538,126 @@ def list_receipts_with_http_info( q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Receipts # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListReceiptsResponse]: + """List Receipts + + Lists the receipts. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_receipts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + page=page, + per_page=per_page, + sort=sort, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the receipts. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceiptsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.list_receipts_with_http_info(company_id, fields, fieldset, page, per_page, sort, q, async_req=True) - >>> result = thread.get() + @validate_call + def list_receipts_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Receipts + + Lists the receipts. :param company_id: The ID of the company. (required) :type company_id: int @@ -1051,152 +1673,148 @@ def list_receipts_with_http_info( :type sort: str :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListReceiptsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "page", - "per_page", - "sort", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_receipts_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + page=page, + per_page=per_page, + sort=sort, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_receipts" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceiptsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_receipts_serialize( + self, + company_id, + fields, + fieldset, + page, + per_page, + sort, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListReceiptsResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/receipts", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_receipt( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_receipt_request: Annotated[ Optional[ModifyReceiptRequest], Field(description="Modified receipt.") ] = None, - **kwargs - ) -> ModifyReceiptResponse: # noqa: E501 - """Modify Receipt # noqa: E501 - - Modifies the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyReceiptResponse: + """Modify Receipt - >>> thread = api.modify_receipt(company_id, document_id, modify_receipt_request, async_req=True) - >>> result = thread.get() + Modifies the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int @@ -1204,47 +1822,75 @@ def modify_receipt( :type document_id: int :param modify_receipt_request: Modified receipt. :type modify_receipt_request: ModifyReceiptRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyReceiptResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_receipt_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_receipt_with_http_info( - company_id, document_id, modify_receipt_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_receipt_serialize( + company_id=company_id, + document_id=document_id, + modify_receipt_request=modify_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_receipt_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_receipt_request: Annotated[ Optional[ModifyReceiptRequest], Field(description="Modified receipt.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Receipt # noqa: E501 - - Modifies the specified receipt. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyReceiptResponse]: + """Modify Receipt - >>> thread = api.modify_receipt_with_http_info(company_id, document_id, modify_receipt_request, async_req=True) - >>> result = thread.get() + Modifies the specified receipt. :param company_id: The ID of the company. (required) :type company_id: int @@ -1252,115 +1898,186 @@ def modify_receipt_with_http_info( :type document_id: int :param modify_receipt_request: Modified receipt. :type modify_receipt_request: ModifyReceiptRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyReceiptResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_receipt_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._modify_receipt_serialize( + company_id=company_id, + document_id=document_id, + modify_receipt_request=modify_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_receipt" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def modify_receipt_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + modify_receipt_request: Annotated[ + Optional[ModifyReceiptRequest], Field(description="Modified receipt.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Receipt - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Modifies the specified receipt. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param modify_receipt_request: Modified receipt. + :type modify_receipt_request: ModifyReceiptRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_receipt_serialize( + company_id=company_id, + document_id=document_id, + modify_receipt_request=modify_receipt_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceiptResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _modify_receipt_serialize( + self, + company_id, + document_id, + modify_receipt_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_receipt_request"] is not None: - _body_params = _params["modify_receipt_request"] + if modify_receipt_request is not None: + _body_params = modify_receipt_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyReceiptResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/receipts/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/receipts/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/received_documents_api.py b/fattureincloud_python_sdk/api/received_documents_api.py index 71c60a34..17c44153 100644 --- a/fattureincloud_python_sdk/api/received_documents_api.py +++ b/fattureincloud_python_sdk/api/received_documents_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBytes, StrictInt, StrictStr, conint +from pydantic import StrictBytes, StrictInt, StrictStr, field_validator from typing import Optional, Union @@ -63,10 +69,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class ReceivedDocumentsApi: @@ -81,526 +84,786 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_received_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_received_document_request: Annotated[ Optional[CreateReceivedDocumentRequest], Field(description="Document to create"), ] = None, - **kwargs - ) -> CreateReceivedDocumentResponse: # noqa: E501 - """Create Received Document # noqa: E501 - - Creates a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateReceivedDocumentResponse: + """Create Received Document - >>> thread = api.create_received_document(company_id, create_received_document_request, async_req=True) - >>> result = thread.get() + Creates a new document. :param company_id: The ID of the company. (required) :type company_id: int :param create_received_document_request: Document to create :type create_received_document_request: CreateReceivedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateReceivedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_received_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_received_document_with_http_info( - company_id, create_received_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_received_document_serialize( + company_id=company_id, + create_received_document_request=create_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceivedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_received_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_received_document_request: Annotated[ Optional[CreateReceivedDocumentRequest], Field(description="Document to create"), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Received Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateReceivedDocumentResponse]: + """Create Received Document + + Creates a new document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_received_document_request: Document to create + :type create_received_document_request: CreateReceivedDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_received_document_serialize( + company_id=company_id, + create_received_document_request=create_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceivedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_received_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_received_document_request: Annotated[ + Optional[CreateReceivedDocumentRequest], + Field(description="Document to create"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Received Document - >>> thread = api.create_received_document_with_http_info(company_id, create_received_document_request, async_req=True) - >>> result = thread.get() + Creates a new document. :param company_id: The ID of the company. (required) :type company_id: int :param create_received_document_request: Document to create :type create_received_document_request: CreateReceivedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateReceivedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_received_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_received_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_received_document_serialize( + company_id=company_id, + create_received_document_request=create_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateReceivedDocumentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _create_received_document_serialize( + self, + company_id, + create_received_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_received_document_request"] is not None: - _body_params = _params["create_received_document_request"] + if create_received_document_request is not None: + _body_params = create_received_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateReceivedDocumentResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/received_documents", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_received_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Received Document # noqa: E501 - - Deletes the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Received Document - >>> thread = api.delete_received_document(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_received_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_received_document_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_received_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_received_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Received Document # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Received Document + + Deletes the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_received_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Deletes the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_received_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Received Document - >>> thread = api.delete_received_document_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Deletes the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_received_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_received_document_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _delete_received_document_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/received_documents/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/received_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_received_document_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Received Document Attachment # noqa: E501 - - Removes the attachment of the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Received Document Attachment - >>> thread = api.delete_received_document_attachment(company_id, document_id, async_req=True) - >>> result = thread.get() + Removes the attachment of the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_received_document_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_received_document_attachment_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_received_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_received_document_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Received Document Attachment # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Received Document Attachment + + Removes the attachment of the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_received_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Removes the attachment of the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_received_document_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Received Document Attachment - >>> thread = api.delete_received_document_attachment_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + Removes the attachment of the specified document. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_received_document_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_received_document_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _delete_received_document_attachment_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/received_documents/{document_id}/attachment", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/received_documents/{document_id}/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_existing_received_document_totals( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], get_existing_received_document_totals_request: Annotated[ Optional[GetExistingReceivedDocumentTotalsRequest], Field(description="Received document."), ] = None, - **kwargs - ) -> GetExistingReceivedDocumentTotalsResponse: # noqa: E501 - """Get Existing Received Document Totals # noqa: E501 - - Returns the totals for the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetExistingReceivedDocumentTotalsResponse: + """Get Existing Received Document Totals - >>> thread = api.get_existing_received_document_totals(company_id, document_id, get_existing_received_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -608,51 +871,149 @@ def get_existing_received_document_totals( :type document_id: int :param get_existing_received_document_totals_request: Received document. :type get_existing_received_document_totals_request: GetExistingReceivedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetExistingReceivedDocumentTotalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_existing_received_document_totals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_existing_received_document_totals_with_http_info( - company_id, - document_id, - get_existing_received_document_totals_request, - **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_existing_received_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_received_document_totals_request=get_existing_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetExistingReceivedDocumentTotalsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_existing_received_document_totals_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], get_existing_received_document_totals_request: Annotated[ Optional[GetExistingReceivedDocumentTotalsRequest], Field(description="Received document."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Existing Received Document Totals # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetExistingReceivedDocumentTotalsResponse]: + """Get Existing Received Document Totals + + Returns the totals for the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param get_existing_received_document_totals_request: Received document. + :type get_existing_received_document_totals_request: GetExistingReceivedDocumentTotalsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_existing_received_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_received_document_totals_request=get_existing_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetExistingReceivedDocumentTotalsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Returns the totals for the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_existing_received_document_totals_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + get_existing_received_document_totals_request: Annotated[ + Optional[GetExistingReceivedDocumentTotalsRequest], + Field(description="Received document."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Existing Received Document Totals - >>> thread = api.get_existing_received_document_totals_with_http_info(company_id, document_id, get_existing_received_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -660,325 +1021,416 @@ def get_existing_received_document_totals_with_http_info( :type document_id: int :param get_existing_received_document_totals_request: Received document. :type get_existing_received_document_totals_request: GetExistingReceivedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetExistingReceivedDocumentTotalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "document_id", - "get_existing_received_document_totals_request", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_existing_received_document_totals" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_existing_received_document_totals_serialize( + company_id=company_id, + document_id=document_id, + get_existing_received_document_totals_request=get_existing_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetExistingReceivedDocumentTotalsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_existing_received_document_totals_serialize( + self, + company_id, + document_id, + get_existing_received_document_totals_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["get_existing_received_document_totals_request"] is not None: - _body_params = _params["get_existing_received_document_totals_request"] + if get_existing_received_document_totals_request is not None: + _body_params = get_existing_received_document_totals_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetExistingReceivedDocumentTotalsResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/{document_id}/totals", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/received_documents/{document_id}/totals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_new_received_document_totals( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], get_new_received_document_totals_request: Annotated[ Optional[GetNewReceivedDocumentTotalsRequest], Field(description="Received document."), ] = None, - **kwargs - ) -> GetNewReceivedDocumentTotalsResponse: # noqa: E501 - """Get New Received Document Totals # noqa: E501 - - Returns the totals for a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetNewReceivedDocumentTotalsResponse: + """Get New Received Document Totals - >>> thread = api.get_new_received_document_totals(company_id, get_new_received_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for a new document. :param company_id: The ID of the company. (required) :type company_id: int :param get_new_received_document_totals_request: Received document. :type get_new_received_document_totals_request: GetNewReceivedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetNewReceivedDocumentTotalsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_new_received_document_totals_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_new_received_document_totals_with_http_info( - company_id, get_new_received_document_totals_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_new_received_document_totals_serialize( + company_id=company_id, + get_new_received_document_totals_request=get_new_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetNewReceivedDocumentTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_new_received_document_totals_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], get_new_received_document_totals_request: Annotated[ Optional[GetNewReceivedDocumentTotalsRequest], Field(description="Received document."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get New Received Document Totals # noqa: E501 - - Returns the totals for a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetNewReceivedDocumentTotalsResponse]: + """Get New Received Document Totals - >>> thread = api.get_new_received_document_totals_with_http_info(company_id, get_new_received_document_totals_request, async_req=True) - >>> result = thread.get() + Returns the totals for a new document. :param company_id: The ID of the company. (required) :type company_id: int :param get_new_received_document_totals_request: Received document. :type get_new_received_document_totals_request: GetNewReceivedDocumentTotalsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetNewReceivedDocumentTotalsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "get_new_received_document_totals_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_new_received_document_totals" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["get_new_received_document_totals_request"] is not None: - _body_params = _params["get_new_received_document_totals_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), + """ # noqa: E501 + + _param = self._get_new_received_document_totals_serialize( + company_id=company_id, + get_new_received_document_totals_request=get_new_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = { + _response_types_map: Dict[str, Optional[str]] = { "200": "GetNewReceivedDocumentTotalsResponse", "401": None, "404": None, } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/totals", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), ) - @validate_arguments - def get_received_document( + @validate_call + def get_new_received_document_totals_without_preload_content( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - fields: Annotated[ + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + get_new_received_document_totals_request: Annotated[ + Optional[GetNewReceivedDocumentTotalsRequest], + Field(description="Received document."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get New Received Document Totals + + Returns the totals for a new document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param get_new_received_document_totals_request: Received document. + :type get_new_received_document_totals_request: GetNewReceivedDocumentTotalsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_new_received_document_totals_serialize( + company_id=company_id, + get_new_received_document_totals_request=get_new_received_document_totals_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetNewReceivedDocumentTotalsResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_new_received_document_totals_serialize( + self, + company_id, + get_new_received_document_totals_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if get_new_received_document_totals_request is not None: + _body_params = get_new_received_document_totals_request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/received_documents/totals", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_received_document( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetReceivedDocumentResponse: # noqa: E501 - """Get Received Document # noqa: E501 - - Gets the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetReceivedDocumentResponse: + """Get Received Document - >>> thread = api.get_received_document(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -988,50 +1440,161 @@ def get_received_document( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetReceivedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_received_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_received_document_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_received_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_received_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Received Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetReceivedDocumentResponse]: + """Get Received Document - Gets the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the specified document. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_received_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - >>> thread = api.get_received_document_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_received_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Received Document + + Gets the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -1041,289 +1604,376 @@ def get_received_document_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetReceivedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_received_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_received_document_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _get_received_document_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetReceivedDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/received_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_received_document_pre_create_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the received document.") + StrictStr, Field(description="The type of the received document.") ], - **kwargs - ) -> GetReceivedDocumentPreCreateInfoResponse: # noqa: E501 - """Get Received Document Pre-Create Info # noqa: E501 - - Retrieves the information useful while creating a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetReceivedDocumentPreCreateInfoResponse: + """Get Received Document Pre-Create Info - >>> thread = api.get_received_document_pre_create_info(company_id, type, async_req=True) - >>> result = thread.get() + Retrieves the information useful while creating a new document. :param company_id: The ID of the company. (required) :type company_id: int :param type: The type of the received document. (required) :type type: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetReceivedDocumentPreCreateInfoResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_received_document_pre_create_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_received_document_pre_create_info_with_http_info( - company_id, type, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_received_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_received_document_pre_create_info_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the received document.") + StrictStr, Field(description="The type of the received document.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Received Document Pre-Create Info # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetReceivedDocumentPreCreateInfoResponse]: + """Get Received Document Pre-Create Info - Retrieves the information useful while creating a new document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Retrieves the information useful while creating a new document. - >>> thread = api.get_received_document_pre_create_info_with_http_info(company_id, type, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param type: The type of the received document. (required) + :type type: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_received_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_received_document_pre_create_info_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[ + StrictStr, Field(description="The type of the received document.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Received Document Pre-Create Info + + Retrieves the information useful while creating a new document. :param company_id: The ID of the company. (required) :type company_id: int :param type: The type of the received document. (required) :type type: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetReceivedDocumentPreCreateInfoResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "type"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_received_document_pre_create_info" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_received_document_pre_create_info_serialize( + company_id=company_id, + type=type, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetReceivedDocumentPreCreateInfoResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_received_document_pre_create_info_serialize( + self, + company_id, + type, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetReceivedDocumentPreCreateInfoResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/info", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/received_documents/info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_received_documents( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the received document.") + StrictStr, Field(description="The type of the received document.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1341,22 +1991,27 @@ def list_received_documents( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListReceivedDocumentsResponse: # noqa: E501 - """List Received Documents # noqa: E501 - - Lists the received documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListReceivedDocumentsResponse: + """List Received Documents - >>> thread = api.list_received_documents(company_id, type, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the received documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1374,33 +2029,62 @@ def list_received_documents( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListReceivedDocumentsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_received_documents_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_received_documents_with_http_info( - company_id, type, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_received_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_received_documents_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], type: Annotated[ - StrictStr, Field(..., description="The type of the received document.") + StrictStr, Field(description="The type of the received document.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1418,22 +2102,138 @@ def list_received_documents_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Received Documents # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListReceivedDocumentsResponse]: + """List Received Documents + + Lists the received documents. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param type: The type of the received document. (required) + :type type: str + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_received_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Lists the received documents. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_received_documents_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + type: Annotated[ + StrictStr, Field(description="The type of the received document.") + ], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Received Documents - >>> thread = api.list_received_documents_with_http_info(company_id, type, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the received documents. :param company_id: The ID of the company. (required) :type company_id: int @@ -1451,157 +2251,154 @@ def list_received_documents_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListReceivedDocumentsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "type", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_received_documents" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_received_documents_serialize( + company_id=company_id, + type=type, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListReceivedDocumentsResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_received_documents_serialize( + self, + company_id, + type, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("type") is not None: # noqa: E501 - _query_params.append(("type", _params["type"])) + if type is not None: + _query_params.append(("type", type)) - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListReceivedDocumentsResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/received_documents", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_received_document( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_received_document_request: Annotated[ Optional[ModifyReceivedDocumentRequest], Field(description="Modified document."), ] = None, - **kwargs - ) -> ModifyReceivedDocumentResponse: # noqa: E501 - """Modify Received Document # noqa: E501 - - Modifies the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyReceivedDocumentResponse: + """Modify Received Document - >>> thread = api.modify_received_document(company_id, document_id, modify_received_document_request, async_req=True) - >>> result = thread.get() + Modifies the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -1609,48 +2406,153 @@ def modify_received_document( :type document_id: int :param modify_received_document_request: Modified document. :type modify_received_document_request: ModifyReceivedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyReceivedDocumentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_received_document_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_received_document_with_http_info( - company_id, document_id, modify_received_document_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_received_document_serialize( + company_id=company_id, + document_id=document_id, + modify_received_document_request=modify_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_received_document_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_received_document_request: Annotated[ Optional[ModifyReceivedDocumentRequest], Field(description="Modified document."), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Received Document # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyReceivedDocumentResponse]: + """Modify Received Document - Modifies the specified document. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Modifies the specified document. - >>> thread = api.modify_received_document_with_http_info(company_id, document_id, modify_received_document_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param modify_received_document_request: Modified document. + :type modify_received_document_request: ModifyReceivedDocumentRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_received_document_serialize( + company_id=company_id, + document_id=document_id, + modify_received_document_request=modify_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_received_document_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + modify_received_document_request: Annotated[ + Optional[ModifyReceivedDocumentRequest], + Field(description="Modified document."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Received Document + + Modifies the specified document. :param company_id: The ID of the company. (required) :type company_id: int @@ -1658,125 +2560,118 @@ def modify_received_document_with_http_info( :type document_id: int :param modify_received_document_request: Modified document. :type modify_received_document_request: ModifyReceivedDocumentRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyReceivedDocumentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_received_document_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_received_document" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_received_document_serialize( + company_id=company_id, + document_id=document_id, + modify_received_document_request=modify_received_document_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyReceivedDocumentResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + def _modify_received_document_serialize( + self, + company_id, + document_id, + modify_received_document_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_received_document_request"] is not None: - _body_params = _params["modify_received_document_request"] + if modify_received_document_request is not None: + _body_params = modify_received_document_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyReceivedDocumentResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/received_documents/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def upload_received_document_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1786,16 +2681,21 @@ def upload_received_document_attachment( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> UploadReceivedDocumentAttachmentResponse: # noqa: E501 - """Upload Received Document Attachment # noqa: E501 - - Uploads an attachment destined to a received document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UploadReceivedDocumentAttachmentResponse: + """Upload Received Document Attachment - >>> thread = api.upload_received_document_attachment(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to a received document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1803,31 +2703,55 @@ def upload_received_document_attachment( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UploadReceivedDocumentAttachmentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the upload_received_document_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.upload_received_document_attachment_with_http_info( - company_id, filename, attachment, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._upload_received_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadReceivedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def upload_received_document_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1837,16 +2761,101 @@ def upload_received_document_attachment_with_http_info( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Upload Received Document Attachment # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UploadReceivedDocumentAttachmentResponse]: + """Upload Received Document Attachment - Uploads an attachment destined to a received document. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Uploads an attachment destined to a received document. The actual association between the document and the attachment must be implemented separately, using the returned token. - >>> thread = api.upload_received_document_attachment_with_http_info(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param filename: Attachment file name + :type filename: str + :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] + :type attachment: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_received_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadReceivedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def upload_received_document_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + filename: Annotated[ + Optional[StrictStr], Field(description="Attachment file name") + ] = None, + attachment: Annotated[ + Optional[Union[StrictBytes, StrictStr]], + Field( + description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upload Received Document Attachment + + Uploads an attachment destined to a received document. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1854,114 +2863,109 @@ def upload_received_document_attachment_with_http_info( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UploadReceivedDocumentAttachmentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "filename", "attachment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_received_document_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._upload_received_document_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadReceivedDocumentAttachmentResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _upload_received_document_attachment_serialize( + self, + company_id, + filename, + attachment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} - if _params["filename"]: - _form_params.append(("filename", _params["filename"])) - - if _params["attachment"]: - _files["attachment"] = _params["attachment"] - + if filename is not None: + _form_params.append(("filename", filename)) + if attachment is not None: + _files["attachment"] = attachment # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["multipart/form-data"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "UploadReceivedDocumentAttachmentResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/received_documents/attachment", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/received_documents/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/settings_api.py b/fattureincloud_python_sdk/api/settings_api.py index 6700f5a2..3bcda486 100644 --- a/fattureincloud_python_sdk/api/settings_api.py +++ b/fattureincloud_python_sdk/api/settings_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -70,10 +76,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class SettingsApi: @@ -88,1007 +91,1539 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_payment_account( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_payment_account_request: Optional[CreatePaymentAccountRequest] = None, - **kwargs - ) -> CreatePaymentAccountResponse: # noqa: E501 - """Create Payment Account # noqa: E501 - - Creates a new payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreatePaymentAccountResponse: + """Create Payment Account - >>> thread = api.create_payment_account(company_id, create_payment_account_request, async_req=True) - >>> result = thread.get() + Creates a new payment account. :param company_id: The ID of the company. (required) :type company_id: int :param create_payment_account_request: :type create_payment_account_request: CreatePaymentAccountRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreatePaymentAccountResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_payment_account_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_payment_account_with_http_info( - company_id, create_payment_account_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_payment_account_serialize( + company_id=company_id, + create_payment_account_request=create_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_payment_account_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_payment_account_request: Optional[CreatePaymentAccountRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Payment Account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreatePaymentAccountResponse]: + """Create Payment Account + + Creates a new payment account. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_payment_account_request: + :type create_payment_account_request: CreatePaymentAccountRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payment_account_serialize( + company_id=company_id, + create_payment_account_request=create_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a new payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_payment_account_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_payment_account_request: Optional[CreatePaymentAccountRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Payment Account - >>> thread = api.create_payment_account_with_http_info(company_id, create_payment_account_request, async_req=True) - >>> result = thread.get() + Creates a new payment account. :param company_id: The ID of the company. (required) :type company_id: int :param create_payment_account_request: :type create_payment_account_request: CreatePaymentAccountRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreatePaymentAccountResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_payment_account_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_payment_account" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_payment_account_serialize( + company_id=company_id, + create_payment_account_request=create_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_payment_account_serialize( + self, + company_id, + create_payment_account_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_payment_account_request"] is not None: - _body_params = _params["create_payment_account_request"] + if create_payment_account_request is not None: + _body_params = create_payment_account_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreatePaymentAccountResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_accounts", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/settings/payment_accounts", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def create_payment_method( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_payment_method_request: Optional[CreatePaymentMethodRequest] = None, - **kwargs - ) -> CreatePaymentMethodResponse: # noqa: E501 - """Create Payment Method # noqa: E501 - - Creates a new payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreatePaymentMethodResponse: + """Create Payment Method - >>> thread = api.create_payment_method(company_id, create_payment_method_request, async_req=True) - >>> result = thread.get() + Creates a new payment method. :param company_id: The ID of the company. (required) :type company_id: int :param create_payment_method_request: :type create_payment_method_request: CreatePaymentMethodRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreatePaymentMethodResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_payment_method_with_http_info( - company_id, create_payment_method_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + company_id=company_id, + create_payment_method_request=create_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_payment_method_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_payment_method_request: Optional[CreatePaymentMethodRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Payment Method # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreatePaymentMethodResponse]: + """Create Payment Method + + Creates a new payment method. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_payment_method_request: + :type create_payment_method_request: CreatePaymentMethodRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + company_id=company_id, + create_payment_method_request=create_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Creates a new payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def create_payment_method_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_payment_method_request: Optional[CreatePaymentMethodRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Payment Method - >>> thread = api.create_payment_method_with_http_info(company_id, create_payment_method_request, async_req=True) - >>> result = thread.get() + Creates a new payment method. :param company_id: The ID of the company. (required) :type company_id: int :param create_payment_method_request: :type create_payment_method_request: CreatePaymentMethodRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreatePaymentMethodResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_payment_method_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_payment_method" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_payment_method_serialize( + company_id=company_id, + create_payment_method_request=create_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreatePaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_payment_method_serialize( + self, + company_id, + create_payment_method_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_payment_method_request"] is not None: - _body_params = _params["create_payment_method_request"] + if create_payment_method_request is not None: + _body_params = create_payment_method_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreatePaymentMethodResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_methods", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/settings/payment_methods", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def create_vat_type( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_vat_type_request: Optional[CreateVatTypeRequest] = None, - **kwargs - ) -> CreateVatTypeResponse: # noqa: E501 - """Create Vat Type # noqa: E501 - - Creates a vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateVatTypeResponse: + """Create Vat Type - >>> thread = api.create_vat_type(company_id, create_vat_type_request, async_req=True) - >>> result = thread.get() + Creates a vat type. :param company_id: The ID of the company. (required) :type company_id: int :param create_vat_type_request: :type create_vat_type_request: CreateVatTypeRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateVatTypeResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_vat_type_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_vat_type_with_http_info( - company_id, create_vat_type_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_vat_type_serialize( + company_id=company_id, + create_vat_type_request=create_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_vat_type_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_vat_type_request: Optional[CreateVatTypeRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Vat Type # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateVatTypeResponse]: + """Create Vat Type + + Creates a vat type. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_vat_type_request: + :type create_vat_type_request: CreateVatTypeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_vat_type_serialize( + company_id=company_id, + create_vat_type_request=create_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Creates a vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_vat_type_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_vat_type_request: Optional[CreateVatTypeRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Vat Type - >>> thread = api.create_vat_type_with_http_info(company_id, create_vat_type_request, async_req=True) - >>> result = thread.get() + Creates a vat type. :param company_id: The ID of the company. (required) :type company_id: int :param create_vat_type_request: :type create_vat_type_request: CreateVatTypeRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateVatTypeResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_vat_type_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_vat_type" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_vat_type_serialize( + company_id=company_id, + create_vat_type_request=create_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {"200": "CreateVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_vat_type_serialize( + self, + company_id, + create_vat_type_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_vat_type_request"] is not None: - _body_params = _params["create_vat_type_request"] + if create_vat_type_request is not None: + _body_params = create_vat_type_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateVatTypeResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/vat_types", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/settings/vat_types", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_payment_account( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], - **kwargs - ) -> None: # noqa: E501 - """Delete Payment Account # noqa: E501 - - Deletes the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Payment Account - >>> thread = api.delete_payment_account(company_id, payment_account_id, async_req=True) - >>> result = thread.get() + Deletes the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int :param payment_account_id: The Referred Payment Account Id. (required) :type payment_account_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_payment_account_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_payment_account_with_http_info( - company_id, payment_account_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_payment_account_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Payment Account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Payment Account + + Deletes the specified payment account. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_account_id: The Referred Payment Account Id. (required) + :type payment_account_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Deletes the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_payment_account_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_account_id: Annotated[ + StrictInt, Field(description="The Referred Payment Account Id.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Payment Account - >>> thread = api.delete_payment_account_with_http_info(company_id, payment_account_id, async_req=True) - >>> result = thread.get() + Deletes the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int :param payment_account_id: The Referred Payment Account Id. (required) :type payment_account_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "payment_account_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_payment_account" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_account_id"]: - _path_params["payment_account_id"] = _params["payment_account_id"] + def _delete_payment_account_serialize( + self, + company_id, + payment_account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_account_id is not None: + _path_params["payment_account_id"] = payment_account_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/settings/payment_accounts/{payment_account_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/settings/payment_accounts/{payment_account_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_payment_method( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], - **kwargs - ) -> None: # noqa: E501 - """Delete Payment Method # noqa: E501 - - Deletes the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Payment Method - >>> thread = api.delete_payment_method(company_id, payment_method_id, async_req=True) - >>> result = thread.get() + Deletes the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int :param payment_method_id: The Referred Payment Method Id. (required) :type payment_method_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_payment_method_with_http_info( - company_id, payment_method_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_payment_method_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Payment Method # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Payment Method + + Deletes the specified payment method. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_method_id: The Referred Payment Method Id. (required) + :type payment_method_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Deletes the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_payment_method_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_method_id: Annotated[ + StrictInt, Field(description="The Referred Payment Method Id.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Payment Method - >>> thread = api.delete_payment_method_with_http_info(company_id, payment_method_id, async_req=True) - >>> result = thread.get() + Deletes the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int :param payment_method_id: The Referred Payment Method Id. (required) :type payment_method_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "payment_method_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_payment_method" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_method_id"]: - _path_params["payment_method_id"] = _params["payment_method_id"] + def _delete_payment_method_serialize( + self, + company_id, + payment_method_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_method_id is not None: + _path_params["payment_method_id"] = payment_method_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_methods/{payment_method_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/settings/payment_methods/{payment_method_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_vat_type( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], - **kwargs - ) -> None: # noqa: E501 - """Delete Vat Type # noqa: E501 - - Deletes the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Vat Type - >>> thread = api.delete_vat_type(company_id, vat_type_id, async_req=True) - >>> result = thread.get() + Deletes the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int :param vat_type_id: The Referred Vat Type Id. (required) :type vat_type_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_vat_type_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_vat_type_with_http_info( - company_id, vat_type_id, **kwargs - ) # noqa: E501 - - @validate_arguments - def delete_vat_type_with_http_info( - self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_vat_type_with_http_info( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Vat Type # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Vat Type + + Deletes the specified vat type. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param vat_type_id: The Referred Vat Type Id. (required) + :type vat_type_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Deletes the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def delete_vat_type_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + vat_type_id: Annotated[ + StrictInt, Field(description="The Referred Vat Type Id.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Vat Type - >>> thread = api.delete_vat_type_with_http_info(company_id, vat_type_id, async_req=True) - >>> result = thread.get() + Deletes the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int :param vat_type_id: The Referred Vat Type Id. (required) :type vat_type_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "vat_type_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_vat_type" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["vat_type_id"]: - _path_params["vat_type_id"] = _params["vat_type_id"] + def _delete_vat_type_serialize( + self, + company_id, + vat_type_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if vat_type_id is not None: + _path_params["vat_type_id"] = vat_type_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/settings/vat_types/{vat_type_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/settings/vat_types/{vat_type_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_payment_account( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1096,16 +1631,21 @@ def get_payment_account( fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetPaymentAccountResponse: # noqa: E501 - """Get Payment Account # noqa: E501 - - Gets the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPaymentAccountResponse: + """Get Payment Account - >>> thread = api.get_payment_account(company_id, payment_account_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int @@ -1115,33 +1655,57 @@ def get_payment_account( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetPaymentAccountResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_payment_account_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_payment_account_with_http_info( - company_id, payment_account_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_payment_account_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1149,16 +1713,103 @@ def get_payment_account_with_http_info( fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Payment Account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPaymentAccountResponse]: + """Get Payment Account + + Gets the specified payment account. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_account_id: The Referred Payment Account Id. (required) + :type payment_account_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Gets the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def get_payment_account_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_account_id: Annotated[ + StrictInt, Field(description="The Referred Payment Account Id.") + ], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Payment Account - >>> thread = api.get_payment_account_with_http_info(company_id, payment_account_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int @@ -1168,120 +1819,114 @@ def get_payment_account_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetPaymentAccountResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "payment_account_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payment_account" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_account_id"]: - _path_params["payment_account_id"] = _params["payment_account_id"] + def _get_payment_account_serialize( + self, + company_id, + payment_account_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_account_id is not None: + _path_params["payment_account_id"] = payment_account_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetPaymentAccountResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_accounts/{payment_account_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/settings/payment_accounts/{payment_account_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_payment_method( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1289,16 +1934,21 @@ def get_payment_method( fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetPaymentMethodResponse: # noqa: E501 - """Get Payment Method # noqa: E501 - - Gets the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPaymentMethodResponse: + """Get Payment Method - >>> thread = api.get_payment_method(company_id, payment_method_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int @@ -1308,33 +1958,57 @@ def get_payment_method( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetPaymentMethodResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_payment_method_with_http_info( - company_id, payment_method_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_payment_method_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") @@ -1342,16 +2016,103 @@ def get_payment_method_with_http_info( fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Payment Method # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetPaymentMethodResponse]: + """Get Payment Method - Gets the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the specified payment method. - >>> thread = api.get_payment_method_with_http_info(company_id, payment_method_id, fields, fieldset, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_method_id: The Referred Payment Method Id. (required) + :type payment_method_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_payment_method_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_method_id: Annotated[ + StrictInt, Field(description="The Referred Payment Method Id.") + ], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Payment Method + + Gets the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int @@ -1361,299 +2122,384 @@ def get_payment_method_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetPaymentMethodResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "payment_method_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_payment_method" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_method_id"]: - _path_params["payment_method_id"] = _params["payment_method_id"] + def _get_payment_method_serialize( + self, + company_id, + payment_method_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_method_id is not None: + _path_params["payment_method_id"] = payment_method_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetPaymentMethodResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_methods/{payment_method_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/settings/payment_methods/{payment_method_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_vat_type( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], - **kwargs - ) -> GetVatTypeResponse: # noqa: E501 - """Get Vat Type # noqa: E501 - - Gets the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetVatTypeResponse: + """Get Vat Type - >>> thread = api.get_vat_type(company_id, vat_type_id, async_req=True) - >>> result = thread.get() + Gets the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int :param vat_type_id: The Referred Vat Type Id. (required) :type vat_type_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetVatTypeResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_vat_type_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_vat_type_with_http_info( - company_id, vat_type_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "GetVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_vat_type_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Vat Type # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetVatTypeResponse]: + """Get Vat Type - Gets the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Gets the specified vat type. - >>> thread = api.get_vat_type_with_http_info(company_id, vat_type_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param vat_type_id: The Referred Vat Type Id. (required) + :type vat_type_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "GetVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_vat_type_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + vat_type_id: Annotated[ + StrictInt, Field(description="The Referred Vat Type Id.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Vat Type + + Gets the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int :param vat_type_id: The Referred Vat Type Id. (required) :type vat_type_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetVatTypeResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "vat_type_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_vat_type" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {"200": "GetVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["vat_type_id"]: - _path_params["vat_type_id"] = _params["vat_type_id"] + def _get_vat_type_serialize( + self, + company_id, + vat_type_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if vat_type_id is not None: + _path_params["vat_type_id"] = vat_type_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetVatTypeResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/vat_types/{vat_type_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/settings/vat_types/{vat_type_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_payment_account( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], modify_payment_account_request: Optional[ModifyPaymentAccountRequest] = None, - **kwargs - ) -> ModifyPaymentAccountResponse: # noqa: E501 - """Modify Payment Account # noqa: E501 - - Modifies the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyPaymentAccountResponse: + """Modify Payment Account - >>> thread = api.modify_payment_account(company_id, payment_account_id, modify_payment_account_request, async_req=True) - >>> result = thread.get() + Modifies the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int @@ -1661,45 +2507,147 @@ def modify_payment_account( :type payment_account_id: int :param modify_payment_account_request: :type modify_payment_account_request: ModifyPaymentAccountRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyPaymentAccountResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_payment_account_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_payment_account_with_http_info( - company_id, payment_account_id, modify_payment_account_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + modify_payment_account_request=modify_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_payment_account_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_account_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Account Id.") + StrictInt, Field(description="The Referred Payment Account Id.") ], modify_payment_account_request: Optional[ModifyPaymentAccountRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Payment Account # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyPaymentAccountResponse]: + """Modify Payment Account - Modifies the specified payment account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Modifies the specified payment account. - >>> thread = api.modify_payment_account_with_http_info(company_id, payment_account_id, modify_payment_account_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_account_id: The Referred Payment Account Id. (required) + :type payment_account_id: int + :param modify_payment_account_request: + :type modify_payment_account_request: ModifyPaymentAccountRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + modify_payment_account_request=modify_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_payment_account_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_account_id: Annotated[ + StrictInt, Field(description="The Referred Payment Account Id.") + ], + modify_payment_account_request: Optional[ModifyPaymentAccountRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Payment Account + + Modifies the specified payment account. :param company_id: The ID of the company. (required) :type company_id: int @@ -1707,141 +2655,135 @@ def modify_payment_account_with_http_info( :type payment_account_id: int :param modify_payment_account_request: :type modify_payment_account_request: ModifyPaymentAccountRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyPaymentAccountResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "payment_account_id", - "modify_payment_account_request", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_payment_account" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_payment_account_serialize( + company_id=company_id, + payment_account_id=payment_account_id, + modify_payment_account_request=modify_payment_account_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentAccountResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_account_id"]: - _path_params["payment_account_id"] = _params["payment_account_id"] + def _modify_payment_account_serialize( + self, + company_id, + payment_account_id, + modify_payment_account_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_account_id is not None: + _path_params["payment_account_id"] = payment_account_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_payment_account_request"] is not None: - _body_params = _params["modify_payment_account_request"] + if modify_payment_account_request is not None: + _body_params = modify_payment_account_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyPaymentAccountResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_accounts/{payment_account_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/settings/payment_accounts/{payment_account_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_payment_method( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], modify_payment_method_request: Optional[ModifyPaymentMethodRequest] = None, - **kwargs - ) -> ModifyPaymentMethodResponse: # noqa: E501 - """Modify Payment Method # noqa: E501 - - Modifies the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyPaymentMethodResponse: + """Modify Payment Method - >>> thread = api.modify_payment_method(company_id, payment_method_id, modify_payment_method_request, async_req=True) - >>> result = thread.get() + Modifies the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int @@ -1849,45 +2791,147 @@ def modify_payment_method( :type payment_method_id: int :param modify_payment_method_request: :type modify_payment_method_request: ModifyPaymentMethodRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyPaymentMethodResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_payment_method_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_payment_method_with_http_info( - company_id, payment_method_id, modify_payment_method_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + modify_payment_method_request=modify_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_payment_method_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], payment_method_id: Annotated[ - StrictInt, Field(..., description="The Referred Payment Method Id.") + StrictInt, Field(description="The Referred Payment Method Id.") ], modify_payment_method_request: Optional[ModifyPaymentMethodRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Payment Method # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyPaymentMethodResponse]: + """Modify Payment Method + + Modifies the specified payment method. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param payment_method_id: The Referred Payment Method Id. (required) + :type payment_method_id: int + :param modify_payment_method_request: + :type modify_payment_method_request: ModifyPaymentMethodRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + modify_payment_method_request=modify_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - Modifies the specified payment method. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def modify_payment_method_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + payment_method_id: Annotated[ + StrictInt, Field(description="The Referred Payment Method Id.") + ], + modify_payment_method_request: Optional[ModifyPaymentMethodRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Payment Method - >>> thread = api.modify_payment_method_with_http_info(company_id, payment_method_id, modify_payment_method_request, async_req=True) - >>> result = thread.get() + Modifies the specified payment method. :param company_id: The ID of the company. (required) :type company_id: int @@ -1895,141 +2939,135 @@ def modify_payment_method_with_http_info( :type payment_method_id: int :param modify_payment_method_request: :type modify_payment_method_request: ModifyPaymentMethodRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyPaymentMethodResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "payment_method_id", - "modify_payment_method_request", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_payment_method" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_payment_method_serialize( + company_id=company_id, + payment_method_id=payment_method_id, + modify_payment_method_request=modify_payment_method_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyPaymentMethodResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["payment_method_id"]: - _path_params["payment_method_id"] = _params["payment_method_id"] + def _modify_payment_method_serialize( + self, + company_id, + payment_method_id, + modify_payment_method_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if payment_method_id is not None: + _path_params["payment_method_id"] = payment_method_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_payment_method_request"] is not None: - _body_params = _params["modify_payment_method_request"] + if modify_payment_method_request is not None: + _body_params = modify_payment_method_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyPaymentMethodResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/payment_methods/{payment_method_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/settings/payment_methods/{payment_method_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_vat_type( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], modify_vat_type_request: Optional[ModifyVatTypeRequest] = None, - **kwargs - ) -> ModifyVatTypeResponse: # noqa: E501 - """Modify Vat Type # noqa: E501 - - Modifies the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyVatTypeResponse: + """Modify Vat Type - >>> thread = api.modify_vat_type(company_id, vat_type_id, modify_vat_type_request, async_req=True) - >>> result = thread.get() + Modifies the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int @@ -2037,45 +3075,143 @@ def modify_vat_type( :type vat_type_id: int :param modify_vat_type_request: :type modify_vat_type_request: ModifyVatTypeRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyVatTypeResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_vat_type_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_vat_type_with_http_info( - company_id, vat_type_id, modify_vat_type_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + modify_vat_type_request=modify_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "ModifyVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_vat_type_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], vat_type_id: Annotated[ - StrictInt, Field(..., description="The Referred Vat Type Id.") + StrictInt, Field(description="The Referred Vat Type Id.") ], modify_vat_type_request: Optional[ModifyVatTypeRequest] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Vat Type # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyVatTypeResponse]: + """Modify Vat Type - Modifies the specified vat type. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Modifies the specified vat type. - >>> thread = api.modify_vat_type_with_http_info(company_id, vat_type_id, modify_vat_type_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param vat_type_id: The Referred Vat Type Id. (required) + :type vat_type_id: int + :param modify_vat_type_request: + :type modify_vat_type_request: ModifyVatTypeRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + modify_vat_type_request=modify_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {"200": "ModifyVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_vat_type_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + vat_type_id: Annotated[ + StrictInt, Field(description="The Referred Vat Type Id.") + ], + modify_vat_type_request: Optional[ModifyVatTypeRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Vat Type + + Modifies the specified vat type. :param company_id: The ID of the company. (required) :type company_id: int @@ -2083,113 +3219,106 @@ def modify_vat_type_with_http_info( :type vat_type_id: int :param modify_vat_type_request: :type modify_vat_type_request: ModifyVatTypeRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyVatTypeResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "vat_type_id", "modify_vat_type_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_vat_type" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_vat_type_serialize( + company_id=company_id, + vat_type_id=vat_type_id, + modify_vat_type_request=modify_vat_type_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {"200": "ModifyVatTypeResponse"} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["vat_type_id"]: - _path_params["vat_type_id"] = _params["vat_type_id"] + def _modify_vat_type_serialize( + self, + company_id, + vat_type_id, + modify_vat_type_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if vat_type_id is not None: + _path_params["vat_type_id"] = vat_type_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_vat_type_request"] is not None: - _body_params = _params["modify_vat_type_request"] + if modify_vat_type_request is not None: + _body_params = modify_vat_type_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyVatTypeResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/settings/vat_types/{vat_type_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/settings/vat_types/{vat_type_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/suppliers_api.py b/fattureincloud_python_sdk/api/suppliers_api.py index c15ac364..d18d043b 100644 --- a/fattureincloud_python_sdk/api/suppliers_api.py +++ b/fattureincloud_python_sdk/api/suppliers_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, conint +from pydantic import StrictInt, StrictStr, field_validator from typing import Optional @@ -43,10 +49,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class SuppliersApi: @@ -61,366 +64,543 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_supplier( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_supplier_request: Annotated[ Optional[CreateSupplierRequest], Field(description="The supplier to create") ] = None, - **kwargs - ) -> CreateSupplierResponse: # noqa: E501 - """Create Supplier # noqa: E501 - - Creates a new supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateSupplierResponse: + """Create Supplier - >>> thread = api.create_supplier(company_id, create_supplier_request, async_req=True) - >>> result = thread.get() + Creates a new supplier. :param company_id: The ID of the company. (required) :type company_id: int :param create_supplier_request: The supplier to create :type create_supplier_request: CreateSupplierRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateSupplierResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_supplier_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_supplier_with_http_info( - company_id, create_supplier_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_supplier_serialize( + company_id=company_id, + create_supplier_request=create_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateSupplierResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_supplier_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_supplier_request: Annotated[ Optional[CreateSupplierRequest], Field(description="The supplier to create") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create Supplier # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateSupplierResponse]: + """Create Supplier + + Creates a new supplier. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_supplier_request: The supplier to create + :type create_supplier_request: CreateSupplierRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_supplier_serialize( + company_id=company_id, + create_supplier_request=create_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Creates a new supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateSupplierResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.create_supplier_with_http_info(company_id, create_supplier_request, async_req=True) - >>> result = thread.get() + @validate_call + def create_supplier_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_supplier_request: Annotated[ + Optional[CreateSupplierRequest], Field(description="The supplier to create") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Supplier + + Creates a new supplier. :param company_id: The ID of the company. (required) :type company_id: int :param create_supplier_request: The supplier to create :type create_supplier_request: CreateSupplierRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateSupplierResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_supplier_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._create_supplier_serialize( + company_id=company_id, + create_supplier_request=create_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_supplier" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateSupplierResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _create_supplier_serialize( + self, + company_id, + create_supplier_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_supplier_request"] is not None: - _body_params = _params["create_supplier_request"] + if create_supplier_request is not None: + _body_params = create_supplier_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateSupplierResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/entities/suppliers", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/entities/suppliers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_supplier( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete Supplier # noqa: E501 - - Deletes the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_supplier(company_id, supplier_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Supplier + + Deletes the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int :param supplier_id: The ID of the supplier. (required) :type supplier_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_supplier_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_supplier_with_http_info( - company_id, supplier_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_supplier_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Supplier # noqa: E501 - - Deletes the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_supplier_with_http_info(company_id, supplier_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Supplier + + Deletes the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int :param supplier_id: The ID of the supplier. (required) :type supplier_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "supplier_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_supplier" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_supplier_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Supplier - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Deletes the specified supplier. - if _params["supplier_id"]: - _path_params["supplier_id"] = _params["supplier_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param supplier_id: The ID of the supplier. (required) + :type supplier_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_supplier_serialize( + self, + company_id, + supplier_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if supplier_id is not None: + _path_params["supplier_id"] = supplier_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/entities/suppliers/{supplier_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/entities/suppliers/{supplier_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_supplier( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetSupplierResponse: # noqa: E501 - """Get Supplier # noqa: E501 - - Gets the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetSupplierResponse: + """Get Supplier - >>> thread = api.get_supplier(company_id, supplier_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int @@ -430,50 +610,79 @@ def get_supplier( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetSupplierResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_supplier_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_supplier_with_http_info( - company_id, supplier_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetSupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_supplier_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Supplier # noqa: E501 - - Gets the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetSupplierResponse]: + """Get Supplier - >>> thread = api.get_supplier_with_http_info(company_id, supplier_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int @@ -483,120 +692,196 @@ def get_supplier_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetSupplierResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "supplier_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetSupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_supplier" % _key - ) - _params[_key] = _val - del _params["kwargs"] + @validate_call + def get_supplier_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Supplier - _collection_formats = {} + Gets the specified supplier. - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param supplier_id: The ID of the supplier. (required) + :type supplier_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - if _params["supplier_id"]: - _path_params["supplier_id"] = _params["supplier_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetSupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_supplier_serialize( + self, + company_id, + supplier_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if supplier_id is not None: + _path_params["supplier_id"] = supplier_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetSupplierResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/suppliers/{supplier_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/entities/suppliers/{supplier_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_suppliers( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -613,22 +898,27 @@ def list_suppliers( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListSuppliersResponse: # noqa: E501 - """List Suppliers # noqa: E501 - - Lists the suppliers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListSuppliersResponse: + """List Suppliers - >>> thread = api.list_suppliers(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the suppliers. :param company_id: The ID of the company. (required) :type company_id: int @@ -644,31 +934,59 @@ def list_suppliers( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListSuppliersResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_suppliers_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_suppliers_with_http_info( - company_id, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_suppliers_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListSuppliersResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_suppliers_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -685,22 +1003,132 @@ def list_suppliers_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Suppliers # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListSuppliersResponse]: + """List Suppliers - Lists the suppliers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Lists the suppliers. - >>> thread = api.list_suppliers_with_http_info(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_suppliers_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListSuppliersResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_suppliers_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Suppliers + + Lists the suppliers. :param company_id: The ID of the company. (required) :type company_id: int @@ -716,155 +1144,151 @@ def list_suppliers_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListSuppliersResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_suppliers_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_suppliers" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListSuppliersResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_suppliers_serialize( + self, + company_id, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListSuppliersResponse", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/suppliers", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/entities/suppliers", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_supplier( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], modify_supplier_request: Annotated[ Optional[ModifySupplierRequest], Field( description="The modified Supplier. First level parameters are managed in delta mode." ), ] = None, - **kwargs - ) -> ModifySupplierResponse: # noqa: E501 - """Modify Supplier # noqa: E501 - - Modifies the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifySupplierResponse: + """Modify Supplier - >>> thread = api.modify_supplier(company_id, supplier_id, modify_supplier_request, async_req=True) - >>> result = thread.get() + Modifies the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int @@ -872,50 +1296,78 @@ def modify_supplier( :type supplier_id: int :param modify_supplier_request: The modified Supplier. First level parameters are managed in delta mode. :type modify_supplier_request: ModifySupplierRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifySupplierResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_supplier_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_supplier_with_http_info( - company_id, supplier_id, modify_supplier_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + modify_supplier_request=modify_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifySupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_supplier_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - supplier_id: Annotated[ - StrictInt, Field(..., description="The ID of the supplier.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], modify_supplier_request: Annotated[ Optional[ModifySupplierRequest], Field( description="The modified Supplier. First level parameters are managed in delta mode." ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Supplier # noqa: E501 - - Modifies the specified supplier. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifySupplierResponse]: + """Modify Supplier - >>> thread = api.modify_supplier_with_http_info(company_id, supplier_id, modify_supplier_request, async_req=True) - >>> result = thread.get() + Modifies the specified supplier. :param company_id: The ID of the company. (required) :type company_id: int @@ -923,115 +1375,189 @@ def modify_supplier_with_http_info( :type supplier_id: int :param modify_supplier_request: The modified Supplier. First level parameters are managed in delta mode. :type modify_supplier_request: ModifySupplierRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifySupplierResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "supplier_id", "modify_supplier_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._modify_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + modify_supplier_request=modify_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_supplier" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifySupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_supplier_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + supplier_id: Annotated[StrictInt, Field(description="The ID of the supplier.")], + modify_supplier_request: Annotated[ + Optional[ModifySupplierRequest], + Field( + description="The modified Supplier. First level parameters are managed in delta mode." + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Supplier + + Modifies the specified supplier. - _collection_formats = {} + :param company_id: The ID of the company. (required) + :type company_id: int + :param supplier_id: The ID of the supplier. (required) + :type supplier_id: int + :param modify_supplier_request: The modified Supplier. First level parameters are managed in delta mode. + :type modify_supplier_request: ModifySupplierRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_supplier_serialize( + company_id=company_id, + supplier_id=supplier_id, + modify_supplier_request=modify_supplier_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifySupplierResponse", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["supplier_id"]: - _path_params["supplier_id"] = _params["supplier_id"] + def _modify_supplier_serialize( + self, + company_id, + supplier_id, + modify_supplier_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if supplier_id is not None: + _path_params["supplier_id"] = supplier_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_supplier_request"] is not None: - _body_params = _params["modify_supplier_request"] + if modify_supplier_request is not None: + _body_params = modify_supplier_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifySupplierResponse", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/entities/suppliers/{supplier_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/entities/suppliers/{supplier_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/taxes_api.py b/fattureincloud_python_sdk/api/taxes_api.py index 796f8cd5..55342ff5 100644 --- a/fattureincloud_python_sdk/api/taxes_api.py +++ b/fattureincloud_python_sdk/api/taxes_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictBytes, StrictInt, StrictStr, conint +from pydantic import StrictBytes, StrictInt, StrictStr, field_validator from typing import Optional, Union @@ -36,10 +42,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class TaxesApi: @@ -54,528 +57,791 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_f24( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_f24_request: Annotated[ Optional[CreateF24Request], Field(description="The F24 to create") ] = None, - **kwargs - ) -> CreateF24Response: # noqa: E501 - """Create F24 # noqa: E501 - - Creates a new F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateF24Response: + """Create F24 - >>> thread = api.create_f24(company_id, create_f24_request, async_req=True) - >>> result = thread.get() + Creates a new F24. :param company_id: The ID of the company. (required) :type company_id: int :param create_f24_request: The F24 to create :type create_f24_request: CreateF24Request - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateF24Response - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_f24_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_f24_with_http_info( - company_id, create_f24_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_f24_serialize( + company_id=company_id, + create_f24_request=create_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_f24_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_f24_request: Annotated[ Optional[CreateF24Request], Field(description="The F24 to create") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create F24 # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateF24Response]: + """Create F24 + + Creates a new F24. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_f24_request: The F24 to create + :type create_f24_request: CreateF24Request + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_f24_serialize( + company_id=company_id, + create_f24_request=create_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Creates a new F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.create_f24_with_http_info(company_id, create_f24_request, async_req=True) - >>> result = thread.get() + @validate_call + def create_f24_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_f24_request: Annotated[ + Optional[CreateF24Request], Field(description="The F24 to create") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create F24 + + Creates a new F24. :param company_id: The ID of the company. (required) :type company_id: int :param create_f24_request: The F24 to create :type create_f24_request: CreateF24Request - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateF24Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_f24_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._create_f24_serialize( + company_id=company_id, + create_f24_request=create_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_f24" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _create_f24_serialize( + self, + company_id, + create_f24_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_f24_request"] is not None: - _body_params = _params["create_f24_request"] + if create_f24_request is not None: + _body_params = create_f24_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateF24Response", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/taxes", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/taxes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_f24( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete F24 # noqa: E501 - - Removes the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_f24(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete F24 + + Removes the specified F24. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_f24_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_f24_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_f24_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_f24_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete F24 # noqa: E501 - - Removes the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_f24_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete F24 + + Removes the specified F24. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_f24_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_f24" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_f24_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete F24 - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Removes the specified F24. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_f24_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _delete_f24_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/taxes/{document_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/taxes/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_f24_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> None: # noqa: E501 - """Delete F24 Attachment # noqa: E501 - - Removes the attachment of the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_f24_attachment(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete F24 Attachment + + Removes the attachment of the specified F24. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_f24_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_f24_attachment_with_http_info( - company_id, document_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_f24_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_f24_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete F24 Attachment # noqa: E501 - - Removes the attachment of the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_f24_attachment_with_http_info(company_id, document_id, async_req=True) - >>> result = thread.get() + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete F24 Attachment + + Removes the attachment of the specified F24. :param company_id: The ID of the company. (required) :type company_id: int :param document_id: The ID of the document. (required) :type document_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "document_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._delete_f24_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_f24_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def delete_f24_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete F24 Attachment - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Removes the attachment of the specified F24. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_f24_attachment_serialize( + company_id=company_id, + document_id=document_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _delete_f24_attachment_serialize( + self, + company_id, + document_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - _response_types_map = {} - - return self.api_client.call_api( - "/c/{company_id}/taxes/{document_id}/attachment", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/taxes/{document_id}/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_f24( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> GetF24Response: # noqa: E501 - """Get F24 # noqa: E501 - - Gets the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetF24Response: + """Get F24 - >>> thread = api.get_f24(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified F24. :param company_id: The ID of the company. (required) :type company_id: int @@ -585,50 +851,79 @@ def get_f24( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetF24Response - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_f24_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_f24_with_http_info( - company_id, document_id, fields, fieldset, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_f24_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_f24_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, fieldset: Annotated[ Optional[StrictStr], Field(description="Name of the fieldset.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get F24 # noqa: E501 - - Gets the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetF24Response]: + """Get F24 - >>> thread = api.get_f24_with_http_info(company_id, document_id, fields, fieldset, async_req=True) - >>> result = thread.get() + Gets the specified F24. :param company_id: The ID of the company. (required) :type company_id: int @@ -638,120 +933,196 @@ def get_f24_with_http_info( :type fields: str :param fieldset: Name of the fieldset. :type fieldset: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetF24Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "fields", "fieldset"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_f24_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_f24" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def get_f24_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get F24 - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Gets the specified F24. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_f24_serialize( + company_id=company_id, + document_id=document_id, + fields=fields, + fieldset=fieldset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _get_f24_serialize( + self, + company_id, + document_id, + fields, + fieldset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetF24Response", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/taxes/{document_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/taxes/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_f24( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -768,22 +1139,27 @@ def list_f24( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ListF24Response: # noqa: E501 - """List F24 # noqa: E501 - - Lists the F24s. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListF24Response: + """List F24 - >>> thread = api.list_f24(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the F24s. :param company_id: The ID of the company. (required) :type company_id: int @@ -799,31 +1175,59 @@ def list_f24( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListF24Response - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_f24_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_f24_with_http_info( - company_id, fields, fieldset, sort, page, per_page, q, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_f24_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListF24Response", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_f24_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], fields: Annotated[ Optional[StrictStr], Field(description="List of comma-separated fields.") ] = None, @@ -840,22 +1244,132 @@ def list_f24_with_http_info( Optional[StrictInt], Field(description="The page to retrieve.") ] = None, per_page: Annotated[ - Optional[conint(strict=True, le=100, ge=1)], + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The size of the page."), ] = None, q: Annotated[ Optional[StrictStr], Field(description="Query for filtering the results.") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """List F24 # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListF24Response]: + """List F24 + + Lists the F24s. - Lists the F24s. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param company_id: The ID of the company. (required) + :type company_id: int + :param fields: List of comma-separated fields. + :type fields: str + :param fieldset: Name of the fieldset. + :type fieldset: str + :param sort: List of comma-separated fields for result sorting (minus for desc sorting). + :type sort: str + :param page: The page to retrieve. + :type page: int + :param per_page: The size of the page. + :type per_page: int + :param q: Query for filtering the results. + :type q: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_f24_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListF24Response", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_f24_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + fields: Annotated[ + Optional[StrictStr], Field(description="List of comma-separated fields.") + ] = None, + fieldset: Annotated[ + Optional[StrictStr], Field(description="Name of the fieldset.") + ] = None, + sort: Annotated[ + Optional[StrictStr], + Field( + description="List of comma-separated fields for result sorting (minus for desc sorting)." + ), + ] = None, + page: Annotated[ + Optional[StrictInt], Field(description="The page to retrieve.") + ] = None, + per_page: Annotated[ + Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], + Field(description="The size of the page."), + ] = None, + q: Annotated[ + Optional[StrictStr], Field(description="Query for filtering the results.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List F24 - >>> thread = api.list_f24_with_http_info(company_id, fields, fieldset, sort, page, per_page, q, async_req=True) - >>> result = thread.get() + Lists the F24s. :param company_id: The ID of the company. (required) :type company_id: int @@ -871,152 +1385,148 @@ def list_f24_with_http_info( :type per_page: int :param q: Query for filtering the results. :type q: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListF24Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "fields", - "fieldset", - "sort", - "page", - "per_page", - "q", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_f24_serialize( + company_id=company_id, + fields=fields, + fieldset=fieldset, + sort=sort, + page=page, + per_page=per_page, + q=q, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_f24" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListF24Response", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _list_f24_serialize( + self, + company_id, + fields, + fieldset, + sort, + page, + per_page, + q, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] - if _params.get("fields") is not None: # noqa: E501 - _query_params.append(("fields", _params["fields"])) + if fields is not None: + _query_params.append(("fields", fields)) - if _params.get("fieldset") is not None: # noqa: E501 - _query_params.append(("fieldset", _params["fieldset"])) + if fieldset is not None: + _query_params.append(("fieldset", fieldset)) - if _params.get("sort") is not None: # noqa: E501 - _query_params.append(("sort", _params["sort"])) + if sort is not None: + _query_params.append(("sort", sort)) - if _params.get("page") is not None: # noqa: E501 - _query_params.append(("page", _params["page"])) + if page is not None: + _query_params.append(("page", page)) - if _params.get("per_page") is not None: # noqa: E501 - _query_params.append(("per_page", _params["per_page"])) + if per_page is not None: + _query_params.append(("per_page", per_page)) - if _params.get("q") is not None: # noqa: E501 - _query_params.append(("q", _params["q"])) + if q is not None: + _query_params.append(("q", q)) # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListF24Response", - "401": None, - } - - return self.api_client.call_api( - "/c/{company_id}/taxes", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/taxes", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_f24( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_f24_request: Annotated[ Optional[ModifyF24Request], Field(description="The F24") ] = None, - **kwargs - ) -> ModifyF24Response: # noqa: E501 - """Modify F24 # noqa: E501 - - Modifies the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyF24Response: + """Modify F24 - >>> thread = api.modify_f24(company_id, document_id, modify_f24_request, async_req=True) - >>> result = thread.get() + Modifies the specified F24. :param company_id: The ID of the company. (required) :type company_id: int @@ -1024,47 +1534,75 @@ def modify_f24( :type document_id: int :param modify_f24_request: The F24 :type modify_f24_request: ModifyF24Request - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyF24Response - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_f24_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_f24_with_http_info( - company_id, document_id, modify_f24_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_f24_serialize( + company_id=company_id, + document_id=document_id, + modify_f24_request=modify_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_f24_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - document_id: Annotated[ - StrictInt, Field(..., description="The ID of the document.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], modify_f24_request: Annotated[ Optional[ModifyF24Request], Field(description="The F24") ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify F24 # noqa: E501 - - Modifies the specified F24. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyF24Response]: + """Modify F24 - >>> thread = api.modify_f24_with_http_info(company_id, document_id, modify_f24_request, async_req=True) - >>> result = thread.get() + Modifies the specified F24. :param company_id: The ID of the company. (required) :type company_id: int @@ -1072,125 +1610,194 @@ def modify_f24_with_http_info( :type document_id: int :param modify_f24_request: The F24 :type modify_f24_request: ModifyF24Request - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyF24Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "document_id", "modify_f24_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._modify_f24_serialize( + company_id=company_id, + document_id=document_id, + modify_f24_request=modify_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_f24" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def modify_f24_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + document_id: Annotated[StrictInt, Field(description="The ID of the document.")], + modify_f24_request: Annotated[ + Optional[ModifyF24Request], Field(description="The F24") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify F24 - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + Modifies the specified F24. - if _params["document_id"]: - _path_params["document_id"] = _params["document_id"] + :param company_id: The ID of the company. (required) + :type company_id: int + :param document_id: The ID of the document. (required) + :type document_id: int + :param modify_f24_request: The F24 + :type modify_f24_request: ModifyF24Request + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_f24_serialize( + company_id=company_id, + document_id=document_id, + modify_f24_request=modify_f24_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyF24Response", + "401": None, + "404": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + def _modify_f24_serialize( + self, + company_id, + document_id, + modify_f24_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if document_id is not None: + _path_params["document_id"] = document_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_f24_request"] is not None: - _body_params = _params["modify_f24_request"] + if modify_f24_request is not None: + _body_params = modify_f24_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyF24Response", - "401": None, - "404": None, - } - - return self.api_client.call_api( - "/c/{company_id}/taxes/{document_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/taxes/{document_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def upload_f24_attachment( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1200,16 +1807,21 @@ def upload_f24_attachment( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> UploadF24AttachmentResponse: # noqa: E501 - """Upload F24 Attachment # noqa: E501 - - Uploads an attachment destined to a F24. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UploadF24AttachmentResponse: + """Upload F24 Attachment - >>> thread = api.upload_f24_attachment(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + Uploads an attachment destined to a F24. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1217,31 +1829,54 @@ def upload_f24_attachment( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UploadF24AttachmentResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the upload_f24_attachment_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.upload_f24_attachment_with_http_info( - company_id, filename, attachment, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._upload_f24_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadF24AttachmentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def upload_f24_attachment_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], filename: Annotated[ Optional[StrictStr], Field(description="Attachment file name") ] = None, @@ -1251,16 +1886,100 @@ def upload_f24_attachment_with_http_info( description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" ), ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Upload F24 Attachment # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UploadF24AttachmentResponse]: + """Upload F24 Attachment - Uploads an attachment destined to a F24. The actual association between the document and the attachment must be implemented separately, using the returned token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Uploads an attachment destined to a F24. The actual association between the document and the attachment must be implemented separately, using the returned token. - >>> thread = api.upload_f24_attachment_with_http_info(company_id, filename, attachment, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param filename: Attachment file name + :type filename: str + :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] + :type attachment: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_f24_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadF24AttachmentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def upload_f24_attachment_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + filename: Annotated[ + Optional[StrictStr], Field(description="Attachment file name") + ] = None, + attachment: Annotated[ + Optional[Union[StrictBytes, StrictStr]], + Field( + description="Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx]" + ), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Upload F24 Attachment + + Uploads an attachment destined to a F24. The actual association between the document and the attachment must be implemented separately, using the returned token. :param company_id: The ID of the company. (required) :type company_id: int @@ -1268,113 +1987,108 @@ def upload_f24_attachment_with_http_info( :type filename: str :param attachment: Attachment file [.png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx] :type attachment: bytearray - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UploadF24AttachmentResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "filename", "attachment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._upload_f24_attachment_serialize( + company_id=company_id, + filename=filename, + attachment=attachment, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_f24_attachment" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "UploadF24AttachmentResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - _collection_formats = {} + def _upload_f24_attachment_serialize( + self, + company_id, + filename, + attachment, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] - + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} - if _params["filename"]: - _form_params.append(("filename", _params["filename"])) - - if _params["attachment"]: - _files["attachment"] = _params["attachment"] - + if filename is not None: + _form_params.append(("filename", filename)) + if attachment is not None: + _files["attachment"] = attachment # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["multipart/form-data"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "UploadF24AttachmentResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/taxes/attachment", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/taxes/attachment", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/user_api.py b/fattureincloud_python_sdk/api/user_api.py index 83c3651d..bebc4160 100644 --- a/fattureincloud_python_sdk/api/user_api.py +++ b/fattureincloud_python_sdk/api/user_api.py @@ -13,11 +13,16 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any + +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated from fattureincloud_python_sdk.models.get_user_info_response import GetUserInfoResponse from fattureincloud_python_sdk.models.list_user_companies_response import ( @@ -26,10 +31,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class UserApi: @@ -44,272 +46,454 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments - def get_user_info(self, **kwargs) -> GetUserInfoResponse: # noqa: E501 - """Get User Info # noqa: E501 + @validate_call + def get_user_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetUserInfoResponse: + """Get User Info + + Gets the current user's info. - Gets the current user's info. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - >>> thread = api.get_user_info(async_req=True) - >>> result = thread.get() + _param = self._get_user_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetUserInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_user_info_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetUserInfoResponse]: + """Get User Info + + Gets the current user's info. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetUserInfoResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_user_info_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_user_info_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def get_user_info_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Get User Info # noqa: E501 - - Gets the current user's info. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_user_info_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetUserInfoResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._get_user_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_info" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetUserInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def get_user_info_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get User Info + + Gets the current user's info. - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetUserInfoResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _get_user_info_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetUserInfoResponse", - "401": None, - } - - return self.api_client.call_api( - "/user/info", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/user/info", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments - def list_user_companies(self, **kwargs) -> ListUserCompaniesResponse: # noqa: E501 - """List User Companies # noqa: E501 + @validate_call + def list_user_companies( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListUserCompaniesResponse: + """List User Companies + + Lists the companies controlled by the current user. - Lists the companies controlled by the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 - >>> thread = api.list_user_companies(async_req=True) - >>> result = thread.get() + _param = self._list_user_companies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUserCompaniesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_user_companies_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListUserCompaniesResponse]: + """List User Companies + + Lists the companies controlled by the current user. - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListUserCompaniesResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_user_companies_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_user_companies_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_user_companies_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """List User Companies # noqa: E501 - - Lists the companies controlled by the current user. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_user_companies_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListUserCompaniesResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + """ # noqa: E501 + + _param = self._list_user_companies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_user_companies" % _key - ) - _params[_key] = _val - del _params["kwargs"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUserCompaniesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - _collection_formats = {} + @validate_call + def list_user_companies_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List User Companies + + Lists the companies controlled by the current user. - # process the path parameters - _path_params = {} + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_user_companies_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListUserCompaniesResponse", + "401": None, + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_user_companies_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListUserCompaniesResponse", - "401": None, - } - - return self.api_client.call_api( - "/user/companies", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/user/companies", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api/webhooks_api.py b/fattureincloud_python_sdk/api/webhooks_api.py index 1499af7b..65852d2f 100644 --- a/fattureincloud_python_sdk/api/webhooks_api.py +++ b/fattureincloud_python_sdk/api/webhooks_api.py @@ -13,14 +13,20 @@ """ # noqa: E501 -import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Dict, List, Optional, Tuple, Union, Any +try: + from typing import Annotated +except ImportError: + from typing_extensions import Annotated + +from pydantic import Field from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr +from pydantic import StrictInt, StrictStr from typing import Optional @@ -45,10 +51,7 @@ from fattureincloud_python_sdk.api_client import ApiClient from fattureincloud_python_sdk.api_response import ApiResponse -from fattureincloud_python_sdk.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError, -) +from fattureincloud_python_sdk.rest import RESTResponseType class WebhooksApi: @@ -63,684 +66,1045 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_webhooks_subscription( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_webhooks_subscription_request: Optional[ CreateWebhooksSubscriptionRequest ] = None, - **kwargs - ) -> CreateWebhooksSubscriptionResponse: # noqa: E501 - """Create a Webhook Subscription # noqa: E501 - - Register some webhooks Subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateWebhooksSubscriptionResponse: + """Create a Webhook Subscription - >>> thread = api.create_webhooks_subscription(company_id, create_webhooks_subscription_request, async_req=True) - >>> result = thread.get() + Register some webhooks Subscriptions. :param company_id: The ID of the company. (required) :type company_id: int :param create_webhooks_subscription_request: :type create_webhooks_subscription_request: CreateWebhooksSubscriptionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CreateWebhooksSubscriptionResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_webhooks_subscription_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_webhooks_subscription_with_http_info( - company_id, create_webhooks_subscription_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._create_webhooks_subscription_serialize( + company_id=company_id, + create_webhooks_subscription_request=create_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def create_webhooks_subscription_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], create_webhooks_subscription_request: Optional[ CreateWebhooksSubscriptionRequest ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Create a Webhook Subscription # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CreateWebhooksSubscriptionResponse]: + """Create a Webhook Subscription + + Register some webhooks Subscriptions. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param create_webhooks_subscription_request: + :type create_webhooks_subscription_request: CreateWebhooksSubscriptionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_webhooks_subscription_serialize( + company_id=company_id, + create_webhooks_subscription_request=create_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Register some webhooks Subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - >>> thread = api.create_webhooks_subscription_with_http_info(company_id, create_webhooks_subscription_request, async_req=True) - >>> result = thread.get() + @validate_call + def create_webhooks_subscription_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + create_webhooks_subscription_request: Optional[ + CreateWebhooksSubscriptionRequest + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a Webhook Subscription + + Register some webhooks Subscriptions. :param company_id: The ID of the company. (required) :type company_id: int :param create_webhooks_subscription_request: :type create_webhooks_subscription_request: CreateWebhooksSubscriptionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CreateWebhooksSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "create_webhooks_subscription_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_webhooks_subscription" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._create_webhooks_subscription_serialize( + company_id=company_id, + create_webhooks_subscription_request=create_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _create_webhooks_subscription_serialize( + self, + company_id, + create_webhooks_subscription_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["create_webhooks_subscription_request"] is not None: - _body_params = _params["create_webhooks_subscription_request"] + if create_webhooks_subscription_request is not None: + _body_params = create_webhooks_subscription_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "CreateWebhooksSubscriptionResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/subscriptions", - "POST", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="POST", + resource_path="/c/{company_id}/subscriptions", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def delete_webhooks_subscription( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], - **kwargs - ) -> None: # noqa: E501 - """Delete Webhooks Subscription # noqa: E501 - - Delete a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Webhooks Subscription - >>> thread = api.delete_webhooks_subscription(company_id, subscription_id, async_req=True) - >>> result = thread.get() + Delete a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int :param subscription_id: The ID of the subscription. (required) :type subscription_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_webhooks_subscription_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_webhooks_subscription_with_http_info( - company_id, subscription_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._delete_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def delete_webhooks_subscription_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Delete Webhooks Subscription # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Webhooks Subscription - Delete a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Delete a webhooks subscription. - >>> thread = api.delete_webhooks_subscription_with_http_info(company_id, subscription_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param subscription_id: The ID of the subscription. (required) + :type subscription_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_webhooks_subscription_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + subscription_id: Annotated[ + StrictStr, Field(description="The ID of the subscription.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Webhooks Subscription + + Delete a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int :param subscription_id: The ID of the subscription. (required) :type subscription_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["company_id", "subscription_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_webhooks_subscription" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._delete_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = {} + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["subscription_id"]: - _path_params["subscription_id"] = _params["subscription_id"] + def _delete_webhooks_subscription_serialize( + self, + company_id, + subscription_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if subscription_id is not None: + _path_params["subscription_id"] = subscription_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = {} - return self.api_client.call_api( - "/c/{company_id}/subscriptions/{subscription_id}", - "DELETE", - _path_params, - _query_params, - _header_params, + # authentication setting + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/c/{company_id}/subscriptions/{subscription_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def get_webhooks_subscription( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], - **kwargs - ) -> GetWebhooksSubscriptionResponse: # noqa: E501 - """Get Webhooks Subscription # noqa: E501 - - Get a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetWebhooksSubscriptionResponse: + """Get Webhooks Subscription - >>> thread = api.get_webhooks_subscription(company_id, subscription_id, async_req=True) - >>> result = thread.get() + Get a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int :param subscription_id: The ID of the subscription. (required) :type subscription_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: GetWebhooksSubscriptionResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the get_webhooks_subscription_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.get_webhooks_subscription_with_http_info( - company_id, subscription_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._get_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def get_webhooks_subscription_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """Get Webhooks Subscription # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetWebhooksSubscriptionResponse]: + """Get Webhooks Subscription - Get a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Get a webhooks subscription. - >>> thread = api.get_webhooks_subscription_with_http_info(company_id, subscription_id, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param subscription_id: The ID of the subscription. (required) + :type subscription_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_webhooks_subscription_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + subscription_id: Annotated[ + StrictStr, Field(description="The ID of the subscription.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Webhooks Subscription + + Get a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int :param subscription_id: The ID of the subscription. (required) :type subscription_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(GetWebhooksSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id", "subscription_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_webhooks_subscription" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._get_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["subscription_id"]: - _path_params["subscription_id"] = _params["subscription_id"] + def _get_webhooks_subscription_serialize( + self, + company_id, + subscription_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if subscription_id is not None: + _path_params["subscription_id"] = subscription_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "GetWebhooksSubscriptionResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/subscriptions/{subscription_id}", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/subscriptions/{subscription_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def list_webhooks_subscriptions( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ListWebhooksSubscriptionsResponse: # noqa: E501 - """List Webhooks Subscriptions # noqa: E501 - - List active webhooks subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListWebhooksSubscriptionsResponse: + """List Webhooks Subscriptions - >>> thread = api.list_webhooks_subscriptions(company_id, async_req=True) - >>> result = thread.get() + List active webhooks subscriptions. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListWebhooksSubscriptionsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_webhooks_subscriptions_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_webhooks_subscriptions_with_http_info( - company_id, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._list_webhooks_subscriptions_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListWebhooksSubscriptionsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def list_webhooks_subscriptions_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], - **kwargs - ) -> ApiResponse: # noqa: E501 - """List Webhooks Subscriptions # noqa: E501 + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListWebhooksSubscriptionsResponse]: + """List Webhooks Subscriptions + + List active webhooks subscriptions. + + :param company_id: The ID of the company. (required) + :type company_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_webhooks_subscriptions_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListWebhooksSubscriptionsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) - List active webhooks subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + @validate_call + def list_webhooks_subscriptions_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Webhooks Subscriptions - >>> thread = api.list_webhooks_subscriptions_with_http_info(company_id, async_req=True) - >>> result = thread.get() + List active webhooks subscriptions. :param company_id: The ID of the company. (required) :type company_id: int - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListWebhooksSubscriptionsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["company_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_webhooks_subscriptions" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._list_webhooks_subscriptions_serialize( + company_id=company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListWebhooksSubscriptionsResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _list_webhooks_subscriptions_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None + # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ListWebhooksSubscriptionsResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/subscriptions", - "GET", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/c/{company_id}/subscriptions", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) - @validate_arguments + @validate_call def modify_webhooks_subscription( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], modify_webhooks_subscription_request: Optional[ ModifyWebhooksSubscriptionRequest ] = None, - **kwargs - ) -> ModifyWebhooksSubscriptionResponse: # noqa: E501 - """Modify Webhooks Subscription # noqa: E501 - - Edit a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ModifyWebhooksSubscriptionResponse: + """Modify Webhooks Subscription - >>> thread = api.modify_webhooks_subscription(company_id, subscription_id, modify_webhooks_subscription_request, async_req=True) - >>> result = thread.get() + Edit a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int @@ -748,47 +1112,151 @@ def modify_webhooks_subscription( :type subscription_id: str :param modify_webhooks_subscription_request: :type modify_webhooks_subscription_request: ModifyWebhooksSubscriptionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ModifyWebhooksSubscriptionResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the modify_webhooks_subscription_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.modify_webhooks_subscription_with_http_info( - company_id, subscription_id, modify_webhooks_subscription_request, **kwargs - ) # noqa: E501 - - @validate_arguments + """ # noqa: E501 + + _param = self._modify_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + modify_webhooks_subscription_request=modify_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call def modify_webhooks_subscription_with_http_info( self, - company_id: Annotated[ - StrictInt, Field(..., description="The ID of the company.") - ], + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], subscription_id: Annotated[ - StrictStr, Field(..., description="The ID of the subscription.") + StrictStr, Field(description="The ID of the subscription.") ], modify_webhooks_subscription_request: Optional[ ModifyWebhooksSubscriptionRequest ] = None, - **kwargs - ) -> ApiResponse: # noqa: E501 - """Modify Webhooks Subscription # noqa: E501 + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ModifyWebhooksSubscriptionResponse]: + """Modify Webhooks Subscription - Edit a webhooks subscription. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + Edit a webhooks subscription. - >>> thread = api.modify_webhooks_subscription_with_http_info(company_id, subscription_id, modify_webhooks_subscription_request, async_req=True) - >>> result = thread.get() + :param company_id: The ID of the company. (required) + :type company_id: int + :param subscription_id: The ID of the subscription. (required) + :type subscription_id: str + :param modify_webhooks_subscription_request: + :type modify_webhooks_subscription_request: ModifyWebhooksSubscriptionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._modify_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + modify_webhooks_subscription_request=modify_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def modify_webhooks_subscription_without_preload_content( + self, + company_id: Annotated[StrictInt, Field(description="The ID of the company.")], + subscription_id: Annotated[ + StrictStr, Field(description="The ID of the subscription.") + ], + modify_webhooks_subscription_request: Optional[ + ModifyWebhooksSubscriptionRequest + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Modify Webhooks Subscription + + Edit a webhooks subscription. :param company_id: The ID of the company. (required) :type company_id: int @@ -796,117 +1264,108 @@ def modify_webhooks_subscription_with_http_info( :type subscription_id: str :param modify_webhooks_subscription_request: :type modify_webhooks_subscription_request: ModifyWebhooksSubscriptionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. + request; this effectively ignores the + authentication in the spec for a single request. :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ModifyWebhooksSubscriptionResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - "company_id", - "subscription_id", - "modify_webhooks_subscription_request", - ] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method modify_webhooks_subscription" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} + """ # noqa: E501 + + _param = self._modify_webhooks_subscription_serialize( + company_id=company_id, + subscription_id=subscription_id, + modify_webhooks_subscription_request=modify_webhooks_subscription_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - # process the path parameters - _path_params = {} - if _params["company_id"]: - _path_params["company_id"] = _params["company_id"] + _response_types_map: Dict[str, Optional[str]] = { + "200": "ModifyWebhooksSubscriptionResponse" + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response - if _params["subscription_id"]: - _path_params["subscription_id"] = _params["subscription_id"] + def _modify_webhooks_subscription_serialize( + self, + company_id, + subscription_id, + modify_webhooks_subscription_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + # process the path parameters + if company_id is not None: + _path_params["company_id"] = company_id + if subscription_id is not None: + _path_params["subscription_id"] = subscription_id # process the query parameters - _query_params = [] # process the header parameters - _header_params = dict(_params.get("_headers", {})) # process the form parameters - _form_params = [] - _files = {} # process the body parameter - _body_params = None - if _params["modify_webhooks_subscription_request"] is not None: - _body_params = _params["modify_webhooks_subscription_request"] + if modify_webhooks_subscription_request is not None: + _body_params = modify_webhooks_subscription_request # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] - ) # noqa: E501 + ) # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type # authentication setting - _auth_settings = ["OAuth2AuthenticationCodeFlow"] # noqa: E501 - - _response_types_map = { - "200": "ModifyWebhooksSubscriptionResponse", - } - - return self.api_client.call_api( - "/c/{company_id}/subscriptions/{subscription_id}", - "PUT", - _path_params, - _query_params, - _header_params, + _auth_settings: List[str] = ["OAuth2AuthenticationCodeFlow"] + + return self.api_client.param_serialize( + method="PUT", + resource_path="/c/{company_id}/subscriptions/{subscription_id}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, body=_body_params, post_params=_form_params, files=_files, - response_types_map=_response_types_map, auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + _host=_host, + _request_auth=_request_auth, ) diff --git a/fattureincloud_python_sdk/api_client.py b/fattureincloud_python_sdk/api_client.py index 601fc842..ded7f8f1 100644 --- a/fattureincloud_python_sdk/api_client.py +++ b/fattureincloud_python_sdk/api_client.py @@ -18,18 +18,26 @@ from dateutil.parser import parse import json import mimetypes -from multiprocessing.pool import ThreadPool import os import re import tempfile from urllib.parse import quote +from typing import Tuple, Optional, List from fattureincloud_python_sdk.configuration import Configuration from fattureincloud_python_sdk.api_response import ApiResponse import fattureincloud_python_sdk.models from fattureincloud_python_sdk import rest -from fattureincloud_python_sdk.exceptions import ApiValueError, ApiException +from fattureincloud_python_sdk.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException, +) class ApiClient: @@ -46,8 +54,6 @@ class ApiClient: the API. :param cookie: a cookie to include in the header when making calls to the API - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. """ PRIMITIVE_TYPES = (float, bool, bytes, str, int) @@ -64,18 +70,12 @@ class ApiClient: _pool = None def __init__( - self, - configuration=None, - header_name=None, - header_value=None, - cookie=None, - pool_threads=1, + self, configuration=None, header_name=None, header_value=None, cookie=None ) -> None: # use default configuration if none is provided if configuration is None: configuration = Configuration.get_default() self.configuration = configuration - self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} @@ -83,32 +83,14 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "FattureInCloud/2.0.16/Python-SDK" + self.user_agent = "FattureInCloud/2.0.17/Python-SDK" self.client_side_validation = configuration.client_side_validation def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): - self.close() - - def close(self): - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, "unregister"): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) - return self._pool + pass @property def user_agent(self): @@ -148,25 +130,43 @@ def set_default(cls, default): """ cls._default = default - def __call_api( + def param_serialize( self, - resource_path, method, + resource_path, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_types_map=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, - _request_timeout=None, _host=None, _request_auth=None, - ): + ) -> Tuple: + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + config = self.configuration # header parameters @@ -225,67 +225,108 @@ def __call_api( url_query = self.parameters_to_url_query(query_params, collection_formats) url += "?" + url_query + return method, url, header_params, body, post_params + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None, + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + try: # perform request and return response - response_data = self.request( + response_data = self.rest_client.request( method, url, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, + post_params=post_params, _request_timeout=_request_timeout, ) + except ApiException as e: if e.body: e.body = e.body.decode("utf-8") raise e - self.last_response = response_data - - return_data = None # assuming derialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - if ( - not response_type - and isinstance(response_data.status, int) - and 100 <= response_data.status <= 599 - ): - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get( - str(response_data.status)[0] + "XX", None - ) + return response_data - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader("content-type") - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + def response_deserialize( + self, response_data=None, response_types_map=None + ) -> ApiResponse: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ - if _return_http_data_only: - return return_data - else: - return ApiResponse( - status_code=response_data.status, - data=return_data, - headers=response_data.getheaders(), - raw_data=response_data.data, + response_type = response_types_map.get(str(response_data.status), None) + if ( + not response_type + and isinstance(response_data.status, int) + and 100 <= response_data.status <= 599 + ): + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get( + str(response_data.status)[0] + "XX", None ) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) + + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) + + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) + + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) + + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) + + # deserialize response data + + if response_type == "bytearray": + return_data = response_data.data + elif response_type is None: + return_data = None + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + else: + match = None + content_type = response_data.getheader("content-type") + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type) + + return ApiResponse( + status_code=response_data.status, + data=return_data, + headers=response_data.getheaders(), + raw_data=response_data.data, + ) + def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -311,7 +352,7 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - if isinstance(obj, dict): + elif isinstance(obj, dict): obj_dict = obj else: # Convert model obj to dict except @@ -325,7 +366,7 @@ def sanitize_for_serialization(self, obj): key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() } - def deserialize(self, response, response_type): + def deserialize(self, response_text, response_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. @@ -334,16 +375,12 @@ def deserialize(self, response, response_type): :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) # fetch data from response object try: - data = json.loads(response.data) + data = json.loads(response_text) except ValueError: - data = response.data + data = response_text return self.__deserialize(data, response_type) @@ -384,190 +421,6 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api( - self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_types_map=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - _request_auth=None, - ): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async_req request, set the async_req parameter. - - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. - """ - if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ) - - return self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ), - ) - - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.get_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "HEAD": - return self.rest_client.head_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) - elif method == "OPTIONS": - return self.rest_client.options_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) - elif method == "POST": - return self.rest_client.post_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PUT": - return self.rest_client.put_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "PATCH": - return self.rest_client.patch_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - elif method == "DELETE": - return self.rest_client.delete_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) - def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -578,9 +431,7 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in ( - params.items() if isinstance(params, dict) else params - ): # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": @@ -609,13 +460,11 @@ def parameters_to_url_query(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in ( - params.items() if isinstance(params, dict) else params - ): # noqa: E501 - if isinstance(v, (int, float)): - v = str(v) + for k, v in params.items() if isinstance(params, dict) else params: if isinstance(v, bool): v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) if isinstance(v, dict): v = json.dumps(v) @@ -665,14 +514,14 @@ def files_parameters(self, files=None): return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None for accept in accepts: if re.search("json", accept, re.IGNORECASE): @@ -704,7 +553,7 @@ def update_params_for_auth( method, body, request_auth=None, - ): + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -724,18 +573,17 @@ def update_params_for_auth( self._apply_auth_params( headers, queries, resource_path, method, body, request_auth ) - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params( - headers, queries, resource_path, method, body, auth_setting - ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, queries, resource_path, method, body, auth_setting + ) def _apply_auth_params( self, headers, queries, resource_path, method, body, auth_setting - ): + ) -> None: """Updates the request parameters based on a single auth_setting :param headers: Header parameters dict to be updated. @@ -762,6 +610,9 @@ def __deserialize_file(self, response): Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. + handle file downloading + save response body into a tmp file and return the instance + :param response: RESTResponse. :return: file path. """ diff --git a/fattureincloud_python_sdk/api_response.py b/fattureincloud_python_sdk/api_response.py index bb7e4003..f3855566 100644 --- a/fattureincloud_python_sdk/api_response.py +++ b/fattureincloud_python_sdk/api_response.py @@ -1,28 +1,22 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional -from pydantic import Field, StrictInt, StrictStr +from typing import Any, Dict, Optional, Generic, TypeVar +from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +T = TypeVar("T") -class ApiResponse: + +class ApiResponse(BaseModel, Generic[T]): """ API response object """ - status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field( None, description="HTTP headers" ) - data: Optional[Any] = Field( - None, description="Deserialized data given the data type" - ) - raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - def __init__( - self, status_code=None, headers=None, data=None, raw_data=None - ) -> None: - self.status_code = status_code - self.headers = headers - self.data = data - self.raw_data = raw_data + model_config = {"arbitrary_types_allowed": True} diff --git a/fattureincloud_python_sdk/configuration.py b/fattureincloud_python_sdk/configuration.py index 011025cf..d1df0496 100644 --- a/fattureincloud_python_sdk/configuration.py +++ b/fattureincloud_python_sdk/configuration.py @@ -15,7 +15,6 @@ import copy import logging -import multiprocessing import sys import urllib3 @@ -162,14 +161,6 @@ def __init__( Set this to the SNI value expected by the server. """ - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - self.proxy = None """Proxy URL """ @@ -393,7 +384,7 @@ def to_debug_report(self): "OS: {env}\n" "Python Version: {pyversion}\n" "Version of the API: 2.0.30\n" - "SDK Package Version: 2.0.16".format( + "SDK Package Version: 2.0.17".format( env=sys.platform, pyversion=sys.version ) ) diff --git a/fattureincloud_python_sdk/exceptions.py b/fattureincloud_python_sdk/exceptions.py index 3f9d2f5c..e39bf722 100644 --- a/fattureincloud_python_sdk/exceptions.py +++ b/fattureincloud_python_sdk/exceptions.py @@ -106,7 +106,7 @@ def __init__(self, status=None, reason=None, http_resp=None) -> None: if http_resp: self.status = http_resp.status self.reason = http_resp.reason - self.body = http_resp.data + self.body = http_resp.data.decode("utf-8") self.headers = http_resp.getheaders() else: self.status = status diff --git a/fattureincloud_python_sdk/models/archive_document.py b/fattureincloud_python_sdk/models/archive_document.py index 227f73ff..16ed31bc 100644 --- a/fattureincloud_python_sdk/models/archive_document.py +++ b/fattureincloud_python_sdk/models/archive_document.py @@ -19,32 +19,40 @@ import json from datetime import date -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ArchiveDocument(BaseModel): """ ArchiveDocument - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Archive document id") + id: Optional[StrictInt] = Field(default=None, description="Archive document id") var_date: Optional[date] = Field( - None, alias="date", description="Archive document date" + default=None, description="Archive document date", alias="date" ) description: Optional[StrictStr] = Field( - None, description="Archive Document description" + default=None, description="Archive Document description" ) attachment_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Archive Document url of the attached file", ) - category: Optional[StrictStr] = Field(None, description="Archive document category") + category: Optional[StrictStr] = Field( + default=None, description="Archive document category" + ) attachment_token: Optional[StrictStr] = Field( - None, + default=None, description="[Write Only] [Required] Archive document attachment token returned by POST /archive/attachment", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "date", "description", @@ -53,28 +61,34 @@ class ArchiveDocument(BaseModel): "attachment_token", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ArchiveDocument: + def from_json(cls, json_str: str) -> Self: """Create an instance of ArchiveDocument from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "attachment_url", @@ -84,30 +98,22 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ArchiveDocument: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ArchiveDocument from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ArchiveDocument.parse_obj(obj) + return cls.model_validate(obj) - _obj = ArchiveDocument.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - "attachment_url": obj.get("attachment_url") - if obj.get("attachment_url") is not None - else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, - "attachment_token": obj.get("attachment_token") - if obj.get("attachment_token") is not None - else None, + "id": obj.get("id"), + "date": obj.get("date"), + "description": obj.get("description"), + "attachment_url": obj.get("attachment_url"), + "category": obj.get("category"), + "attachment_token": obj.get("attachment_token"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/attachment_data.py b/fattureincloud_python_sdk/models/attachment_data.py index 4b194811..1e028d11 100644 --- a/fattureincloud_python_sdk/models/attachment_data.py +++ b/fattureincloud_python_sdk/models/attachment_data.py @@ -19,58 +19,67 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class AttachmentData(BaseModel): """ AttachmentData - """ + """ # noqa: E501 attachment_token: Optional[StrictStr] = Field( - None, description="Uploaded attachment token." + default=None, description="Uploaded attachment token." ) - __properties = ["attachment_token"] + __properties: ClassVar[List[str]] = ["attachment_token"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> AttachmentData: + def from_json(cls, json_str: str) -> Self: """Create an instance of AttachmentData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> AttachmentData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of AttachmentData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return AttachmentData.parse_obj(obj) - - _obj = AttachmentData.parse_obj( - { - "attachment_token": obj.get("attachment_token") - if obj.get("attachment_token") is not None - else None - } - ) + return cls.model_validate(obj) + + _obj = cls.model_validate({"attachment_token": obj.get("attachment_token")}) return _obj diff --git a/fattureincloud_python_sdk/models/cashbook_entry.py b/fattureincloud_python_sdk/models/cashbook_entry.py index 26ff1eb2..3ef87491 100644 --- a/fattureincloud_python_sdk/models/cashbook_entry.py +++ b/fattureincloud_python_sdk/models/cashbook_entry.py @@ -19,8 +19,9 @@ import json from datetime import date -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.cashbook_entry_document import ( CashbookEntryDocument, ) @@ -28,28 +29,41 @@ from fattureincloud_python_sdk.models.cashbook_entry_type import CashbookEntryType from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CashbookEntry(BaseModel): """ CashbookEntry - """ + """ # noqa: E501 - id: Optional[StrictStr] = Field(None, description="Cashbook id") - var_date: Optional[date] = Field(None, alias="date", description="Cashbook date") - description: Optional[StrictStr] = Field(None, description="Cashbook description") + id: Optional[StrictStr] = Field(default=None, description="Cashbook id") + var_date: Optional[date] = Field( + default=None, description="Cashbook date", alias="date" + ) + description: Optional[StrictStr] = Field( + default=None, description="Cashbook description" + ) kind: Optional[CashbookEntryKind] = None type: Optional[CashbookEntryType] = None - entity_name: Optional[StrictStr] = Field(None, description="Cashbook entity name") + entity_name: Optional[StrictStr] = Field( + default=None, description="Cashbook entity name" + ) document: Optional[CashbookEntryDocument] = None amount_in: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Only for cashbook entry in] Cashbook total amount in" + default=None, + description="[Only for cashbook entry in] Cashbook total amount in", ) payment_account_in: Optional[PaymentAccount] = None amount_out: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Only for cashbook entry out] Cashbook total amount out" + default=None, + description="[Only for cashbook entry out] Cashbook total amount out", ) payment_account_out: Optional[PaymentAccount] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "date", "description", @@ -63,28 +77,37 @@ class CashbookEntry(BaseModel): "payment_account_out", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CashbookEntry: + def from_json(cls, json_str: str) -> Self: """Create an instance of CashbookEntry from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of document if self.document: _dict["document"] = self.document.to_dict() @@ -97,40 +120,32 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CashbookEntry: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CashbookEntry from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CashbookEntry.parse_obj(obj) + return cls.model_validate(obj) - _obj = CashbookEntry.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, + "id": obj.get("id"), + "date": obj.get("date"), + "description": obj.get("description"), "kind": obj.get("kind"), "type": obj.get("type"), - "entity_name": obj.get("entity_name") - if obj.get("entity_name") is not None - else None, + "entity_name": obj.get("entity_name"), "document": CashbookEntryDocument.from_dict(obj.get("document")) if obj.get("document") is not None else None, - "amount_in": float(obj.get("amount_in")) - if obj.get("amount_in") is not None - else None, + "amount_in": obj.get("amount_in"), "payment_account_in": PaymentAccount.from_dict( obj.get("payment_account_in") ) if obj.get("payment_account_in") is not None else None, - "amount_out": float(obj.get("amount_out")) - if obj.get("amount_out") is not None - else None, + "amount_out": obj.get("amount_out"), "payment_account_out": PaymentAccount.from_dict( obj.get("payment_account_out") ) diff --git a/fattureincloud_python_sdk/models/cashbook_entry_document.py b/fattureincloud_python_sdk/models/cashbook_entry_document.py index ab1816a4..25333f5c 100644 --- a/fattureincloud_python_sdk/models/cashbook_entry_document.py +++ b/fattureincloud_python_sdk/models/cashbook_entry_document.py @@ -19,62 +19,75 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class CashbookEntryDocument(BaseModel): """ CashbookEntryDocument - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Cashbook related document id") + id: Optional[StrictInt] = Field( + default=None, description="Cashbook related document id" + ) type: Optional[StrictStr] = Field( - None, description="Cashbook related document type" + default=None, description="Cashbook related document type" ) path: Optional[StrictStr] = Field( - None, description="Cashbook related document path" + default=None, description="Cashbook related document path" ) - __properties = ["id", "type", "path"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["id", "type", "path"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CashbookEntryDocument: + def from_json(cls, json_str: str) -> Self: """Create an instance of CashbookEntryDocument from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> CashbookEntryDocument: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CashbookEntryDocument from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CashbookEntryDocument.parse_obj(obj) - - _obj = CashbookEntryDocument.parse_obj( - { - "id": obj.get("id") if obj.get("id") is not None else None, - "type": obj.get("type") if obj.get("type") is not None else None, - "path": obj.get("path") if obj.get("path") is not None else None, - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"id": obj.get("id"), "type": obj.get("type"), "path": obj.get("path")} ) return _obj diff --git a/fattureincloud_python_sdk/models/cashbook_entry_kind.py b/fattureincloud_python_sdk/models/cashbook_entry_kind.py index 2284634d..83fb10d4 100644 --- a/fattureincloud_python_sdk/models/cashbook_entry_kind.py +++ b/fattureincloud_python_sdk/models/cashbook_entry_kind.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class CashbookEntryKind(str, Enum): @@ -34,6 +41,6 @@ class CashbookEntryKind(str, Enum): RECEIPT = "receipt" @classmethod - def from_json(cls, json_str: str) -> CashbookEntryKind: + def from_json(cls, json_str: str) -> Self: """Create an instance of CashbookEntryKind from a JSON string""" - return CashbookEntryKind(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/cashbook_entry_type.py b/fattureincloud_python_sdk/models/cashbook_entry_type.py index bd4cd440..98fda16d 100644 --- a/fattureincloud_python_sdk/models/cashbook_entry_type.py +++ b/fattureincloud_python_sdk/models/cashbook_entry_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class CashbookEntryType(str, Enum): @@ -31,6 +38,6 @@ class CashbookEntryType(str, Enum): OUT = "out" @classmethod - def from_json(cls, json_str: str) -> CashbookEntryType: + def from_json(cls, json_str: str) -> Self: """Create an instance of CashbookEntryType from a JSON string""" - return CashbookEntryType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/city.py b/fattureincloud_python_sdk/models/city.py index c9c63e70..d650dde8 100644 --- a/fattureincloud_python_sdk/models/city.py +++ b/fattureincloud_python_sdk/models/city.py @@ -19,62 +19,75 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class City(BaseModel): """ City - """ - - postal_code: Optional[StrictStr] = Field(None, description="City postal code") - city: Optional[StrictStr] = Field(None, description="City name") - province: Optional[StrictStr] = Field(None, description="City province") - __properties = ["postal_code", "city", "province"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + postal_code: Optional[StrictStr] = Field( + default=None, description="City postal code" + ) + city: Optional[StrictStr] = Field(default=None, description="City name") + province: Optional[StrictStr] = Field(default=None, description="City province") + __properties: ClassVar[List[str]] = ["postal_code", "city", "province"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> City: + def from_json(cls, json_str: str) -> Self: """Create an instance of City from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> City: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of City from a dict""" if obj is None: return None if not isinstance(obj, dict): - return City.parse_obj(obj) + return cls.model_validate(obj) - _obj = City.parse_obj( + _obj = cls.model_validate( { - "postal_code": obj.get("postal_code") - if obj.get("postal_code") is not None - else None, - "city": obj.get("city") if obj.get("city") is not None else None, - "province": obj.get("province") - if obj.get("province") is not None - else None, + "postal_code": obj.get("postal_code"), + "city": obj.get("city"), + "province": obj.get("province"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/client.py b/fattureincloud_python_sdk/models/client.py index c39fc416..00c89f1c 100644 --- a/fattureincloud_python_sdk/models/client.py +++ b/fattureincloud_python_sdk/models/client.py @@ -19,90 +19,108 @@ import json from datetime import date -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.client_type import ClientType from fattureincloud_python_sdk.models.payment_method import PaymentMethod from fattureincloud_python_sdk.models.payment_terms_type import PaymentTermsType from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Client(BaseModel): """ Client - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Client id") - code: Optional[StrictStr] = Field(None, description="Client code") - name: Optional[StrictStr] = Field(None, description="Client name") + id: Optional[StrictInt] = Field(default=None, description="Client id") + code: Optional[StrictStr] = Field(default=None, description="Client code") + name: Optional[StrictStr] = Field(default=None, description="Client name") type: Optional[ClientType] = None - first_name: Optional[StrictStr] = Field(None, description="Client first name") - last_name: Optional[StrictStr] = Field(None, description="Client last name") + first_name: Optional[StrictStr] = Field( + default=None, description="Client first name" + ) + last_name: Optional[StrictStr] = Field(default=None, description="Client last name") contact_person: Optional[StrictStr] = Field( - None, description="Client contact person" + default=None, description="Client contact person" ) - vat_number: Optional[StrictStr] = Field(None, description="Client vat number") - tax_code: Optional[StrictStr] = Field(None, description="Client tax code") + vat_number: Optional[StrictStr] = Field( + default=None, description="Client vat number" + ) + tax_code: Optional[StrictStr] = Field(default=None, description="Client tax code") address_street: Optional[StrictStr] = Field( - None, description="Client address street" + default=None, description="Client address street" ) address_postal_code: Optional[StrictStr] = Field( - None, description="Client address postal code" + default=None, description="Client address postal code" + ) + address_city: Optional[StrictStr] = Field( + default=None, description="Client address city" ) - address_city: Optional[StrictStr] = Field(None, description="Client address city") address_province: Optional[StrictStr] = Field( - None, description="Client address province" + default=None, description="Client address province" ) address_extra: Optional[StrictStr] = Field( - None, description="Client address extra info" + default=None, description="Client address extra info" ) - country: Optional[StrictStr] = Field(None, description="Client country") + country: Optional[StrictStr] = Field(default=None, description="Client country") country_iso: Optional[StrictStr] = Field( - None, description="Client country iso code" + default=None, description="Client country iso code" ) - email: Optional[StrictStr] = Field(None, description="Client email") + email: Optional[StrictStr] = Field(default=None, description="Client email") certified_email: Optional[StrictStr] = Field( - None, description="Client certified email" + default=None, description="Client certified email" ) - phone: Optional[StrictStr] = Field(None, description="Client phone") - fax: Optional[StrictStr] = Field(None, description="Client fax") - notes: Optional[StrictStr] = Field(None, description="Client extra") + phone: Optional[StrictStr] = Field(default=None, description="Client phone") + fax: Optional[StrictStr] = Field(default=None, description="Client fax") + notes: Optional[StrictStr] = Field(default=None, description="Client extra") default_vat: Optional[VatType] = None default_payment_terms: Optional[StrictInt] = Field( - None, description="Client default payment terms" + default=None, description="Client default payment terms" ) default_payment_terms_type: Optional[PaymentTermsType] = None default_payment_method: Optional[PaymentMethod] = None - bank_name: Optional[StrictStr] = Field(None, description="Client bank name") - bank_iban: Optional[StrictStr] = Field(None, description="Client bank iban") + bank_name: Optional[StrictStr] = Field(default=None, description="Client bank name") + bank_iban: Optional[StrictStr] = Field(default=None, description="Client bank iban") bank_swift_code: Optional[StrictStr] = Field( - None, description="Client bank swift code" + default=None, description="Client bank swift code" ) shipping_address: Optional[StrictStr] = Field( - None, description="Client shipping address" + default=None, description="Client shipping address" ) e_invoice: Optional[StrictBool] = Field( - None, description="Use e-invoices for this entity" + default=None, description="Use e-invoices for this entity" + ) + ei_code: Optional[StrictStr] = Field( + default=None, description="Client e-invoice code " ) - ei_code: Optional[StrictStr] = Field(None, description="Client e-invoice code ") discount_highlight: Optional[StrictBool] = Field( - None, description="Highlight Discount" + default=None, description="Highlight Discount" ) default_discount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Client default discount" + default=None, description="Client default discount" ) has_intent_declaration: Optional[StrictBool] = Field( - None, description="Client has intent declaration" + default=None, description="Client has intent declaration" ) intent_declaration_protocol_number: Optional[StrictStr] = Field( - None, description="Client intent declaration protocol number" + default=None, description="Client intent declaration protocol number" ) intent_declaration_protocol_date: Optional[date] = Field( - None, description="Client intent declaration protocol date" + default=None, description="Client intent declaration protocol date" ) - created_at: Optional[StrictStr] = Field(None, description="Client creation date") - updated_at: Optional[StrictStr] = Field(None, description="Client last update date") - __properties = [ + created_at: Optional[StrictStr] = Field( + default=None, description="Client creation date" + ) + updated_at: Optional[StrictStr] = Field( + default=None, description="Client last update date" + ) + __properties: ClassVar[List[str]] = [ "id", "code", "name", @@ -143,28 +161,37 @@ class Client(BaseModel): "updated_at", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Client: + def from_json(cls, json_str: str) -> Self: """Create an instance of Client from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_vat if self.default_vat: _dict["default_vat"] = self.default_vat.to_dict() @@ -174,118 +201,64 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Client: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Client from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Client.parse_obj(obj) + return cls.model_validate(obj) - _obj = Client.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "code": obj.get("code"), + "name": obj.get("name"), "type": obj.get("type"), - "first_name": obj.get("first_name") - if obj.get("first_name") is not None - else None, - "last_name": obj.get("last_name") - if obj.get("last_name") is not None - else None, - "contact_person": obj.get("contact_person") - if obj.get("contact_person") is not None - else None, - "vat_number": obj.get("vat_number") - if obj.get("vat_number") is not None - else None, - "tax_code": obj.get("tax_code") - if obj.get("tax_code") is not None - else None, - "address_street": obj.get("address_street") - if obj.get("address_street") is not None - else None, - "address_postal_code": obj.get("address_postal_code") - if obj.get("address_postal_code") is not None - else None, - "address_city": obj.get("address_city") - if obj.get("address_city") is not None - else None, - "address_province": obj.get("address_province") - if obj.get("address_province") is not None - else None, - "address_extra": obj.get("address_extra") - if obj.get("address_extra") is not None - else None, - "country": obj.get("country") - if obj.get("country") is not None - else None, - "country_iso": obj.get("country_iso") - if obj.get("country_iso") is not None - else None, - "email": obj.get("email") if obj.get("email") is not None else None, - "certified_email": obj.get("certified_email") - if obj.get("certified_email") is not None - else None, - "phone": obj.get("phone") if obj.get("phone") is not None else None, - "fax": obj.get("fax") if obj.get("fax") is not None else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, + "first_name": obj.get("first_name"), + "last_name": obj.get("last_name"), + "contact_person": obj.get("contact_person"), + "vat_number": obj.get("vat_number"), + "tax_code": obj.get("tax_code"), + "address_street": obj.get("address_street"), + "address_postal_code": obj.get("address_postal_code"), + "address_city": obj.get("address_city"), + "address_province": obj.get("address_province"), + "address_extra": obj.get("address_extra"), + "country": obj.get("country"), + "country_iso": obj.get("country_iso"), + "email": obj.get("email"), + "certified_email": obj.get("certified_email"), + "phone": obj.get("phone"), + "fax": obj.get("fax"), + "notes": obj.get("notes"), "default_vat": VatType.from_dict(obj.get("default_vat")) if obj.get("default_vat") is not None else None, - "default_payment_terms": obj.get("default_payment_terms") - if obj.get("default_payment_terms") is not None - else None, + "default_payment_terms": obj.get("default_payment_terms"), "default_payment_terms_type": obj.get("default_payment_terms_type"), "default_payment_method": PaymentMethod.from_dict( obj.get("default_payment_method") ) if obj.get("default_payment_method") is not None else None, - "bank_name": obj.get("bank_name") - if obj.get("bank_name") is not None - else None, - "bank_iban": obj.get("bank_iban") - if obj.get("bank_iban") is not None - else None, - "bank_swift_code": obj.get("bank_swift_code") - if obj.get("bank_swift_code") is not None - else None, - "shipping_address": obj.get("shipping_address") - if obj.get("shipping_address") is not None - else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, - "ei_code": obj.get("ei_code") - if obj.get("ei_code") is not None - else None, - "discount_highlight": obj.get("discount_highlight") - if obj.get("discount_highlight") is not None - else None, - "default_discount": float(obj.get("default_discount")) - if obj.get("default_discount") is not None - else None, - "has_intent_declaration": obj.get("has_intent_declaration") - if obj.get("has_intent_declaration") is not None - else None, + "bank_name": obj.get("bank_name"), + "bank_iban": obj.get("bank_iban"), + "bank_swift_code": obj.get("bank_swift_code"), + "shipping_address": obj.get("shipping_address"), + "e_invoice": obj.get("e_invoice"), + "ei_code": obj.get("ei_code"), + "discount_highlight": obj.get("discount_highlight"), + "default_discount": obj.get("default_discount"), + "has_intent_declaration": obj.get("has_intent_declaration"), "intent_declaration_protocol_number": obj.get( "intent_declaration_protocol_number" - ) - if obj.get("intent_declaration_protocol_number") is not None - else None, + ), "intent_declaration_protocol_date": obj.get( "intent_declaration_protocol_date" - ) - if obj.get("intent_declaration_protocol_date") is not None - else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + ), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/client_type.py b/fattureincloud_python_sdk/models/client_type.py index 013e4195..7cf6c90b 100644 --- a/fattureincloud_python_sdk/models/client_type.py +++ b/fattureincloud_python_sdk/models/client_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ClientType(str, Enum): @@ -33,6 +40,6 @@ class ClientType(str, Enum): CONDO = "condo" @classmethod - def from_json(cls, json_str: str) -> ClientType: + def from_json(cls, json_str: str) -> Self: """Create an instance of ClientType from a JSON string""" - return ClientType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/company.py b/fattureincloud_python_sdk/models/company.py index 26505b48..02ba47f1 100644 --- a/fattureincloud_python_sdk/models/company.py +++ b/fattureincloud_python_sdk/models/company.py @@ -19,33 +19,39 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.company_type import CompanyType from fattureincloud_python_sdk.models.controlled_company import ControlledCompany +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Company(BaseModel): """ Company - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Company id") - name: Optional[StrictStr] = Field(None, description="Company name") + id: Optional[StrictInt] = Field(default=None, description="Company id") + name: Optional[StrictStr] = Field(default=None, description="Company name") type: Optional[CompanyType] = None access_token: Optional[StrictStr] = Field( - None, + default=None, description="Company authentication token for this company. [Only if type=company]", ) - controlled_companies: Optional[conlist(ControlledCompany)] = Field( - None, + controlled_companies: Optional[List[ControlledCompany]] = Field( + default=None, description="Company list of controlled companies [Only if type=accountant]", ) connection_id: Optional[StrictInt] = Field( - None, description="Company connection id" + default=None, description="Company connection id" ) - tax_code: Optional[StrictStr] = Field(None, description="Company tax code") - __properties = [ + tax_code: Optional[StrictStr] = Field(default=None, description="Company tax code") + __properties: ClassVar[List[str]] = [ "id", "name", "type", @@ -55,28 +61,37 @@ class Company(BaseModel): "tax_code", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Company: + def from_json(cls, json_str: str) -> Self: """Create an instance of Company from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in controlled_companies (list) _items = [] if self.controlled_companies: @@ -87,34 +102,28 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Company: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Company from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Company.parse_obj(obj) + return cls.model_validate(obj) - _obj = Company.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "name": obj.get("name"), "type": obj.get("type"), - "access_token": obj.get("access_token") - if obj.get("access_token") is not None - else None, + "access_token": obj.get("access_token"), "controlled_companies": [ ControlledCompany.from_dict(_item) for _item in obj.get("controlled_companies") ] if obj.get("controlled_companies") is not None else None, - "connection_id": obj.get("connection_id") - if obj.get("connection_id") is not None - else None, - "tax_code": obj.get("tax_code") - if obj.get("tax_code") is not None - else None, + "connection_id": obj.get("connection_id"), + "tax_code": obj.get("tax_code"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/company_info.py b/fattureincloud_python_sdk/models/company_info.py index c32ae406..901927ff 100644 --- a/fattureincloud_python_sdk/models/company_info.py +++ b/fattureincloud_python_sdk/models/company_info.py @@ -19,33 +19,39 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.company_info_access_info import ( CompanyInfoAccessInfo, ) from fattureincloud_python_sdk.models.company_info_plan_info import CompanyInfoPlanInfo from fattureincloud_python_sdk.models.company_type import CompanyType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CompanyInfo(BaseModel): """ CompanyInfo - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Company id") - name: Optional[StrictStr] = Field(None, description="Company name") - email: Optional[StrictStr] = Field(None, description="Company email") + id: Optional[StrictInt] = Field(default=None, description="Company id") + name: Optional[StrictStr] = Field(default=None, description="Company name") + email: Optional[StrictStr] = Field(default=None, description="Company email") type: Optional[CompanyType] = None access_info: Optional[CompanyInfoAccessInfo] = None plan_info: Optional[CompanyInfoPlanInfo] = None accountant_id: Optional[StrictInt] = Field( - None, description="Company accountant id" + default=None, description="Company accountant id" ) is_accountant: Optional[StrictBool] = Field( - None, description="Is the logged account an accountant." + default=None, description="Is the logged account an accountant." ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "name", "email", @@ -56,28 +62,37 @@ class CompanyInfo(BaseModel): "is_accountant", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of access_info if self.access_info: _dict["access_info"] = self.access_info.to_dict() @@ -87,19 +102,19 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfo.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "email": obj.get("email") if obj.get("email") is not None else None, + "id": obj.get("id"), + "name": obj.get("name"), + "email": obj.get("email"), "type": obj.get("type"), "access_info": CompanyInfoAccessInfo.from_dict(obj.get("access_info")) if obj.get("access_info") is not None @@ -107,12 +122,8 @@ def from_dict(cls, obj: dict) -> CompanyInfo: "plan_info": CompanyInfoPlanInfo.from_dict(obj.get("plan_info")) if obj.get("plan_info") is not None else None, - "accountant_id": obj.get("accountant_id") - if obj.get("accountant_id") is not None - else None, - "is_accountant": obj.get("is_accountant") - if obj.get("is_accountant") is not None - else None, + "accountant_id": obj.get("accountant_id"), + "is_accountant": obj.get("is_accountant"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/company_info_access_info.py b/fattureincloud_python_sdk/models/company_info_access_info.py index 31dec4c6..112cb4fa 100644 --- a/fattureincloud_python_sdk/models/company_info_access_info.py +++ b/fattureincloud_python_sdk/models/company_info_access_info.py @@ -19,69 +19,82 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool +from pydantic import Field from fattureincloud_python_sdk.models.permissions import Permissions from fattureincloud_python_sdk.models.user_company_role import UserCompanyRole +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CompanyInfoAccessInfo(BaseModel): """ CompanyInfoAccessInfo - """ + """ # noqa: E501 role: Optional[UserCompanyRole] = None permissions: Optional[Permissions] = None through_accountant: Optional[StrictBool] = Field( - None, description="Company activated through accountant" + default=None, description="Company activated through accountant" ) - __properties = ["role", "permissions", "through_accountant"] + __properties: ClassVar[List[str]] = ["role", "permissions", "through_accountant"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfoAccessInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfoAccessInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of permissions if self.permissions: _dict["permissions"] = self.permissions.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfoAccessInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfoAccessInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfoAccessInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfoAccessInfo.parse_obj( + _obj = cls.model_validate( { "role": obj.get("role"), "permissions": Permissions.from_dict(obj.get("permissions")) if obj.get("permissions") is not None else None, - "through_accountant": obj.get("through_accountant") - if obj.get("through_accountant") is not None - else None, + "through_accountant": obj.get("through_accountant"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/company_info_plan_info.py b/fattureincloud_python_sdk/models/company_info_plan_info.py index 01db4c99..03c6dc10 100644 --- a/fattureincloud_python_sdk/models/company_info_plan_info.py +++ b/fattureincloud_python_sdk/models/company_info_plan_info.py @@ -19,7 +19,7 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.company_info_plan_info_functions import ( CompanyInfoPlanInfoFunctions, @@ -31,39 +31,53 @@ CompanyInfoPlanInfoLimits, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CompanyInfoPlanInfo(BaseModel): """ - Company plan info # noqa: E501 - """ + Company plan info + """ # noqa: E501 limits: Optional[CompanyInfoPlanInfoLimits] = None functions: Optional[CompanyInfoPlanInfoFunctions] = None functions_status: Optional[CompanyInfoPlanInfoFunctionsStatus] = None - __properties = ["limits", "functions", "functions_status"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["limits", "functions", "functions_status"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfoPlanInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfoPlanInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of limits if self.limits: _dict["limits"] = self.limits.to_dict() @@ -76,15 +90,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfoPlanInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfoPlanInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfoPlanInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfoPlanInfo.parse_obj( + _obj = cls.model_validate( { "limits": CompanyInfoPlanInfoLimits.from_dict(obj.get("limits")) if obj.get("limits") is not None diff --git a/fattureincloud_python_sdk/models/company_info_plan_info_functions.py b/fattureincloud_python_sdk/models/company_info_plan_info_functions.py index 09557cc9..188a3dc8 100644 --- a/fattureincloud_python_sdk/models/company_info_plan_info_functions.py +++ b/fattureincloud_python_sdk/models/company_info_plan_info_functions.py @@ -19,14 +19,19 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CompanyInfoPlanInfoFunctions(BaseModel): """ - Access to functions for this company. # noqa: E501 - """ + Access to functions for this company. + """ # noqa: E501 archive: Optional[StrictBool] = None cerved: Optional[StrictBool] = None @@ -46,7 +51,7 @@ class CompanyInfoPlanInfoFunctions(BaseModel): ts_digital: Optional[StrictBool] = None ts_invoice_trading: Optional[StrictBool] = None ts_pay: Optional[StrictBool] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "archive", "cerved", "document_attachments", @@ -67,81 +72,68 @@ class CompanyInfoPlanInfoFunctions(BaseModel): "ts_pay", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfoPlanInfoFunctions: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfoPlanInfoFunctions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfoPlanInfoFunctions: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfoPlanInfoFunctions from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfoPlanInfoFunctions.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfoPlanInfoFunctions.parse_obj( + _obj = cls.model_validate( { - "archive": obj.get("archive") - if obj.get("archive") is not None - else None, - "cerved": obj.get("cerved") if obj.get("cerved") is not None else None, - "document_attachments": obj.get("document_attachments") - if obj.get("document_attachments") is not None - else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, - "genius": obj.get("genius") if obj.get("genius") is not None else None, - "mail_tracking": obj.get("mail_tracking") - if obj.get("mail_tracking") is not None - else None, - "payment_notifications": obj.get("payment_notifications") - if obj.get("payment_notifications") is not None - else None, - "paypal": obj.get("paypal") if obj.get("paypal") is not None else None, - "receipts": obj.get("receipts") - if obj.get("receipts") is not None - else None, - "recurring": obj.get("recurring") - if obj.get("recurring") is not None - else None, - "smtp": obj.get("smtp") if obj.get("smtp") is not None else None, - "sofort": obj.get("sofort") if obj.get("sofort") is not None else None, - "stock": obj.get("stock") if obj.get("stock") is not None else None, - "subaccounts": obj.get("subaccounts") - if obj.get("subaccounts") is not None - else None, - "tessera_sanitaria": obj.get("tessera_sanitaria") - if obj.get("tessera_sanitaria") is not None - else None, - "ts_digital": obj.get("ts_digital") - if obj.get("ts_digital") is not None - else None, - "ts_invoice_trading": obj.get("ts_invoice_trading") - if obj.get("ts_invoice_trading") is not None - else None, - "ts_pay": obj.get("ts_pay") if obj.get("ts_pay") is not None else None, + "archive": obj.get("archive"), + "cerved": obj.get("cerved"), + "document_attachments": obj.get("document_attachments"), + "e_invoice": obj.get("e_invoice"), + "genius": obj.get("genius"), + "mail_tracking": obj.get("mail_tracking"), + "payment_notifications": obj.get("payment_notifications"), + "paypal": obj.get("paypal"), + "receipts": obj.get("receipts"), + "recurring": obj.get("recurring"), + "smtp": obj.get("smtp"), + "sofort": obj.get("sofort"), + "stock": obj.get("stock"), + "subaccounts": obj.get("subaccounts"), + "tessera_sanitaria": obj.get("tessera_sanitaria"), + "ts_digital": obj.get("ts_digital"), + "ts_invoice_trading": obj.get("ts_invoice_trading"), + "ts_pay": obj.get("ts_pay"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/company_info_plan_info_functions_status.py b/fattureincloud_python_sdk/models/company_info_plan_info_functions_status.py index 569b0763..e691fb95 100644 --- a/fattureincloud_python_sdk/models/company_info_plan_info_functions_status.py +++ b/fattureincloud_python_sdk/models/company_info_plan_info_functions_status.py @@ -19,42 +19,56 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.function_status import FunctionStatus +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CompanyInfoPlanInfoFunctionsStatus(BaseModel): """ CompanyInfoPlanInfoFunctionsStatus - """ + """ # noqa: E501 ts_digital: Optional[FunctionStatus] = None ts_pay: Optional[FunctionStatus] = None - __properties = ["ts_digital", "ts_pay"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["ts_digital", "ts_pay"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfoPlanInfoFunctionsStatus: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfoPlanInfoFunctionsStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of ts_digital if self.ts_digital: _dict["ts_digital"] = self.ts_digital.to_dict() @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfoPlanInfoFunctionsStatus: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfoPlanInfoFunctionsStatus from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfoPlanInfoFunctionsStatus.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfoPlanInfoFunctionsStatus.parse_obj( + _obj = cls.model_validate( { "ts_digital": FunctionStatus.from_dict(obj.get("ts_digital")) if obj.get("ts_digital") is not None diff --git a/fattureincloud_python_sdk/models/company_info_plan_info_limits.py b/fattureincloud_python_sdk/models/company_info_plan_info_limits.py index 8cf19c3f..48365e4c 100644 --- a/fattureincloud_python_sdk/models/company_info_plan_info_limits.py +++ b/fattureincloud_python_sdk/models/company_info_plan_info_limits.py @@ -19,76 +19,88 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class CompanyInfoPlanInfoLimits(BaseModel): """ - Company plan limits # noqa: E501 - """ + Company plan limits + """ # noqa: E501 clients: Optional[StrictInt] = Field( - None, description="Company plan clients limits" + default=None, description="Company plan clients limits" ) suppliers: Optional[StrictInt] = Field( - None, description="Company plan suppliers limits" + default=None, description="Company plan suppliers limits" ) products: Optional[StrictInt] = Field( - None, description="Company plan products limits" + default=None, description="Company plan products limits" ) documents: Optional[StrictInt] = Field( - None, description="Company plan documents limits" + default=None, description="Company plan documents limits" ) - __properties = ["clients", "suppliers", "products", "documents"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = [ + "clients", + "suppliers", + "products", + "documents", + ] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CompanyInfoPlanInfoLimits: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyInfoPlanInfoLimits from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> CompanyInfoPlanInfoLimits: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CompanyInfoPlanInfoLimits from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CompanyInfoPlanInfoLimits.parse_obj(obj) + return cls.model_validate(obj) - _obj = CompanyInfoPlanInfoLimits.parse_obj( + _obj = cls.model_validate( { - "clients": obj.get("clients") - if obj.get("clients") is not None - else None, - "suppliers": obj.get("suppliers") - if obj.get("suppliers") is not None - else None, - "products": obj.get("products") - if obj.get("products") is not None - else None, - "documents": obj.get("documents") - if obj.get("documents") is not None - else None, + "clients": obj.get("clients"), + "suppliers": obj.get("suppliers"), + "products": obj.get("products"), + "documents": obj.get("documents"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/company_type.py b/fattureincloud_python_sdk/models/company_type.py index ad5bcdff..169c01f1 100644 --- a/fattureincloud_python_sdk/models/company_type.py +++ b/fattureincloud_python_sdk/models/company_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class CompanyType(str, Enum): @@ -31,6 +38,6 @@ class CompanyType(str, Enum): ACCOUNTANT = "accountant" @classmethod - def from_json(cls, json_str: str) -> CompanyType: + def from_json(cls, json_str: str) -> Self: """Create an instance of CompanyType from a JSON string""" - return CompanyType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/controlled_company.py b/fattureincloud_python_sdk/models/controlled_company.py index fa61da4f..198ce3a8 100644 --- a/fattureincloud_python_sdk/models/controlled_company.py +++ b/fattureincloud_python_sdk/models/controlled_company.py @@ -19,77 +19,94 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.company_type import CompanyType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ControlledCompany(BaseModel): """ ControlledCompany - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Controlled company id") - name: Optional[StrictStr] = Field(None, description="Controlled company id") + id: Optional[StrictInt] = Field(default=None, description="Controlled company id") + name: Optional[StrictStr] = Field(default=None, description="Controlled company id") type: Optional[CompanyType] = None access_token: Optional[StrictStr] = Field( - None, description="Controlled company access token Only if type=company]" + default=None, + description="Controlled company access token Only if type=company]", ) connection_id: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Controlled company connection id" + default=None, description="Controlled company connection id" ) tax_code: Optional[StrictStr] = Field( - None, description="Controlled company tax code" + default=None, description="Controlled company tax code" ) - __properties = ["id", "name", "type", "access_token", "connection_id", "tax_code"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = [ + "id", + "name", + "type", + "access_token", + "connection_id", + "tax_code", + ] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ControlledCompany: + def from_json(cls, json_str: str) -> Self: """Create an instance of ControlledCompany from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ControlledCompany: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ControlledCompany from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ControlledCompany.parse_obj(obj) + return cls.model_validate(obj) - _obj = ControlledCompany.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "name": obj.get("name"), "type": obj.get("type"), - "access_token": obj.get("access_token") - if obj.get("access_token") is not None - else None, - "connection_id": float(obj.get("connection_id")) - if obj.get("connection_id") is not None - else None, - "tax_code": obj.get("tax_code") - if obj.get("tax_code") is not None - else None, + "access_token": obj.get("access_token"), + "connection_id": obj.get("connection_id"), + "tax_code": obj.get("tax_code"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/create_archive_document_request.py b/fattureincloud_python_sdk/models/create_archive_document_request.py index cb3047bb..9e1cf4da 100644 --- a/fattureincloud_python_sdk/models/create_archive_document_request.py +++ b/fattureincloud_python_sdk/models/create_archive_document_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateArchiveDocumentRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ArchiveDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateArchiveDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateArchiveDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateArchiveDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateArchiveDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateArchiveDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateArchiveDocumentRequest.parse_obj( + _obj = cls.model_validate( { "data": ArchiveDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_archive_document_response.py b/fattureincloud_python_sdk/models/create_archive_document_response.py index b6435a9e..58f9abd7 100644 --- a/fattureincloud_python_sdk/models/create_archive_document_response.py +++ b/fattureincloud_python_sdk/models/create_archive_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateArchiveDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ArchiveDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateArchiveDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateArchiveDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateArchiveDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateArchiveDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateArchiveDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateArchiveDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ArchiveDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_cashbook_entry_request.py b/fattureincloud_python_sdk/models/create_cashbook_entry_request.py index ea870b6b..af217900 100644 --- a/fattureincloud_python_sdk/models/create_cashbook_entry_request.py +++ b/fattureincloud_python_sdk/models/create_cashbook_entry_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateCashbookEntryRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CashbookEntry] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateCashbookEntryRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateCashbookEntryRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateCashbookEntryRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateCashbookEntryRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateCashbookEntryRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateCashbookEntryRequest.parse_obj( + _obj = cls.model_validate( { "data": CashbookEntry.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_cashbook_entry_response.py b/fattureincloud_python_sdk/models/create_cashbook_entry_response.py index 9952db48..32533b82 100644 --- a/fattureincloud_python_sdk/models/create_cashbook_entry_response.py +++ b/fattureincloud_python_sdk/models/create_cashbook_entry_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateCashbookEntryResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CashbookEntry] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateCashbookEntryResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateCashbookEntryResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateCashbookEntryResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateCashbookEntryResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateCashbookEntryResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateCashbookEntryResponse.parse_obj( + _obj = cls.model_validate( { "data": CashbookEntry.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_client_request.py b/fattureincloud_python_sdk/models/create_client_request.py index 3245905b..4e8a4695 100644 --- a/fattureincloud_python_sdk/models/create_client_request.py +++ b/fattureincloud_python_sdk/models/create_client_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateClientRequest(BaseModel): """ CreateClientRequest - """ + """ # noqa: E501 data: Optional[Client] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateClientRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateClientRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateClientRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateClientRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateClientRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateClientRequest.parse_obj( + _obj = cls.model_validate( { "data": Client.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_client_response.py b/fattureincloud_python_sdk/models/create_client_response.py index 474896c6..00b3337a 100644 --- a/fattureincloud_python_sdk/models/create_client_response.py +++ b/fattureincloud_python_sdk/models/create_client_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateClientResponse(BaseModel): """ CreateClientResponse - """ + """ # noqa: E501 data: Optional[Client] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateClientResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateClientResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateClientResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateClientResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateClientResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateClientResponse.parse_obj( + _obj = cls.model_validate( { "data": Client.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_f24_request.py b/fattureincloud_python_sdk/models/create_f24_request.py index e7cad73f..426cea83 100644 --- a/fattureincloud_python_sdk/models/create_f24_request.py +++ b/fattureincloud_python_sdk/models/create_f24_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateF24Request(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[F24] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateF24Request: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateF24Request from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateF24Request: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateF24Request from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateF24Request.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateF24Request.parse_obj( + _obj = cls.model_validate( { "data": F24.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_f24_response.py b/fattureincloud_python_sdk/models/create_f24_response.py index 2fef6d6e..7ef15fca 100644 --- a/fattureincloud_python_sdk/models/create_f24_response.py +++ b/fattureincloud_python_sdk/models/create_f24_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateF24Response(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[F24] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateF24Response: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateF24Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateF24Response: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateF24Response from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateF24Response.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateF24Response.parse_obj( + _obj = cls.model_validate( { "data": F24.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_issued_document_request.py b/fattureincloud_python_sdk/models/create_issued_document_request.py index 775ea518..dade6c5d 100644 --- a/fattureincloud_python_sdk/models/create_issued_document_request.py +++ b/fattureincloud_python_sdk/models/create_issued_document_request.py @@ -19,45 +19,59 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument from fattureincloud_python_sdk.models.issued_document_options import ( IssuedDocumentOptions, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateIssuedDocumentRequest(BaseModel): """ CreateIssuedDocumentRequest - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None options: Optional[IssuedDocumentOptions] = None - __properties = ["data", "options"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "options"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateIssuedDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateIssuedDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -67,15 +81,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateIssuedDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateIssuedDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateIssuedDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateIssuedDocumentRequest.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_issued_document_response.py b/fattureincloud_python_sdk/models/create_issued_document_response.py index 8090d962..f0641e5a 100644 --- a/fattureincloud_python_sdk/models/create_issued_document_response.py +++ b/fattureincloud_python_sdk/models/create_issued_document_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateIssuedDocumentResponse(BaseModel): """ CreateIssuedDocumentResponse - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateIssuedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateIssuedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateIssuedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateIssuedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateIssuedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateIssuedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_payment_account_request.py b/fattureincloud_python_sdk/models/create_payment_account_request.py index 57df2338..5ad15593 100644 --- a/fattureincloud_python_sdk/models/create_payment_account_request.py +++ b/fattureincloud_python_sdk/models/create_payment_account_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreatePaymentAccountRequest(BaseModel): """ CreatePaymentAccountRequest - """ + """ # noqa: E501 data: Optional[PaymentAccount] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreatePaymentAccountRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreatePaymentAccountRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreatePaymentAccountRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreatePaymentAccountRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreatePaymentAccountRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreatePaymentAccountRequest.parse_obj( + _obj = cls.model_validate( { "data": PaymentAccount.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_payment_account_response.py b/fattureincloud_python_sdk/models/create_payment_account_response.py index e6f3fd08..cee098da 100644 --- a/fattureincloud_python_sdk/models/create_payment_account_response.py +++ b/fattureincloud_python_sdk/models/create_payment_account_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreatePaymentAccountResponse(BaseModel): """ CreatePaymentAccountResponse - """ + """ # noqa: E501 data: Optional[PaymentAccount] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreatePaymentAccountResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreatePaymentAccountResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreatePaymentAccountResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreatePaymentAccountResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreatePaymentAccountResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreatePaymentAccountResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentAccount.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_payment_method_request.py b/fattureincloud_python_sdk/models/create_payment_method_request.py index d766f8b9..79d270d5 100644 --- a/fattureincloud_python_sdk/models/create_payment_method_request.py +++ b/fattureincloud_python_sdk/models/create_payment_method_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreatePaymentMethodRequest(BaseModel): """ CreatePaymentMethodRequest - """ + """ # noqa: E501 data: Optional[PaymentMethod] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreatePaymentMethodRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreatePaymentMethodRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreatePaymentMethodRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreatePaymentMethodRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreatePaymentMethodRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreatePaymentMethodRequest.parse_obj( + _obj = cls.model_validate( { "data": PaymentMethod.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_payment_method_response.py b/fattureincloud_python_sdk/models/create_payment_method_response.py index 80dc73d3..649cfa06 100644 --- a/fattureincloud_python_sdk/models/create_payment_method_response.py +++ b/fattureincloud_python_sdk/models/create_payment_method_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreatePaymentMethodResponse(BaseModel): """ CreatePaymentMethodResponse - """ + """ # noqa: E501 data: Optional[PaymentMethod] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreatePaymentMethodResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreatePaymentMethodResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreatePaymentMethodResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreatePaymentMethodResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreatePaymentMethodResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreatePaymentMethodResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentMethod.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_product_request.py b/fattureincloud_python_sdk/models/create_product_request.py index 273f55f8..2a93cdfc 100644 --- a/fattureincloud_python_sdk/models/create_product_request.py +++ b/fattureincloud_python_sdk/models/create_product_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateProductRequest(BaseModel): """ CreateProductRequest - """ + """ # noqa: E501 data: Optional[Product] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateProductRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateProductRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateProductRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateProductRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateProductRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateProductRequest.parse_obj( + _obj = cls.model_validate( { "data": Product.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_product_response.py b/fattureincloud_python_sdk/models/create_product_response.py index 40bb9011..e9e0b2eb 100644 --- a/fattureincloud_python_sdk/models/create_product_response.py +++ b/fattureincloud_python_sdk/models/create_product_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateProductResponse(BaseModel): """ CreateProductResponse - """ + """ # noqa: E501 data: Optional[Product] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateProductResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateProductResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateProductResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateProductResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateProductResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateProductResponse.parse_obj( + _obj = cls.model_validate( { "data": Product.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_receipt_request.py b/fattureincloud_python_sdk/models/create_receipt_request.py index 5bebe30c..a74d3717 100644 --- a/fattureincloud_python_sdk/models/create_receipt_request.py +++ b/fattureincloud_python_sdk/models/create_receipt_request.py @@ -19,66 +19,77 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool +from pydantic import Field from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateReceiptRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Receipt] = None autocomplete_number: Optional[StrictBool] = Field( - None, description="If true, the number is autocompleted progressively." + default=None, description="If true, the number is autocompleted progressively." ) - __properties = ["data", "autocomplete_number"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "autocomplete_number"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateReceiptRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateReceiptRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateReceiptRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateReceiptRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateReceiptRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateReceiptRequest.parse_obj( + _obj = cls.model_validate( { "data": Receipt.from_dict(obj.get("data")) if obj.get("data") is not None else None, - "autocomplete_number": obj.get("autocomplete_number") - if obj.get("autocomplete_number") is not None - else None, + "autocomplete_number": obj.get("autocomplete_number"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/create_receipt_response.py b/fattureincloud_python_sdk/models/create_receipt_response.py index 1a0ca744..bc927141 100644 --- a/fattureincloud_python_sdk/models/create_receipt_response.py +++ b/fattureincloud_python_sdk/models/create_receipt_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateReceiptResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Receipt] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateReceiptResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateReceiptResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateReceiptResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateReceiptResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateReceiptResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateReceiptResponse.parse_obj( + _obj = cls.model_validate( { "data": Receipt.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_received_document_request.py b/fattureincloud_python_sdk/models/create_received_document_request.py index 9fd79fae..b8806077 100644 --- a/fattureincloud_python_sdk/models/create_received_document_request.py +++ b/fattureincloud_python_sdk/models/create_received_document_request.py @@ -19,64 +19,75 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt +from pydantic import Field from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateReceivedDocumentRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 pending_id: Optional[StrictInt] = Field( - None, + default=None, description="Pending received document id of the document from which the new document is created.", ) data: Optional[ReceivedDocument] = None - __properties = ["pending_id", "data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["pending_id", "data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateReceivedDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateReceivedDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateReceivedDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateReceivedDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateReceivedDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateReceivedDocumentRequest.parse_obj( + _obj = cls.model_validate( { - "pending_id": obj.get("pending_id") - if obj.get("pending_id") is not None - else None, + "pending_id": obj.get("pending_id"), "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/create_received_document_response.py b/fattureincloud_python_sdk/models/create_received_document_response.py index 34f6f730..1d983bcf 100644 --- a/fattureincloud_python_sdk/models/create_received_document_response.py +++ b/fattureincloud_python_sdk/models/create_received_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateReceivedDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateReceivedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateReceivedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateReceivedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateReceivedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateReceivedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateReceivedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_supplier_request.py b/fattureincloud_python_sdk/models/create_supplier_request.py index 7a7d457f..4470e51d 100644 --- a/fattureincloud_python_sdk/models/create_supplier_request.py +++ b/fattureincloud_python_sdk/models/create_supplier_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateSupplierRequest(BaseModel): """ CreateSupplierRequest - """ + """ # noqa: E501 data: Optional[Supplier] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateSupplierRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateSupplierRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateSupplierRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateSupplierRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateSupplierRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateSupplierRequest.parse_obj( + _obj = cls.model_validate( { "data": Supplier.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_supplier_response.py b/fattureincloud_python_sdk/models/create_supplier_response.py index e8627136..cb3ad99f 100644 --- a/fattureincloud_python_sdk/models/create_supplier_response.py +++ b/fattureincloud_python_sdk/models/create_supplier_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateSupplierResponse(BaseModel): """ CreateSupplierResponse - """ + """ # noqa: E501 data: Optional[Supplier] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateSupplierResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateSupplierResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateSupplierResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateSupplierResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateSupplierResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateSupplierResponse.parse_obj( + _obj = cls.model_validate( { "data": Supplier.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_vat_type_request.py b/fattureincloud_python_sdk/models/create_vat_type_request.py index 1c437d9a..ce02bbd6 100644 --- a/fattureincloud_python_sdk/models/create_vat_type_request.py +++ b/fattureincloud_python_sdk/models/create_vat_type_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateVatTypeRequest(BaseModel): """ CreateVatTypeRequest - """ + """ # noqa: E501 data: Optional[VatType] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateVatTypeRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateVatTypeRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateVatTypeRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateVatTypeRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateVatTypeRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateVatTypeRequest.parse_obj( + _obj = cls.model_validate( { "data": VatType.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_vat_type_response.py b/fattureincloud_python_sdk/models/create_vat_type_response.py index c0323454..3edc95dd 100644 --- a/fattureincloud_python_sdk/models/create_vat_type_response.py +++ b/fattureincloud_python_sdk/models/create_vat_type_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateVatTypeResponse(BaseModel): """ CreateVatTypeResponse - """ + """ # noqa: E501 data: Optional[VatType] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateVatTypeResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateVatTypeResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateVatTypeResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateVatTypeResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateVatTypeResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateVatTypeResponse.parse_obj( + _obj = cls.model_validate( { "data": VatType.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_webhooks_subscription_request.py b/fattureincloud_python_sdk/models/create_webhooks_subscription_request.py index 5984d26c..febece2a 100644 --- a/fattureincloud_python_sdk/models/create_webhooks_subscription_request.py +++ b/fattureincloud_python_sdk/models/create_webhooks_subscription_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateWebhooksSubscriptionRequest(BaseModel): """ CreateWebhooksSubscriptionRequest - """ + """ # noqa: E501 data: Optional[WebhooksSubscription] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateWebhooksSubscriptionRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateWebhooksSubscriptionRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateWebhooksSubscriptionRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateWebhooksSubscriptionRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateWebhooksSubscriptionRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateWebhooksSubscriptionRequest.parse_obj( + _obj = cls.model_validate( { "data": WebhooksSubscription.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/create_webhooks_subscription_response.py b/fattureincloud_python_sdk/models/create_webhooks_subscription_response.py index 99c97033..97b76500 100644 --- a/fattureincloud_python_sdk/models/create_webhooks_subscription_response.py +++ b/fattureincloud_python_sdk/models/create_webhooks_subscription_response.py @@ -19,59 +19,74 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class CreateWebhooksSubscriptionResponse(BaseModel): """ CreateWebhooksSubscriptionResponse - """ + """ # noqa: E501 data: Optional[WebhooksSubscription] = None - warnings: Optional[conlist(StrictStr)] = Field( - None, description="Webhooks registration warnings" + warnings: Optional[List[StrictStr]] = Field( + default=None, description="Webhooks registration warnings" ) - __properties = ["data", "warnings"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "warnings"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> CreateWebhooksSubscriptionResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of CreateWebhooksSubscriptionResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> CreateWebhooksSubscriptionResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of CreateWebhooksSubscriptionResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return CreateWebhooksSubscriptionResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = CreateWebhooksSubscriptionResponse.parse_obj( + _obj = cls.model_validate( { "data": WebhooksSubscription.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/currency.py b/fattureincloud_python_sdk/models/currency.py index 7491cccc..44ede9a4 100644 --- a/fattureincloud_python_sdk/models/currency.py +++ b/fattureincloud_python_sdk/models/currency.py @@ -19,66 +19,79 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class Currency(BaseModel): """ Currency - """ + """ # noqa: E501 - id: Optional[StrictStr] = Field(None, description="Currency code") - symbol: Optional[StrictStr] = Field(None, description="Currency symbol") + id: Optional[StrictStr] = Field(default=None, description="Currency code") + symbol: Optional[StrictStr] = Field(default=None, description="Currency symbol") exchange_rate: Optional[StrictStr] = Field( - None, description="Currency exchange rate (EUR to this)" + default=None, description="Currency exchange rate (EUR to this)" ) - html_symbol: Optional[StrictStr] = Field(None, description="Currency html code") - __properties = ["id", "symbol", "exchange_rate", "html_symbol"] - - class Config: - """Pydantic configuration""" + html_symbol: Optional[StrictStr] = Field( + default=None, description="Currency html code" + ) + __properties: ClassVar[List[str]] = ["id", "symbol", "exchange_rate", "html_symbol"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Currency: + def from_json(cls, json_str: str) -> Self: """Create an instance of Currency from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Currency: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Currency from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Currency.parse_obj(obj) + return cls.model_validate(obj) - _obj = Currency.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "symbol": obj.get("symbol") if obj.get("symbol") is not None else None, - "exchange_rate": obj.get("exchange_rate") - if obj.get("exchange_rate") is not None - else None, - "html_symbol": obj.get("html_symbol") - if obj.get("html_symbol") is not None - else None, + "id": obj.get("id"), + "symbol": obj.get("symbol"), + "exchange_rate": obj.get("exchange_rate"), + "html_symbol": obj.get("html_symbol"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/detailed_country.py b/fattureincloud_python_sdk/models/detailed_country.py index fdc5c169..9aa181e4 100644 --- a/fattureincloud_python_sdk/models/detailed_country.py +++ b/fattureincloud_python_sdk/models/detailed_country.py @@ -19,68 +19,87 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class DetailedCountry(BaseModel): """ DetailedCountry - """ + """ # noqa: E501 - name: Optional[StrictStr] = Field(None, description="Country name") + name: Optional[StrictStr] = Field(default=None, description="Country name") settings_name: Optional[StrictStr] = Field( - None, description="Country settings name" + default=None, description="Country settings name" ) - iso: Optional[StrictStr] = Field(None, description="Country iso code") - fiscal_iso: Optional[StrictStr] = Field(None, description="Country fiscal iso code") - uic: Optional[StrictStr] = Field(None, description="Country uic") - __properties = ["name", "settings_name", "iso", "fiscal_iso", "uic"] - - class Config: - """Pydantic configuration""" + iso: Optional[StrictStr] = Field(default=None, description="Country iso code") + fiscal_iso: Optional[StrictStr] = Field( + default=None, description="Country fiscal iso code" + ) + uic: Optional[StrictStr] = Field(default=None, description="Country uic") + __properties: ClassVar[List[str]] = [ + "name", + "settings_name", + "iso", + "fiscal_iso", + "uic", + ] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> DetailedCountry: + def from_json(cls, json_str: str) -> Self: """Create an instance of DetailedCountry from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> DetailedCountry: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of DetailedCountry from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DetailedCountry.parse_obj(obj) + return cls.model_validate(obj) - _obj = DetailedCountry.parse_obj( + _obj = cls.model_validate( { - "name": obj.get("name") if obj.get("name") is not None else None, - "settings_name": obj.get("settings_name") - if obj.get("settings_name") is not None - else None, - "iso": obj.get("iso") if obj.get("iso") is not None else None, - "fiscal_iso": obj.get("fiscal_iso") - if obj.get("fiscal_iso") is not None - else None, - "uic": obj.get("uic") if obj.get("uic") is not None else None, + "name": obj.get("name"), + "settings_name": obj.get("settings_name"), + "iso": obj.get("iso"), + "fiscal_iso": obj.get("fiscal_iso"), + "uic": obj.get("uic"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/document_template.py b/fattureincloud_python_sdk/models/document_template.py index c6092362..544adaf5 100644 --- a/fattureincloud_python_sdk/models/document_template.py +++ b/fattureincloud_python_sdk/models/document_template.py @@ -19,58 +19,69 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class DocumentTemplate(BaseModel): """ DocumentTemplate - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Template id") - name: Optional[StrictStr] = Field(None, description="Template name") - type: Optional[StrictStr] = Field(None, description="Template type") - __properties = ["id", "name", "type"] + id: Optional[StrictInt] = Field(default=None, description="Template id") + name: Optional[StrictStr] = Field(default=None, description="Template name") + type: Optional[StrictStr] = Field(default=None, description="Template type") + __properties: ClassVar[List[str]] = ["id", "name", "type"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> DocumentTemplate: + def from_json(cls, json_str: str) -> Self: """Create an instance of DocumentTemplate from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> DocumentTemplate: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of DocumentTemplate from a dict""" if obj is None: return None if not isinstance(obj, dict): - return DocumentTemplate.parse_obj(obj) - - _obj = DocumentTemplate.parse_obj( - { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "type": obj.get("type") if obj.get("type") is not None else None, - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"id": obj.get("id"), "name": obj.get("name"), "type": obj.get("type")} ) return _obj diff --git a/fattureincloud_python_sdk/models/e_invoice_rejection_reason.py b/fattureincloud_python_sdk/models/e_invoice_rejection_reason.py index c25cf56d..b134d90a 100644 --- a/fattureincloud_python_sdk/models/e_invoice_rejection_reason.py +++ b/fattureincloud_python_sdk/models/e_invoice_rejection_reason.py @@ -19,70 +19,89 @@ import json from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EInvoiceRejectionReason(BaseModel): """ EInvoiceRejectionReason - """ + """ # noqa: E501 - reason: Optional[StrictStr] = Field(None, description="E-invoice rejection reason") - ei_status: Optional[StrictStr] = Field(None, description="E-invoice status") - solution: Optional[StrictStr] = Field(None, description="Error solution.") + reason: Optional[StrictStr] = Field( + default=None, description="E-invoice rejection reason" + ) + ei_status: Optional[StrictStr] = Field(default=None, description="E-invoice status") + solution: Optional[StrictStr] = Field(default=None, description="Error solution.") code: Optional[StrictStr] = Field( - None, description="E-invoice rejection error code" + default=None, description="E-invoice rejection error code" ) var_date: Optional[datetime] = Field( - None, alias="date", description="E-invoice rejection date" + default=None, description="E-invoice rejection date", alias="date" ) - __properties = ["reason", "ei_status", "solution", "code", "date"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = [ + "reason", + "ei_status", + "solution", + "code", + "date", + ] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EInvoiceRejectionReason: + def from_json(cls, json_str: str) -> Self: """Create an instance of EInvoiceRejectionReason from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> EInvoiceRejectionReason: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EInvoiceRejectionReason from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EInvoiceRejectionReason.parse_obj(obj) + return cls.model_validate(obj) - _obj = EInvoiceRejectionReason.parse_obj( + _obj = cls.model_validate( { - "reason": obj.get("reason") if obj.get("reason") is not None else None, - "ei_status": obj.get("ei_status") - if obj.get("ei_status") is not None - else None, - "solution": obj.get("solution") - if obj.get("solution") is not None - else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, + "reason": obj.get("reason"), + "ei_status": obj.get("ei_status"), + "solution": obj.get("solution"), + "code": obj.get("code"), + "date": obj.get("date"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/email.py b/fattureincloud_python_sdk/models/email.py index 36d2211b..5f320a53 100644 --- a/fattureincloud_python_sdk/models/email.py +++ b/fattureincloud_python_sdk/models/email.py @@ -19,37 +19,55 @@ import json from datetime import datetime -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.email_attachment import EmailAttachment from fattureincloud_python_sdk.models.email_recipient_status import EmailRecipientStatus from fattureincloud_python_sdk.models.email_status import EmailStatus +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Email(BaseModel): """ Email - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Email id") + id: Optional[StrictInt] = Field(default=None, description="Email id") status: Optional[EmailStatus] = None - sent_date: Optional[datetime] = Field(None, description="Email sent date") - errors_count: Optional[StrictInt] = Field(None, description="Email errors count") - error_log: Optional[StrictStr] = Field(None, description="Email errors log") - from_email: Optional[StrictStr] = Field(None, description="Email sender email") - from_name: Optional[StrictStr] = Field(None, description="Email sender name") - to_email: Optional[StrictStr] = Field(None, description="Email recipient email") - to_name: Optional[StrictStr] = Field(None, description="Email receipient name") - subject: Optional[StrictStr] = Field(None, description="Email subject") - content: Optional[StrictStr] = Field(None, description="Email content") - copy_to: Optional[StrictStr] = Field(None, description="Email cc") + sent_date: Optional[datetime] = Field(default=None, description="Email sent date") + errors_count: Optional[StrictInt] = Field( + default=None, description="Email errors count" + ) + error_log: Optional[StrictStr] = Field(default=None, description="Email errors log") + from_email: Optional[StrictStr] = Field( + default=None, description="Email sender email" + ) + from_name: Optional[StrictStr] = Field( + default=None, description="Email sender name" + ) + to_email: Optional[StrictStr] = Field( + default=None, description="Email recipient email" + ) + to_name: Optional[StrictStr] = Field( + default=None, description="Email receipient name" + ) + subject: Optional[StrictStr] = Field(default=None, description="Email subject") + content: Optional[StrictStr] = Field(default=None, description="Email content") + copy_to: Optional[StrictStr] = Field(default=None, description="Email cc") recipient_status: Optional[EmailRecipientStatus] = None - recipient_date: Optional[datetime] = Field(None, description="Email recipient date") - kind: Optional[StrictStr] = Field(None, description="Email kind") - attachments: Optional[conlist(EmailAttachment)] = Field( - None, description="Email attachments" + recipient_date: Optional[datetime] = Field( + default=None, description="Email recipient date" + ) + kind: Optional[StrictStr] = Field(default=None, description="Email kind") + attachments: Optional[List[EmailAttachment]] = Field( + default=None, description="Email attachments" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "status", "sent_date", @@ -68,28 +86,37 @@ class Email(BaseModel): "attachments", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Email: + def from_json(cls, json_str: str) -> Self: """Create an instance of Email from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) _items = [] if self.attachments: @@ -100,53 +127,31 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Email: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Email from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Email.parse_obj(obj) + return cls.model_validate(obj) - _obj = Email.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, + "id": obj.get("id"), "status": obj.get("status"), - "sent_date": obj.get("sent_date") - if obj.get("sent_date") is not None - else None, - "errors_count": obj.get("errors_count") - if obj.get("errors_count") is not None - else None, - "error_log": obj.get("error_log") - if obj.get("error_log") is not None - else None, - "from_email": obj.get("from_email") - if obj.get("from_email") is not None - else None, - "from_name": obj.get("from_name") - if obj.get("from_name") is not None - else None, - "to_email": obj.get("to_email") - if obj.get("to_email") is not None - else None, - "to_name": obj.get("to_name") - if obj.get("to_name") is not None - else None, - "subject": obj.get("subject") - if obj.get("subject") is not None - else None, - "content": obj.get("content") - if obj.get("content") is not None - else None, - "copy_to": obj.get("copy_to") - if obj.get("copy_to") is not None - else None, + "sent_date": obj.get("sent_date"), + "errors_count": obj.get("errors_count"), + "error_log": obj.get("error_log"), + "from_email": obj.get("from_email"), + "from_name": obj.get("from_name"), + "to_email": obj.get("to_email"), + "to_name": obj.get("to_name"), + "subject": obj.get("subject"), + "content": obj.get("content"), + "copy_to": obj.get("copy_to"), "recipient_status": obj.get("recipient_status"), - "recipient_date": obj.get("recipient_date") - if obj.get("recipient_date") is not None - else None, - "kind": obj.get("kind") if obj.get("kind") is not None else None, + "recipient_date": obj.get("recipient_date"), + "kind": obj.get("kind"), "attachments": [ EmailAttachment.from_dict(_item) for _item in obj.get("attachments") ] diff --git a/fattureincloud_python_sdk/models/email_attachment.py b/fattureincloud_python_sdk/models/email_attachment.py index 88e109dc..fae67c17 100644 --- a/fattureincloud_python_sdk/models/email_attachment.py +++ b/fattureincloud_python_sdk/models/email_attachment.py @@ -19,58 +19,70 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EmailAttachment(BaseModel): """ EmailAttachment - """ + """ # noqa: E501 - filename: Optional[StrictStr] = Field(None, description="Email attachment filename") - url: Optional[StrictStr] = Field(None, description="Email attachment url") - __properties = ["filename", "url"] + filename: Optional[StrictStr] = Field( + default=None, description="Email attachment filename" + ) + url: Optional[StrictStr] = Field(default=None, description="Email attachment url") + __properties: ClassVar[List[str]] = ["filename", "url"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EmailAttachment: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailAttachment from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> EmailAttachment: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EmailAttachment from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailAttachment.parse_obj(obj) - - _obj = EmailAttachment.parse_obj( - { - "filename": obj.get("filename") - if obj.get("filename") is not None - else None, - "url": obj.get("url") if obj.get("url") is not None else None, - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"filename": obj.get("filename"), "url": obj.get("url")} ) return _obj diff --git a/fattureincloud_python_sdk/models/email_data.py b/fattureincloud_python_sdk/models/email_data.py index 1264b01e..3e68e930 100644 --- a/fattureincloud_python_sdk/models/email_data.py +++ b/fattureincloud_python_sdk/models/email_data.py @@ -19,45 +19,54 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.email_data_default_sender_email import ( EmailDataDefaultSenderEmail, ) from fattureincloud_python_sdk.models.sender_email import SenderEmail +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class EmailData(BaseModel): """ EmailData - """ + """ # noqa: E501 - recipient_email: Optional[StrictStr] = Field(None, description="Email recipient") + recipient_email: Optional[StrictStr] = Field( + default=None, description="Email recipient" + ) default_sender_email: Optional[EmailDataDefaultSenderEmail] = None - sender_emails_list: Optional[conlist(SenderEmail)] = Field( - None, description="List of all emails from which the document can be sent" + sender_emails_list: Optional[List[SenderEmail]] = Field( + default=None, + description="List of all emails from which the document can be sent", ) cc_email: Optional[StrictStr] = Field( - None, description="Email cc [by default is the logged company email]" + default=None, description="Email cc [by default is the logged company email]" ) - subject: Optional[StrictStr] = Field(None, description="Email subject") - body: Optional[StrictStr] = Field(None, description="Email body") + subject: Optional[StrictStr] = Field(default=None, description="Email subject") + body: Optional[StrictStr] = Field(default=None, description="Email body") document_exists: Optional[StrictBool] = Field( - None, description="Document exists if it is not a delivery note" + default=None, description="Document exists if it is not a delivery note" ) delivery_note_exists: Optional[StrictBool] = Field( - None, description="Document is a delivery note" + default=None, description="Document is a delivery note" ) attachment_exists: Optional[StrictBool] = Field( - None, description="Document has attachment" + default=None, description="Document has attachment" ) accompanying_invoice_exists: Optional[StrictBool] = Field( - None, description="Document has accompanying invoice" + default=None, description="Document has accompanying invoice" ) default_attach_pdf: Optional[StrictBool] = Field( - None, description="Attach document pdf" + default=None, description="Attach document pdf" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "recipient_email", "default_sender_email", "sender_emails_list", @@ -71,28 +80,37 @@ class EmailData(BaseModel): "default_attach_pdf", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EmailData: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_sender_email if self.default_sender_email: _dict["default_sender_email"] = self.default_sender_email.to_dict() @@ -106,19 +124,17 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> EmailData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EmailData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailData.parse_obj(obj) + return cls.model_validate(obj) - _obj = EmailData.parse_obj( + _obj = cls.model_validate( { - "recipient_email": obj.get("recipient_email") - if obj.get("recipient_email") is not None - else None, + "recipient_email": obj.get("recipient_email"), "default_sender_email": EmailDataDefaultSenderEmail.from_dict( obj.get("default_sender_email") ) @@ -130,28 +146,14 @@ def from_dict(cls, obj: dict) -> EmailData: ] if obj.get("sender_emails_list") is not None else None, - "cc_email": obj.get("cc_email") - if obj.get("cc_email") is not None - else None, - "subject": obj.get("subject") - if obj.get("subject") is not None - else None, - "body": obj.get("body") if obj.get("body") is not None else None, - "document_exists": obj.get("document_exists") - if obj.get("document_exists") is not None - else None, - "delivery_note_exists": obj.get("delivery_note_exists") - if obj.get("delivery_note_exists") is not None - else None, - "attachment_exists": obj.get("attachment_exists") - if obj.get("attachment_exists") is not None - else None, - "accompanying_invoice_exists": obj.get("accompanying_invoice_exists") - if obj.get("accompanying_invoice_exists") is not None - else None, - "default_attach_pdf": obj.get("default_attach_pdf") - if obj.get("default_attach_pdf") is not None - else None, + "cc_email": obj.get("cc_email"), + "subject": obj.get("subject"), + "body": obj.get("body"), + "document_exists": obj.get("document_exists"), + "delivery_note_exists": obj.get("delivery_note_exists"), + "attachment_exists": obj.get("attachment_exists"), + "accompanying_invoice_exists": obj.get("accompanying_invoice_exists"), + "default_attach_pdf": obj.get("default_attach_pdf"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/email_data_default_sender_email.py b/fattureincloud_python_sdk/models/email_data_default_sender_email.py index 502172e7..c2be188b 100644 --- a/fattureincloud_python_sdk/models/email_data_default_sender_email.py +++ b/fattureincloud_python_sdk/models/email_data_default_sender_email.py @@ -19,56 +19,68 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EmailDataDefaultSenderEmail(BaseModel): """ - Default sender email. (Other emails can be found in **sender_emails_list**) # noqa: E501 - """ + Default sender email. (Other emails can be found in **sender_emails_list**) + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Default sender email id") - email: Optional[StrictStr] = Field(None, description="Default sender email address") - __properties = ["id", "email"] + id: Optional[StrictInt] = Field(default=None, description="Default sender email id") + email: Optional[StrictStr] = Field( + default=None, description="Default sender email address" + ) + __properties: ClassVar[List[str]] = ["id", "email"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EmailDataDefaultSenderEmail: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailDataDefaultSenderEmail from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> EmailDataDefaultSenderEmail: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EmailDataDefaultSenderEmail from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailDataDefaultSenderEmail.parse_obj(obj) + return cls.model_validate(obj) - _obj = EmailDataDefaultSenderEmail.parse_obj( - { - "id": obj.get("id") if obj.get("id") is not None else None, - "email": obj.get("email") if obj.get("email") is not None else None, - } - ) + _obj = cls.model_validate({"id": obj.get("id"), "email": obj.get("email")}) return _obj diff --git a/fattureincloud_python_sdk/models/email_recipient_status.py b/fattureincloud_python_sdk/models/email_recipient_status.py index 56eea8da..00dc1d75 100644 --- a/fattureincloud_python_sdk/models/email_recipient_status.py +++ b/fattureincloud_python_sdk/models/email_recipient_status.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EmailRecipientStatus(str, Enum): @@ -32,6 +39,6 @@ class EmailRecipientStatus(str, Enum): EMAIL_OPENED = "email_opened" @classmethod - def from_json(cls, json_str: str) -> EmailRecipientStatus: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailRecipientStatus from a JSON string""" - return EmailRecipientStatus(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/email_schedule.py b/fattureincloud_python_sdk/models/email_schedule.py index bbcfd3f4..e5e85489 100644 --- a/fattureincloud_python_sdk/models/email_schedule.py +++ b/fattureincloud_python_sdk/models/email_schedule.py @@ -19,40 +19,46 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.email_schedule_include import EmailScheduleInclude +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class EmailSchedule(BaseModel): """ EmailSchedule - """ + """ # noqa: E501 sender_id: Optional[StrictInt] = Field( - None, + default=None, description="Email sender id [required if **sender_email** is not specified]", ) sender_email: Optional[StrictStr] = Field( - None, + default=None, description="Email sender address [required if **sender_id** is not specified]", ) recipient_email: Optional[StrictStr] = Field( - None, description="Email recipient emails [comma separated]" + default=None, description="Email recipient emails [comma separated]" ) - subject: Optional[StrictStr] = Field(None, description="Email subject") + subject: Optional[StrictStr] = Field(default=None, description="Email subject") body: Optional[StrictStr] = Field( - None, description="Email body [HTML Escaped] [max size 50KiB]" + default=None, description="Email body [HTML Escaped] [max size 50KiB]" ) include: Optional[EmailScheduleInclude] = None attach_pdf: Optional[StrictBool] = Field( - None, description="Attach the pdf of the document" + default=None, description="Attach the pdf of the document" ) send_copy: Optional[StrictBool] = Field( - None, + default=None, description="Send a copy of the email to the **cc_email** specified by **Get email data**", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "sender_id", "sender_email", "recipient_email", @@ -63,66 +69,63 @@ class EmailSchedule(BaseModel): "send_copy", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EmailSchedule: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailSchedule from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of include if self.include: _dict["include"] = self.include.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> EmailSchedule: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EmailSchedule from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailSchedule.parse_obj(obj) + return cls.model_validate(obj) - _obj = EmailSchedule.parse_obj( + _obj = cls.model_validate( { - "sender_id": obj.get("sender_id") - if obj.get("sender_id") is not None - else None, - "sender_email": obj.get("sender_email") - if obj.get("sender_email") is not None - else None, - "recipient_email": obj.get("recipient_email") - if obj.get("recipient_email") is not None - else None, - "subject": obj.get("subject") - if obj.get("subject") is not None - else None, - "body": obj.get("body") if obj.get("body") is not None else None, + "sender_id": obj.get("sender_id"), + "sender_email": obj.get("sender_email"), + "recipient_email": obj.get("recipient_email"), + "subject": obj.get("subject"), + "body": obj.get("body"), "include": EmailScheduleInclude.from_dict(obj.get("include")) if obj.get("include") is not None else None, - "attach_pdf": obj.get("attach_pdf") - if obj.get("attach_pdf") is not None - else None, - "send_copy": obj.get("send_copy") - if obj.get("send_copy") is not None - else None, + "attach_pdf": obj.get("attach_pdf"), + "send_copy": obj.get("send_copy"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/email_schedule_include.py b/fattureincloud_python_sdk/models/email_schedule_include.py index 64b72a0c..9c0e79dd 100644 --- a/fattureincloud_python_sdk/models/email_schedule_include.py +++ b/fattureincloud_python_sdk/models/email_schedule_include.py @@ -19,76 +19,88 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EmailScheduleInclude(BaseModel): """ EmailScheduleInclude - """ + """ # noqa: E501 document: Optional[StrictBool] = Field( - None, description="Include a button to view the document" + default=None, description="Include a button to view the document" ) delivery_note: Optional[StrictBool] = Field( - None, description="Include a button to view the delivery note" + default=None, description="Include a button to view the delivery note" ) attachment: Optional[StrictBool] = Field( - None, description="Include a button to view the attachment" + default=None, description="Include a button to view the attachment" ) accompanying_invoice: Optional[StrictBool] = Field( - None, description="Include a button to view the accompanying invoice" + default=None, description="Include a button to view the accompanying invoice" ) - __properties = ["document", "delivery_note", "attachment", "accompanying_invoice"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = [ + "document", + "delivery_note", + "attachment", + "accompanying_invoice", + ] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> EmailScheduleInclude: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailScheduleInclude from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> EmailScheduleInclude: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of EmailScheduleInclude from a dict""" if obj is None: return None if not isinstance(obj, dict): - return EmailScheduleInclude.parse_obj(obj) + return cls.model_validate(obj) - _obj = EmailScheduleInclude.parse_obj( + _obj = cls.model_validate( { - "document": obj.get("document") - if obj.get("document") is not None - else None, - "delivery_note": obj.get("delivery_note") - if obj.get("delivery_note") is not None - else None, - "attachment": obj.get("attachment") - if obj.get("attachment") is not None - else None, - "accompanying_invoice": obj.get("accompanying_invoice") - if obj.get("accompanying_invoice") is not None - else None, + "document": obj.get("document"), + "delivery_note": obj.get("delivery_note"), + "attachment": obj.get("attachment"), + "accompanying_invoice": obj.get("accompanying_invoice"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/email_status.py b/fattureincloud_python_sdk/models/email_status.py index bc635043..0892f2d2 100644 --- a/fattureincloud_python_sdk/models/email_status.py +++ b/fattureincloud_python_sdk/models/email_status.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EmailStatus(str, Enum): @@ -32,6 +39,6 @@ class EmailStatus(str, Enum): SENT = "sent" @classmethod - def from_json(cls, json_str: str) -> EmailStatus: + def from_json(cls, json_str: str) -> Self: """Create an instance of EmailStatus from a JSON string""" - return EmailStatus(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/entity.py b/fattureincloud_python_sdk/models/entity.py index 7d9a8f8c..b1761288 100644 --- a/fattureincloud_python_sdk/models/entity.py +++ b/fattureincloud_python_sdk/models/entity.py @@ -19,90 +19,108 @@ import json from datetime import date -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.entity_type import EntityType from fattureincloud_python_sdk.models.payment_method import PaymentMethod from fattureincloud_python_sdk.models.payment_terms_type import PaymentTermsType from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Entity(BaseModel): """ Entity - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Entity id") - code: Optional[StrictStr] = Field(None, description="Entity code") - name: Optional[StrictStr] = Field(None, description="Entity name") + id: Optional[StrictInt] = Field(default=None, description="Entity id") + code: Optional[StrictStr] = Field(default=None, description="Entity code") + name: Optional[StrictStr] = Field(default=None, description="Entity name") type: Optional[EntityType] = None - first_name: Optional[StrictStr] = Field(None, description="Entity first name") - last_name: Optional[StrictStr] = Field(None, description="Entity last name") + first_name: Optional[StrictStr] = Field( + default=None, description="Entity first name" + ) + last_name: Optional[StrictStr] = Field(default=None, description="Entity last name") contact_person: Optional[StrictStr] = Field( - None, description="Entity contact person" + default=None, description="Entity contact person" ) - vat_number: Optional[StrictStr] = Field(None, description="Entity vat number") - tax_code: Optional[StrictStr] = Field(None, description="Entity tax code") + vat_number: Optional[StrictStr] = Field( + default=None, description="Entity vat number" + ) + tax_code: Optional[StrictStr] = Field(default=None, description="Entity tax code") address_street: Optional[StrictStr] = Field( - None, description="Entitity address street" + default=None, description="Entitity address street" ) address_postal_code: Optional[StrictStr] = Field( - None, description="Entity address postal code" + default=None, description="Entity address postal code" + ) + address_city: Optional[StrictStr] = Field( + default=None, description="Entity address city" ) - address_city: Optional[StrictStr] = Field(None, description="Entity address city") address_province: Optional[StrictStr] = Field( - None, description="Entity address province" + default=None, description="Entity address province" ) address_extra: Optional[StrictStr] = Field( - None, description="Entity address extra info" + default=None, description="Entity address extra info" ) - country: Optional[StrictStr] = Field(None, description="Entity country") + country: Optional[StrictStr] = Field(default=None, description="Entity country") country_iso: Optional[StrictStr] = Field( - None, description="Entity country iso code" + default=None, description="Entity country iso code" ) - email: Optional[StrictStr] = Field(None, description="Entity email") + email: Optional[StrictStr] = Field(default=None, description="Entity email") certified_email: Optional[StrictStr] = Field( - None, description="Entity certified email" + default=None, description="Entity certified email" ) - phone: Optional[StrictStr] = Field(None, description="Entity phone") - fax: Optional[StrictStr] = Field(None, description="Entity fax") - notes: Optional[StrictStr] = Field(None, description="Entity extra") + phone: Optional[StrictStr] = Field(default=None, description="Entity phone") + fax: Optional[StrictStr] = Field(default=None, description="Entity fax") + notes: Optional[StrictStr] = Field(default=None, description="Entity extra") default_payment_terms: Optional[StrictInt] = Field( - None, description="[Only for client] Client default payment terms" + default=None, description="[Only for client] Client default payment terms" ) default_vat: Optional[VatType] = None default_payment_terms_type: Optional[PaymentTermsType] = None default_payment_method: Optional[PaymentMethod] = None bank_name: Optional[StrictStr] = Field( - None, description="[Only for client] Client bank name" + default=None, description="[Only for client] Client bank name" ) bank_iban: Optional[StrictStr] = Field( - None, description="[Only for client] Client bank iban" + default=None, description="[Only for client] Client bank iban" ) bank_swift_code: Optional[StrictStr] = Field( - None, description="[Only for client] Client bank swift code" + default=None, description="[Only for client] Client bank swift code" ) shipping_address: Optional[StrictStr] = Field( - None, description="[Only for client] Client Shipping address" + default=None, description="[Only for client] Client Shipping address" ) e_invoice: Optional[StrictBool] = Field( - None, description="[Only for client] Use e-invoices." + default=None, description="[Only for client] Use e-invoices." ) ei_code: Optional[StrictStr] = Field( - None, description="[Only for client] E-invoices code." + default=None, description="[Only for client] E-invoices code." ) has_intent_declaration: Optional[StrictBool] = Field( - None, description="[Only for client] Has intent declaration." + default=None, description="[Only for client] Has intent declaration." ) intent_declaration_protocol_number: Optional[StrictStr] = Field( - None, description="[Only for client] Client intent declaration protocol number" + default=None, + description="[Only for client] Client intent declaration protocol number", ) intent_declaration_protocol_date: Optional[date] = Field( - None, description="[Only for client] Client intent declaration protocol date" + default=None, + description="[Only for client] Client intent declaration protocol date", ) - created_at: Optional[StrictStr] = Field(None, description="Entity creation date") - updated_at: Optional[StrictStr] = Field(None, description="Entity last update date") - __properties = [ + created_at: Optional[StrictStr] = Field( + default=None, description="Entity creation date" + ) + updated_at: Optional[StrictStr] = Field( + default=None, description="Entity last update date" + ) + __properties: ClassVar[List[str]] = [ "id", "code", "name", @@ -141,28 +159,37 @@ class Entity(BaseModel): "updated_at", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Entity: + def from_json(cls, json_str: str) -> Self: """Create an instance of Entity from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_vat if self.default_vat: _dict["default_vat"] = self.default_vat.to_dict() @@ -172,66 +199,38 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Entity: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Entity from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Entity.parse_obj(obj) + return cls.model_validate(obj) - _obj = Entity.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "code": obj.get("code"), + "name": obj.get("name"), "type": obj.get("type"), - "first_name": obj.get("first_name") - if obj.get("first_name") is not None - else None, - "last_name": obj.get("last_name") - if obj.get("last_name") is not None - else None, - "contact_person": obj.get("contact_person") - if obj.get("contact_person") is not None - else None, - "vat_number": obj.get("vat_number") - if obj.get("vat_number") is not None - else None, - "tax_code": obj.get("tax_code") - if obj.get("tax_code") is not None - else None, - "address_street": obj.get("address_street") - if obj.get("address_street") is not None - else None, - "address_postal_code": obj.get("address_postal_code") - if obj.get("address_postal_code") is not None - else None, - "address_city": obj.get("address_city") - if obj.get("address_city") is not None - else None, - "address_province": obj.get("address_province") - if obj.get("address_province") is not None - else None, - "address_extra": obj.get("address_extra") - if obj.get("address_extra") is not None - else None, - "country": obj.get("country") - if obj.get("country") is not None - else None, - "country_iso": obj.get("country_iso") - if obj.get("country_iso") is not None - else None, - "email": obj.get("email") if obj.get("email") is not None else None, - "certified_email": obj.get("certified_email") - if obj.get("certified_email") is not None - else None, - "phone": obj.get("phone") if obj.get("phone") is not None else None, - "fax": obj.get("fax") if obj.get("fax") is not None else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "default_payment_terms": obj.get("default_payment_terms") - if obj.get("default_payment_terms") is not None - else None, + "first_name": obj.get("first_name"), + "last_name": obj.get("last_name"), + "contact_person": obj.get("contact_person"), + "vat_number": obj.get("vat_number"), + "tax_code": obj.get("tax_code"), + "address_street": obj.get("address_street"), + "address_postal_code": obj.get("address_postal_code"), + "address_city": obj.get("address_city"), + "address_province": obj.get("address_province"), + "address_extra": obj.get("address_extra"), + "country": obj.get("country"), + "country_iso": obj.get("country_iso"), + "email": obj.get("email"), + "certified_email": obj.get("certified_email"), + "phone": obj.get("phone"), + "fax": obj.get("fax"), + "notes": obj.get("notes"), + "default_payment_terms": obj.get("default_payment_terms"), "default_vat": VatType.from_dict(obj.get("default_vat")) if obj.get("default_vat") is not None else None, @@ -241,43 +240,21 @@ def from_dict(cls, obj: dict) -> Entity: ) if obj.get("default_payment_method") is not None else None, - "bank_name": obj.get("bank_name") - if obj.get("bank_name") is not None - else None, - "bank_iban": obj.get("bank_iban") - if obj.get("bank_iban") is not None - else None, - "bank_swift_code": obj.get("bank_swift_code") - if obj.get("bank_swift_code") is not None - else None, - "shipping_address": obj.get("shipping_address") - if obj.get("shipping_address") is not None - else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, - "ei_code": obj.get("ei_code") - if obj.get("ei_code") is not None - else None, - "has_intent_declaration": obj.get("has_intent_declaration") - if obj.get("has_intent_declaration") is not None - else None, + "bank_name": obj.get("bank_name"), + "bank_iban": obj.get("bank_iban"), + "bank_swift_code": obj.get("bank_swift_code"), + "shipping_address": obj.get("shipping_address"), + "e_invoice": obj.get("e_invoice"), + "ei_code": obj.get("ei_code"), + "has_intent_declaration": obj.get("has_intent_declaration"), "intent_declaration_protocol_number": obj.get( "intent_declaration_protocol_number" - ) - if obj.get("intent_declaration_protocol_number") is not None - else None, + ), "intent_declaration_protocol_date": obj.get( "intent_declaration_protocol_date" - ) - if obj.get("intent_declaration_protocol_date") is not None - else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + ), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/entity_type.py b/fattureincloud_python_sdk/models/entity_type.py index 3c9b014d..c4f8f5bb 100644 --- a/fattureincloud_python_sdk/models/entity_type.py +++ b/fattureincloud_python_sdk/models/entity_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EntityType(str, Enum): @@ -33,6 +40,6 @@ class EntityType(str, Enum): CONDO = "condo" @classmethod - def from_json(cls, json_str: str) -> EntityType: + def from_json(cls, json_str: str) -> Self: """Create an instance of EntityType from a JSON string""" - return EntityType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/event_type.py b/fattureincloud_python_sdk/models/event_type.py index bb453db4..9d288a21 100644 --- a/fattureincloud_python_sdk/models/event_type.py +++ b/fattureincloud_python_sdk/models/event_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class EventType(str, Enum): @@ -209,6 +216,6 @@ class EventType(str, Enum): ) @classmethod - def from_json(cls, json_str: str) -> EventType: + def from_json(cls, json_str: str) -> Self: """Create an instance of EventType from a JSON string""" - return EventType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/f24.py b/fattureincloud_python_sdk/models/f24.py index cdcc62c9..053016f6 100644 --- a/fattureincloud_python_sdk/models/f24.py +++ b/fattureincloud_python_sdk/models/f24.py @@ -19,33 +19,41 @@ import json from datetime import date -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.f24_status import F24Status from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class F24(BaseModel): """ F24 - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="F24 id") - due_date: Optional[date] = Field(None, description="F24 due date") + id: Optional[StrictInt] = Field(default=None, description="F24 id") + due_date: Optional[date] = Field(default=None, description="F24 due date") status: Optional[F24Status] = None payment_account: Optional[PaymentAccount] = None amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="F24 amount" + default=None, description="F24 amount" ) attachment_url: Optional[StrictStr] = Field( - None, description="[Temporary] [Read Only] F24 url of the attached file" + default=None, description="[Temporary] [Read Only] F24 url of the attached file" ) attachment_token: Optional[StrictStr] = Field( - None, + default=None, description="[Write Only] F24 attachment token returned by POST /taxes/attachment", ) - description: Optional[StrictStr] = Field(None, description="F24 description") - __properties = [ + description: Optional[StrictStr] = Field( + default=None, description="F24 description" + ) + __properties: ClassVar[List[str]] = [ "id", "due_date", "status", @@ -56,28 +64,34 @@ class F24(BaseModel): "description", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> F24: + def from_json(cls, json_str: str) -> Self: """Create an instance of F24 from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "attachment_url", @@ -90,36 +104,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> F24: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of F24 from a dict""" if obj is None: return None if not isinstance(obj, dict): - return F24.parse_obj(obj) + return cls.model_validate(obj) - _obj = F24.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "due_date": obj.get("due_date") - if obj.get("due_date") is not None - else None, + "id": obj.get("id"), + "due_date": obj.get("due_date"), "status": obj.get("status"), "payment_account": PaymentAccount.from_dict(obj.get("payment_account")) if obj.get("payment_account") is not None else None, - "amount": float(obj.get("amount")) - if obj.get("amount") is not None - else None, - "attachment_url": obj.get("attachment_url") - if obj.get("attachment_url") is not None - else None, - "attachment_token": obj.get("attachment_token") - if obj.get("attachment_token") is not None - else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, + "amount": obj.get("amount"), + "attachment_url": obj.get("attachment_url"), + "attachment_token": obj.get("attachment_token"), + "description": obj.get("description"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/f24_status.py b/fattureincloud_python_sdk/models/f24_status.py index d7c07b25..9a2b6bdb 100644 --- a/fattureincloud_python_sdk/models/f24_status.py +++ b/fattureincloud_python_sdk/models/f24_status.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class F24Status(str, Enum): @@ -32,6 +39,6 @@ class F24Status(str, Enum): REVERSED = "reversed" @classmethod - def from_json(cls, json_str: str) -> F24Status: + def from_json(cls, json_str: str) -> Self: """Create an instance of F24Status from a JSON string""" - return F24Status(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/function_status.py b/fattureincloud_python_sdk/models/function_status.py index 47ba2a8c..e569fe65 100644 --- a/fattureincloud_python_sdk/models/function_status.py +++ b/fattureincloud_python_sdk/models/function_status.py @@ -19,52 +19,64 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class FunctionStatus(BaseModel): """ FunctionStatus - """ + """ # noqa: E501 active: Optional[StrictBool] = None - __properties = ["active"] + __properties: ClassVar[List[str]] = ["active"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> FunctionStatus: + def from_json(cls, json_str: str) -> Self: """Create an instance of FunctionStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> FunctionStatus: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of FunctionStatus from a dict""" if obj is None: return None if not isinstance(obj, dict): - return FunctionStatus.parse_obj(obj) + return cls.model_validate(obj) - _obj = FunctionStatus.parse_obj( - {"active": obj.get("active") if obj.get("active") is not None else None} - ) + _obj = cls.model_validate({"active": obj.get("active")}) return _obj diff --git a/fattureincloud_python_sdk/models/get_archive_document_response.py b/fattureincloud_python_sdk/models/get_archive_document_response.py index 8bd93f62..52f0a817 100644 --- a/fattureincloud_python_sdk/models/get_archive_document_response.py +++ b/fattureincloud_python_sdk/models/get_archive_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetArchiveDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ArchiveDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetArchiveDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetArchiveDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetArchiveDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetArchiveDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetArchiveDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetArchiveDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ArchiveDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_cashbook_entry_response.py b/fattureincloud_python_sdk/models/get_cashbook_entry_response.py index ea57a7ac..413de108 100644 --- a/fattureincloud_python_sdk/models/get_cashbook_entry_response.py +++ b/fattureincloud_python_sdk/models/get_cashbook_entry_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetCashbookEntryResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CashbookEntry] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetCashbookEntryResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetCashbookEntryResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetCashbookEntryResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetCashbookEntryResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetCashbookEntryResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetCashbookEntryResponse.parse_obj( + _obj = cls.model_validate( { "data": CashbookEntry.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_client_response.py b/fattureincloud_python_sdk/models/get_client_response.py index 991b6ee1..41c457f7 100644 --- a/fattureincloud_python_sdk/models/get_client_response.py +++ b/fattureincloud_python_sdk/models/get_client_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetClientResponse(BaseModel): """ GetClientResponse - """ + """ # noqa: E501 data: Optional[Client] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetClientResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetClientResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetClientResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetClientResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetClientResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetClientResponse.parse_obj( + _obj = cls.model_validate( { "data": Client.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_company_info_response.py b/fattureincloud_python_sdk/models/get_company_info_response.py index c12d0e08..3e84c4d0 100644 --- a/fattureincloud_python_sdk/models/get_company_info_response.py +++ b/fattureincloud_python_sdk/models/get_company_info_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.company_info import CompanyInfo +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetCompanyInfoResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CompanyInfo] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetCompanyInfoResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetCompanyInfoResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetCompanyInfoResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetCompanyInfoResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetCompanyInfoResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetCompanyInfoResponse.parse_obj( + _obj = cls.model_validate( { "data": CompanyInfo.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_e_invoice_rejection_reason_response.py b/fattureincloud_python_sdk/models/get_e_invoice_rejection_reason_response.py index 16610210..af67711a 100644 --- a/fattureincloud_python_sdk/models/get_e_invoice_rejection_reason_response.py +++ b/fattureincloud_python_sdk/models/get_e_invoice_rejection_reason_response.py @@ -19,58 +19,72 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.e_invoice_rejection_reason import ( EInvoiceRejectionReason, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetEInvoiceRejectionReasonResponse(BaseModel): """ GetEInvoiceRejectionReasonResponse - """ + """ # noqa: E501 data: Optional[EInvoiceRejectionReason] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetEInvoiceRejectionReasonResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetEInvoiceRejectionReasonResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetEInvoiceRejectionReasonResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetEInvoiceRejectionReasonResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetEInvoiceRejectionReasonResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetEInvoiceRejectionReasonResponse.parse_obj( + _obj = cls.model_validate( { "data": EInvoiceRejectionReason.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_email_data_response.py b/fattureincloud_python_sdk/models/get_email_data_response.py index 646046e4..dc4b9ba8 100644 --- a/fattureincloud_python_sdk/models/get_email_data_response.py +++ b/fattureincloud_python_sdk/models/get_email_data_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.email_data import EmailData +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetEmailDataResponse(BaseModel): """ GetEmailDataResponse - """ + """ # noqa: E501 data: Optional[EmailData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetEmailDataResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetEmailDataResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetEmailDataResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetEmailDataResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetEmailDataResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetEmailDataResponse.parse_obj( + _obj = cls.model_validate( { "data": EmailData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_existing_issued_document_totals_request.py b/fattureincloud_python_sdk/models/get_existing_issued_document_totals_request.py index 2646e1ff..744afc96 100644 --- a/fattureincloud_python_sdk/models/get_existing_issued_document_totals_request.py +++ b/fattureincloud_python_sdk/models/get_existing_issued_document_totals_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetExistingIssuedDocumentTotalsRequest(BaseModel): """ GetExistingIssuedDocumentTotalsRequest - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetExistingIssuedDocumentTotalsRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetExistingIssuedDocumentTotalsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetExistingIssuedDocumentTotalsRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetExistingIssuedDocumentTotalsRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetExistingIssuedDocumentTotalsRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetExistingIssuedDocumentTotalsRequest.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_existing_issued_document_totals_response.py b/fattureincloud_python_sdk/models/get_existing_issued_document_totals_response.py index 0e9d6125..868711fc 100644 --- a/fattureincloud_python_sdk/models/get_existing_issued_document_totals_response.py +++ b/fattureincloud_python_sdk/models/get_existing_issued_document_totals_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document_totals import IssuedDocumentTotals +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetExistingIssuedDocumentTotalsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[IssuedDocumentTotals] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetExistingIssuedDocumentTotalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetExistingIssuedDocumentTotalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetExistingIssuedDocumentTotalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetExistingIssuedDocumentTotalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetExistingIssuedDocumentTotalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetExistingIssuedDocumentTotalsResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocumentTotals.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_existing_received_document_totals_request.py b/fattureincloud_python_sdk/models/get_existing_received_document_totals_request.py index f76025d5..fafd70e6 100644 --- a/fattureincloud_python_sdk/models/get_existing_received_document_totals_request.py +++ b/fattureincloud_python_sdk/models/get_existing_received_document_totals_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetExistingReceivedDocumentTotalsRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetExistingReceivedDocumentTotalsRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetExistingReceivedDocumentTotalsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetExistingReceivedDocumentTotalsRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetExistingReceivedDocumentTotalsRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetExistingReceivedDocumentTotalsRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetExistingReceivedDocumentTotalsRequest.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_existing_received_document_totals_response.py b/fattureincloud_python_sdk/models/get_existing_received_document_totals_response.py index 0df8246a..d4d18d25 100644 --- a/fattureincloud_python_sdk/models/get_existing_received_document_totals_response.py +++ b/fattureincloud_python_sdk/models/get_existing_received_document_totals_response.py @@ -19,58 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document_totals import ( ReceivedDocumentTotals, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetExistingReceivedDocumentTotalsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocumentTotals] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetExistingReceivedDocumentTotalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetExistingReceivedDocumentTotalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetExistingReceivedDocumentTotalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetExistingReceivedDocumentTotalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetExistingReceivedDocumentTotalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetExistingReceivedDocumentTotalsResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocumentTotals.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_f24_response.py b/fattureincloud_python_sdk/models/get_f24_response.py index 4b83cd49..92ec762e 100644 --- a/fattureincloud_python_sdk/models/get_f24_response.py +++ b/fattureincloud_python_sdk/models/get_f24_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetF24Response(BaseModel): """ GetF24Response - """ + """ # noqa: E501 data: Optional[F24] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetF24Response: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetF24Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetF24Response: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetF24Response from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetF24Response.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetF24Response.parse_obj( + _obj = cls.model_validate( { "data": F24.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_issued_document_pre_create_info_response.py b/fattureincloud_python_sdk/models/get_issued_document_pre_create_info_response.py index 7899b97e..30a23bd4 100644 --- a/fattureincloud_python_sdk/models/get_issued_document_pre_create_info_response.py +++ b/fattureincloud_python_sdk/models/get_issued_document_pre_create_info_response.py @@ -19,58 +19,72 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document_pre_create_info import ( IssuedDocumentPreCreateInfo, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetIssuedDocumentPreCreateInfoResponse(BaseModel): """ GetIssuedDocumentPreCreateInfoResponse - """ + """ # noqa: E501 data: Optional[IssuedDocumentPreCreateInfo] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetIssuedDocumentPreCreateInfoResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetIssuedDocumentPreCreateInfoResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetIssuedDocumentPreCreateInfoResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetIssuedDocumentPreCreateInfoResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetIssuedDocumentPreCreateInfoResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetIssuedDocumentPreCreateInfoResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocumentPreCreateInfo.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_issued_document_response.py b/fattureincloud_python_sdk/models/get_issued_document_response.py index 0093cc34..d7b8d7c2 100644 --- a/fattureincloud_python_sdk/models/get_issued_document_response.py +++ b/fattureincloud_python_sdk/models/get_issued_document_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetIssuedDocumentResponse(BaseModel): """ GetIssuedDocumentResponse - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetIssuedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetIssuedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetIssuedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetIssuedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetIssuedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetIssuedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_new_issued_document_totals_request.py b/fattureincloud_python_sdk/models/get_new_issued_document_totals_request.py index 3bebafea..f61a4a3b 100644 --- a/fattureincloud_python_sdk/models/get_new_issued_document_totals_request.py +++ b/fattureincloud_python_sdk/models/get_new_issued_document_totals_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetNewIssuedDocumentTotalsRequest(BaseModel): """ GetNewIssuedDocumentTotalsRequest - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetNewIssuedDocumentTotalsRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetNewIssuedDocumentTotalsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetNewIssuedDocumentTotalsRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetNewIssuedDocumentTotalsRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetNewIssuedDocumentTotalsRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetNewIssuedDocumentTotalsRequest.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_new_issued_document_totals_response.py b/fattureincloud_python_sdk/models/get_new_issued_document_totals_response.py index 79c654aa..bc9e98e0 100644 --- a/fattureincloud_python_sdk/models/get_new_issued_document_totals_response.py +++ b/fattureincloud_python_sdk/models/get_new_issued_document_totals_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document_totals import IssuedDocumentTotals +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetNewIssuedDocumentTotalsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[IssuedDocumentTotals] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetNewIssuedDocumentTotalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetNewIssuedDocumentTotalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetNewIssuedDocumentTotalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetNewIssuedDocumentTotalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetNewIssuedDocumentTotalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetNewIssuedDocumentTotalsResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocumentTotals.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_new_received_document_totals_request.py b/fattureincloud_python_sdk/models/get_new_received_document_totals_request.py index 537b7bcd..82f7be32 100644 --- a/fattureincloud_python_sdk/models/get_new_received_document_totals_request.py +++ b/fattureincloud_python_sdk/models/get_new_received_document_totals_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetNewReceivedDocumentTotalsRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetNewReceivedDocumentTotalsRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetNewReceivedDocumentTotalsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetNewReceivedDocumentTotalsRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetNewReceivedDocumentTotalsRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetNewReceivedDocumentTotalsRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetNewReceivedDocumentTotalsRequest.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_new_received_document_totals_response.py b/fattureincloud_python_sdk/models/get_new_received_document_totals_response.py index 1ec7ef8b..5d942246 100644 --- a/fattureincloud_python_sdk/models/get_new_received_document_totals_response.py +++ b/fattureincloud_python_sdk/models/get_new_received_document_totals_response.py @@ -19,58 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document_totals import ( ReceivedDocumentTotals, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetNewReceivedDocumentTotalsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocumentTotals] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetNewReceivedDocumentTotalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetNewReceivedDocumentTotalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetNewReceivedDocumentTotalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetNewReceivedDocumentTotalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetNewReceivedDocumentTotalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetNewReceivedDocumentTotalsResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocumentTotals.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_payment_account_response.py b/fattureincloud_python_sdk/models/get_payment_account_response.py index c1001a95..8a9344d9 100644 --- a/fattureincloud_python_sdk/models/get_payment_account_response.py +++ b/fattureincloud_python_sdk/models/get_payment_account_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetPaymentAccountResponse(BaseModel): """ GetPaymentAccountResponse - """ + """ # noqa: E501 data: Optional[PaymentAccount] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetPaymentAccountResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetPaymentAccountResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetPaymentAccountResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetPaymentAccountResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetPaymentAccountResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetPaymentAccountResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentAccount.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_payment_method_response.py b/fattureincloud_python_sdk/models/get_payment_method_response.py index 1b8157f6..c0aaf12e 100644 --- a/fattureincloud_python_sdk/models/get_payment_method_response.py +++ b/fattureincloud_python_sdk/models/get_payment_method_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetPaymentMethodResponse(BaseModel): """ GetPaymentMethodResponse - """ + """ # noqa: E501 data: Optional[PaymentMethod] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetPaymentMethodResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetPaymentMethodResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetPaymentMethodResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetPaymentMethodResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetPaymentMethodResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetPaymentMethodResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentMethod.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_product_response.py b/fattureincloud_python_sdk/models/get_product_response.py index be5f4f8f..4ec0bf72 100644 --- a/fattureincloud_python_sdk/models/get_product_response.py +++ b/fattureincloud_python_sdk/models/get_product_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetProductResponse(BaseModel): """ GetProductResponse - """ + """ # noqa: E501 data: Optional[Product] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetProductResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetProductResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetProductResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetProductResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetProductResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetProductResponse.parse_obj( + _obj = cls.model_validate( { "data": Product.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_receipt_pre_create_info_response.py b/fattureincloud_python_sdk/models/get_receipt_pre_create_info_response.py index b2b2947c..fab518cf 100644 --- a/fattureincloud_python_sdk/models/get_receipt_pre_create_info_response.py +++ b/fattureincloud_python_sdk/models/get_receipt_pre_create_info_response.py @@ -19,58 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt_pre_create_info import ( ReceiptPreCreateInfo, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetReceiptPreCreateInfoResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceiptPreCreateInfo] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetReceiptPreCreateInfoResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetReceiptPreCreateInfoResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetReceiptPreCreateInfoResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetReceiptPreCreateInfoResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetReceiptPreCreateInfoResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetReceiptPreCreateInfoResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceiptPreCreateInfo.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_receipt_response.py b/fattureincloud_python_sdk/models/get_receipt_response.py index 7066f419..ca750aab 100644 --- a/fattureincloud_python_sdk/models/get_receipt_response.py +++ b/fattureincloud_python_sdk/models/get_receipt_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetReceiptResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Receipt] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetReceiptResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetReceiptResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetReceiptResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetReceiptResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetReceiptResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetReceiptResponse.parse_obj( + _obj = cls.model_validate( { "data": Receipt.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_receipts_monthly_totals_response.py b/fattureincloud_python_sdk/models/get_receipts_monthly_totals_response.py index 5fa3fc5f..912f38e1 100644 --- a/fattureincloud_python_sdk/models/get_receipts_monthly_totals_response.py +++ b/fattureincloud_python_sdk/models/get_receipts_monthly_totals_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.monthly_total import MonthlyTotal +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class GetReceiptsMonthlyTotalsResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(MonthlyTotal)] = None - __properties = ["data"] +class GetReceiptsMonthlyTotalsResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[MonthlyTotal]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetReceiptsMonthlyTotalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetReceiptsMonthlyTotalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> GetReceiptsMonthlyTotalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetReceiptsMonthlyTotalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetReceiptsMonthlyTotalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetReceiptsMonthlyTotalsResponse.parse_obj( + _obj = cls.model_validate( { "data": [MonthlyTotal.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_received_document_pre_create_info_response.py b/fattureincloud_python_sdk/models/get_received_document_pre_create_info_response.py index dfff9e77..dea8fb98 100644 --- a/fattureincloud_python_sdk/models/get_received_document_pre_create_info_response.py +++ b/fattureincloud_python_sdk/models/get_received_document_pre_create_info_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document_info import ReceivedDocumentInfo +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetReceivedDocumentPreCreateInfoResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocumentInfo] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetReceivedDocumentPreCreateInfoResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetReceivedDocumentPreCreateInfoResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetReceivedDocumentPreCreateInfoResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetReceivedDocumentPreCreateInfoResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetReceivedDocumentPreCreateInfoResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetReceivedDocumentPreCreateInfoResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocumentInfo.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_received_document_response.py b/fattureincloud_python_sdk/models/get_received_document_response.py index 38bb6546..2242501c 100644 --- a/fattureincloud_python_sdk/models/get_received_document_response.py +++ b/fattureincloud_python_sdk/models/get_received_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetReceivedDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetReceivedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetReceivedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetReceivedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetReceivedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetReceivedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetReceivedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_supplier_response.py b/fattureincloud_python_sdk/models/get_supplier_response.py index 2774febc..c20afeb1 100644 --- a/fattureincloud_python_sdk/models/get_supplier_response.py +++ b/fattureincloud_python_sdk/models/get_supplier_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetSupplierResponse(BaseModel): """ GetSupplierResponse - """ + """ # noqa: E501 data: Optional[Supplier] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetSupplierResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetSupplierResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetSupplierResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetSupplierResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetSupplierResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetSupplierResponse.parse_obj( + _obj = cls.model_validate( { "data": Supplier.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_user_info_response.py b/fattureincloud_python_sdk/models/get_user_info_response.py index 6ceb5b4f..83f29cf7 100644 --- a/fattureincloud_python_sdk/models/get_user_info_response.py +++ b/fattureincloud_python_sdk/models/get_user_info_response.py @@ -19,7 +19,7 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.get_user_info_response_email_confirmation_state import ( GetUserInfoResponseEmailConfirmationState, @@ -29,39 +29,51 @@ ) from fattureincloud_python_sdk.models.user import User +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetUserInfoResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[User] = None info: Optional[GetUserInfoResponseInfo] = None email_confirmation_state: Optional[GetUserInfoResponseEmailConfirmationState] = None - __properties = ["data", "info", "email_confirmation_state"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "info", "email_confirmation_state"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetUserInfoResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetUserInfoResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -74,15 +86,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> GetUserInfoResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetUserInfoResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetUserInfoResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetUserInfoResponse.parse_obj( + _obj = cls.model_validate( { "data": User.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_user_info_response_email_confirmation_state.py b/fattureincloud_python_sdk/models/get_user_info_response_email_confirmation_state.py index 46fe144c..7ed09c01 100644 --- a/fattureincloud_python_sdk/models/get_user_info_response_email_confirmation_state.py +++ b/fattureincloud_python_sdk/models/get_user_info_response_email_confirmation_state.py @@ -19,56 +19,64 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetUserInfoResponseEmailConfirmationState(BaseModel): """ GetUserInfoResponseEmailConfirmationState - """ + """ # noqa: E501 need_confirmation: Optional[StrictBool] = None - __properties = ["need_confirmation"] + __properties: ClassVar[List[str]] = ["need_confirmation"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetUserInfoResponseEmailConfirmationState: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetUserInfoResponseEmailConfirmationState from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> GetUserInfoResponseEmailConfirmationState: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetUserInfoResponseEmailConfirmationState from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetUserInfoResponseEmailConfirmationState.parse_obj(obj) - - _obj = GetUserInfoResponseEmailConfirmationState.parse_obj( - { - "need_confirmation": obj.get("need_confirmation") - if obj.get("need_confirmation") is not None - else None - } - ) + return cls.model_validate(obj) + + _obj = cls.model_validate({"need_confirmation": obj.get("need_confirmation")}) return _obj diff --git a/fattureincloud_python_sdk/models/get_user_info_response_info.py b/fattureincloud_python_sdk/models/get_user_info_response_info.py index 53c4927f..b1f23d5f 100644 --- a/fattureincloud_python_sdk/models/get_user_info_response_info.py +++ b/fattureincloud_python_sdk/models/get_user_info_response_info.py @@ -19,72 +19,80 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetUserInfoResponseInfo(BaseModel): """ GetUserInfoResponseInfo - """ + """ # noqa: E501 need_marketing_consents_confirmation: Optional[StrictBool] = None need_password_change: Optional[StrictBool] = None need_terms_of_service_confirmation: Optional[StrictBool] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "need_marketing_consents_confirmation", "need_password_change", "need_terms_of_service_confirmation", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetUserInfoResponseInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetUserInfoResponseInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> GetUserInfoResponseInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetUserInfoResponseInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetUserInfoResponseInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetUserInfoResponseInfo.parse_obj( + _obj = cls.model_validate( { "need_marketing_consents_confirmation": obj.get( "need_marketing_consents_confirmation" - ) - if obj.get("need_marketing_consents_confirmation") is not None - else None, - "need_password_change": obj.get("need_password_change") - if obj.get("need_password_change") is not None - else None, + ), + "need_password_change": obj.get("need_password_change"), "need_terms_of_service_confirmation": obj.get( "need_terms_of_service_confirmation" - ) - if obj.get("need_terms_of_service_confirmation") is not None - else None, + ), } ) return _obj diff --git a/fattureincloud_python_sdk/models/get_vat_type_response.py b/fattureincloud_python_sdk/models/get_vat_type_response.py index 6b724aa5..17988519 100644 --- a/fattureincloud_python_sdk/models/get_vat_type_response.py +++ b/fattureincloud_python_sdk/models/get_vat_type_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetVatTypeResponse(BaseModel): """ GetVatTypeResponse - """ + """ # noqa: E501 data: Optional[VatType] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetVatTypeResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetVatTypeResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetVatTypeResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetVatTypeResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetVatTypeResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetVatTypeResponse.parse_obj( + _obj = cls.model_validate( { "data": VatType.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/get_webhooks_subscription_response.py b/fattureincloud_python_sdk/models/get_webhooks_subscription_response.py index ccd7659c..6dff830b 100644 --- a/fattureincloud_python_sdk/models/get_webhooks_subscription_response.py +++ b/fattureincloud_python_sdk/models/get_webhooks_subscription_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class GetWebhooksSubscriptionResponse(BaseModel): """ GetWebhooksSubscriptionResponse - """ + """ # noqa: E501 data: Optional[WebhooksSubscription] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> GetWebhooksSubscriptionResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of GetWebhooksSubscriptionResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> GetWebhooksSubscriptionResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of GetWebhooksSubscriptionResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return GetWebhooksSubscriptionResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = GetWebhooksSubscriptionResponse.parse_obj( + _obj = cls.model_validate( { "data": WebhooksSubscription.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/issued_document.py b/fattureincloud_python_sdk/models/issued_document.py index 13e319da..6168b028 100644 --- a/fattureincloud_python_sdk/models/issued_document.py +++ b/fattureincloud_python_sdk/models/issued_document.py @@ -19,17 +19,16 @@ import json from datetime import date -from typing import Any, Dict, List, Optional, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import ( BaseModel, - Field, StrictBool, StrictFloat, StrictInt, StrictStr, - conlist, - validator, + field_validator, ) +from pydantic import Field from fattureincloud_python_sdk.models.currency import Currency from fattureincloud_python_sdk.models.document_template import DocumentTemplate from fattureincloud_python_sdk.models.entity import Entity @@ -50,252 +49,273 @@ from fattureincloud_python_sdk.models.payment_method import PaymentMethod from fattureincloud_python_sdk.models.show_totals_mode import ShowTotalsMode +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocument(BaseModel): """ IssuedDocument - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Issued document id") + id: Optional[StrictInt] = Field(default=None, description="Issued document id") entity: Optional[Entity] = None type: Optional[IssuedDocumentType] = None number: Optional[StrictInt] = Field( - None, + default=None, description="Issued document number [If not specified, next number is used]", ) numeration: Optional[StrictStr] = Field( - None, + default=None, description="Issued document numeration [Not available if type=delivery_note]", ) var_date: Optional[date] = Field( - None, - alias="date", + default=None, description="Issued document date [defaults to today's date]", + alias="date", ) - year: Optional[StrictInt] = Field(None, description="Issued document year") + year: Optional[StrictInt] = Field(default=None, description="Issued document year") currency: Optional[Currency] = None language: Optional[Language] = None - subject: Optional[StrictStr] = Field(None, description="Issued document subject") + subject: Optional[StrictStr] = Field( + default=None, description="Issued document subject" + ) visible_subject: Optional[StrictStr] = Field( - None, description="Issued document visible subject" + default=None, description="Issued document visible subject" ) rc_center: Optional[StrictStr] = Field( - None, + default=None, description="Issued document revenue center [or cost center if type=supplier_order].", ) - notes: Optional[StrictStr] = Field(None, description="Issued document extra notes") + notes: Optional[StrictStr] = Field( + default=None, description="Issued document extra notes" + ) rivalsa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description='Issued document "Rivalsa INPS" percentual value' + default=None, description='Issued document "Rivalsa INPS" percentual value' ) cassa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description='Issued document "Cassa previdenziale" percentual value' + default=None, + description='Issued document "Cassa previdenziale" percentual value', ) amount_cassa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Issued document cassa amount." + default=None, description="[Read Only] Issued document cassa amount." ) cassa_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document cassa taxable percentage" + default=None, description="Issued document cassa taxable percentage" ) amount_cassa_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="[Can be set only if cassa_taxable is NULL] Issued document cassa taxable amount", ) cassa2: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description='Issued document "Cassa previdenziale 2" percentual value' + default=None, + description='Issued document "Cassa previdenziale 2" percentual value', ) amount_cassa2: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Issued document cassa2 amount" + default=None, description="[Read Only] Issued document cassa2 amount" ) cassa2_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document cassa2 taxable percentage" + default=None, description="Issued document cassa2 taxable percentage" ) amount_cassa2_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="[Can be set only if cassa2_taxable is NULL] Issued document cassa2 taxable amount", ) global_cassa_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document global cassa taxable percentage" + default=None, description="Issued document global cassa taxable percentage" ) amount_global_cassa_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="[Can be set only if global_cassa_taxable is NULL] Issued document global cassa taxable amount", ) withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="Issued document withholding tax (ritenuta d'acconto) percentual value", ) withholding_tax_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="Issued document withholding tax taxable (imponibile) percentual value", ) other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="Issued document other withholding tax (altra ritenuta) percentual value", ) stamp_duty: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document stamp duty value [0 if not present]" + default=None, description="Issued document stamp duty value [0 if not present]" ) payment_method: Optional[PaymentMethod] = None use_split_payment: Optional[StrictBool] = Field( - None, description="Issued document uses split payment" + default=None, description="Issued document uses split payment" ) use_gross_prices: Optional[StrictBool] = Field( - None, description="Issued document uses gross prices" + default=None, description="Issued document uses gross prices" ) e_invoice: Optional[StrictBool] = Field( - None, description="Issued document is an e-invoice." + default=None, description="Issued document is an e-invoice." ) ei_data: Optional[IssuedDocumentEiData] = None - ei_cassa_type: Optional[StrictStr] = Field(None, description="E-invoice cassa type") + ei_cassa_type: Optional[StrictStr] = Field( + default=None, description="E-invoice cassa type" + ) ei_cassa2_type: Optional[StrictStr] = Field( - None, description="E-invoice cassa2 type" + default=None, description="E-invoice cassa2 type" ) ei_withholding_tax_causal: Optional[StrictStr] = Field( - None, description="E-invoice withholding tax causal" + default=None, description="E-invoice withholding tax causal" ) ei_other_withholding_tax_type: Optional[StrictStr] = Field( - None, description="E-invoice other withholding tax type" + default=None, description="E-invoice other withholding tax type" ) ei_other_withholding_tax_causal: Optional[StrictStr] = Field( - None, description="E-invoice other withholding tax causal" + default=None, description="E-invoice other withholding tax causal" ) - items_list: Optional[conlist(IssuedDocumentItemsListItem)] = None - payments_list: Optional[conlist(IssuedDocumentPaymentsListItem)] = None + items_list: Optional[List[IssuedDocumentItemsListItem]] = None + payments_list: Optional[List[IssuedDocumentPaymentsListItem]] = None template: Optional[DocumentTemplate] = None delivery_note_template: Optional[DocumentTemplate] = None acc_inv_template: Optional[DocumentTemplate] = None h_margins: Optional[StrictInt] = Field( - None, description="Issued document PDF horizontal margins" + default=None, description="Issued document PDF horizontal margins" ) v_margins: Optional[StrictInt] = Field( - None, description="Issued document PDF vertical margins" + default=None, description="Issued document PDF vertical margins" ) show_payments: Optional[StrictBool] = Field( - None, description="Show the expiration dates of the payments on the document" + default=None, + description="Show the expiration dates of the payments on the document", ) show_payment_method: Optional[StrictBool] = Field( - None, description="Show the payment method details on the document" + default=None, description="Show the payment method details on the document" ) show_totals: Optional[ShowTotalsMode] = None show_paypal_button: Optional[StrictBool] = Field( - None, description="Show paypal button in the PDF" + default=None, description="Show paypal button in the PDF" ) show_notification_button: Optional[StrictBool] = Field( - None, description="Show notification button in the PDF" + default=None, description="Show notification button in the PDF" ) show_tspay_button: Optional[StrictBool] = Field( - None, description="Show ts pay button in the PDF" + default=None, description="Show ts pay button in the PDF" ) delivery_note: Optional[StrictBool] = Field( - None, description="Issued document has delivery note" + default=None, description="Issued document has delivery note" ) accompanying_invoice: Optional[StrictBool] = Field( - None, description="Issued document has an accompanying invoice" + default=None, description="Issued document has an accompanying invoice" ) dn_number: Optional[StrictInt] = Field( - None, description="Issued document attached delivery note number" + default=None, description="Issued document attached delivery note number" ) dn_date: Optional[date] = Field( - None, description="Issued document attached delivery note date" + default=None, description="Issued document attached delivery note date" ) dn_ai_packages_number: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note number of packages" + default=None, + description="Issued document attached delivery note number of packages", ) dn_ai_weight: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note package weight" + default=None, + description="Issued document attached delivery note package weight", ) dn_ai_causal: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note causal" + default=None, description="Issued document attached delivery note causal" ) dn_ai_destination: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note destination" + default=None, description="Issued document attached delivery note destination" ) dn_ai_transporter: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note transporter" + default=None, description="Issued document attached delivery note transporter" ) dn_ai_notes: Optional[StrictStr] = Field( - None, description="Issued document attached delivery note notes" + default=None, description="Issued document attached delivery note notes" ) is_marked: Optional[StrictBool] = Field( - None, description="Issued document is marked" + default=None, description="Issued document is marked" ) amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read only] Issued document total net amount" + default=None, description="[Read only] Issued document total net amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Issued document total vat amount" + default=None, description="[Read Only] Issued document total vat amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Issued document total gross amount" + default=None, description="[Read Only] Issued document total gross amount" ) amount_due_discount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document amount due discount" + default=None, description="Issued document amount due discount" ) amount_rivalsa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Issued document rivalsa amount" + default=None, description="[Read Only] Issued document rivalsa amount" ) amount_rivalsa_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document taxable rivalsa amount" + default=None, description="Issued document taxable rivalsa amount" ) amount_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="[Read Only] Issued document withholding tax amount (ritenuta d'acconto).", ) amount_withholding_tax_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document taxable withholding tax amount" + default=None, description="Issued document taxable withholding tax amount" ) amount_other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description="[Read Only] Issued document other withholding tax amount (altra ritenuta)", ) amount_other_withholding_tax_taxable: Optional[ Union[StrictFloat, StrictInt] - ] = Field(None, description="Issued document taxable other withholding tax amount") + ] = Field( + default=None, description="Issued document taxable other withholding tax amount" + ) amount_enasarco_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document taxable enasarco amount" + default=None, description="Issued document taxable enasarco amount" ) extra_data: Optional[IssuedDocumentExtraData] = None - seen_date: Optional[date] = Field(None, description="Issued document seen date") + seen_date: Optional[date] = Field( + default=None, description="Issued document seen date" + ) next_due_date: Optional[date] = Field( - None, description="Issued document date of the next not paid payment" + default=None, description="Issued document date of the next not paid payment" ) url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Issued document url of the document PDF file", ) dn_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Issued document url of the attached delivery note PDF file", ) ai_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Issued document url of the accompanying invoice PDF file", ) attachment_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Issued document url of the attached file", ) attachment_token: Optional[StrictStr] = Field( - None, + default=None, description="[Write Only] Issued document attachment token returned by POST /issued_documents/attachment", ) - ei_raw: Optional[Dict[str, Any]] = Field( - None, description="Issued document advanced raw attributes for e-invoices" + ei_raw: Optional[Union[str, Any]] = Field( + default=None, + description="Issued document advanced raw attributes for e-invoices", ) ei_status: Optional[StrictStr] = Field( - None, + default=None, description="[Read only] Status of the e-invoice. * **attempt** - We are trying to send the invoice, please wait up to 2 hours * **missing** - The invoice is missing * **not_sent** - The invoice has yet to be sent * **sent** - The invoice was sent * **pending** - The checks for the digital signature and sending are in progress * **processing** - The SDI is delivering the invoice to the customer * **error** - An error occurred while handling the invoice, please try to resend it or contact support * **discarded** - The invoice has been rejected by the SDI, so it must be corrected and re-sent * **not_delivered** - The SDI was unable to deliver the invoice * **accepted** - The customer accepted the invoice * **rejected** - The customer rejected the invoice, so it must be corrected * **no_response** - A response has not yet been received whithin the deadline, contact the customer to ascertain the status of the invoice * **manual_accepted** - The customer accepted the invoice * **manual_rejected** - The customer rejected the invoice ", ) locked: Optional[StrictBool] = Field( - None, description="Issued Document can't be edited" + default=None, description="Issued Document can't be edited" ) created_at: Optional[StrictStr] = Field( - None, description="Issued document creation date" + default=None, description="Issued document creation date" ) updated_at: Optional[StrictStr] = Field( - None, description="Issued document last update date" + default=None, description="Issued document last update date" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "entity", "type", @@ -384,7 +404,7 @@ class IssuedDocument(BaseModel): "updated_at", ] - @validator("ei_status") + @field_validator("ei_status") def ei_status_validate_enum(cls, value): """Validates the enum""" if value is None: @@ -411,28 +431,42 @@ def ei_status_validate_enum(cls, value): ) return value - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocument: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocument from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "amount_cassa", @@ -491,124 +525,68 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocument: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocument from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocument.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocument.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, + "id": obj.get("id"), "entity": Entity.from_dict(obj.get("entity")) if obj.get("entity") is not None else None, "type": obj.get("type"), - "number": obj.get("number") if obj.get("number") is not None else None, - "numeration": obj.get("numeration") - if obj.get("numeration") is not None - else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - "year": obj.get("year") if obj.get("year") is not None else None, + "number": obj.get("number"), + "numeration": obj.get("numeration"), + "date": obj.get("date"), + "year": obj.get("year"), "currency": Currency.from_dict(obj.get("currency")) if obj.get("currency") is not None else None, "language": Language.from_dict(obj.get("language")) if obj.get("language") is not None else None, - "subject": obj.get("subject") - if obj.get("subject") is not None - else None, - "visible_subject": obj.get("visible_subject") - if obj.get("visible_subject") is not None - else None, - "rc_center": obj.get("rc_center") - if obj.get("rc_center") is not None - else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "rivalsa": float(obj.get("rivalsa")) - if obj.get("rivalsa") is not None - else None, - "cassa": float(obj.get("cassa")) - if obj.get("cassa") is not None - else None, - "amount_cassa": float(obj.get("amount_cassa")) - if obj.get("amount_cassa") is not None - else None, - "cassa_taxable": float(obj.get("cassa_taxable")) - if obj.get("cassa_taxable") is not None - else None, - "amount_cassa_taxable": float(obj.get("amount_cassa_taxable")) - if obj.get("amount_cassa_taxable") is not None - else None, - "cassa2": float(obj.get("cassa2")) - if obj.get("cassa2") is not None - else None, - "amount_cassa2": float(obj.get("amount_cassa2")) - if obj.get("amount_cassa2") is not None - else None, - "cassa2_taxable": float(obj.get("cassa2_taxable")) - if obj.get("cassa2_taxable") is not None - else None, - "amount_cassa2_taxable": float(obj.get("amount_cassa2_taxable")) - if obj.get("amount_cassa2_taxable") is not None - else None, - "global_cassa_taxable": float(obj.get("global_cassa_taxable")) - if obj.get("global_cassa_taxable") is not None - else None, - "amount_global_cassa_taxable": float( - obj.get("amount_global_cassa_taxable") - ) - if obj.get("amount_global_cassa_taxable") is not None - else None, - "withholding_tax": float(obj.get("withholding_tax")) - if obj.get("withholding_tax") is not None - else None, - "withholding_tax_taxable": float(obj.get("withholding_tax_taxable")) - if obj.get("withholding_tax_taxable") is not None - else None, - "other_withholding_tax": float(obj.get("other_withholding_tax")) - if obj.get("other_withholding_tax") is not None - else None, - "stamp_duty": float(obj.get("stamp_duty")) - if obj.get("stamp_duty") is not None - else None, + "subject": obj.get("subject"), + "visible_subject": obj.get("visible_subject"), + "rc_center": obj.get("rc_center"), + "notes": obj.get("notes"), + "rivalsa": obj.get("rivalsa"), + "cassa": obj.get("cassa"), + "amount_cassa": obj.get("amount_cassa"), + "cassa_taxable": obj.get("cassa_taxable"), + "amount_cassa_taxable": obj.get("amount_cassa_taxable"), + "cassa2": obj.get("cassa2"), + "amount_cassa2": obj.get("amount_cassa2"), + "cassa2_taxable": obj.get("cassa2_taxable"), + "amount_cassa2_taxable": obj.get("amount_cassa2_taxable"), + "global_cassa_taxable": obj.get("global_cassa_taxable"), + "amount_global_cassa_taxable": obj.get("amount_global_cassa_taxable"), + "withholding_tax": obj.get("withholding_tax"), + "withholding_tax_taxable": obj.get("withholding_tax_taxable"), + "other_withholding_tax": obj.get("other_withholding_tax"), + "stamp_duty": obj.get("stamp_duty"), "payment_method": PaymentMethod.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, - "use_split_payment": obj.get("use_split_payment") - if obj.get("use_split_payment") is not None - else None, - "use_gross_prices": obj.get("use_gross_prices") - if obj.get("use_gross_prices") is not None - else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, + "use_split_payment": obj.get("use_split_payment"), + "use_gross_prices": obj.get("use_gross_prices"), + "e_invoice": obj.get("e_invoice"), "ei_data": IssuedDocumentEiData.from_dict(obj.get("ei_data")) if obj.get("ei_data") is not None else None, - "ei_cassa_type": obj.get("ei_cassa_type") - if obj.get("ei_cassa_type") is not None - else None, - "ei_cassa2_type": obj.get("ei_cassa2_type") - if obj.get("ei_cassa2_type") is not None - else None, - "ei_withholding_tax_causal": obj.get("ei_withholding_tax_causal") - if obj.get("ei_withholding_tax_causal") is not None - else None, + "ei_cassa_type": obj.get("ei_cassa_type"), + "ei_cassa2_type": obj.get("ei_cassa2_type"), + "ei_withholding_tax_causal": obj.get("ei_withholding_tax_causal"), "ei_other_withholding_tax_type": obj.get( "ei_other_withholding_tax_type" - ) - if obj.get("ei_other_withholding_tax_type") is not None - else None, + ), "ei_other_withholding_tax_causal": obj.get( "ei_other_withholding_tax_causal" - ) - if obj.get("ei_other_withholding_tax_causal") is not None - else None, + ), "items_list": [ IssuedDocumentItemsListItem.from_dict(_item) for _item in obj.get("items_list") @@ -634,129 +612,55 @@ def from_dict(cls, obj: dict) -> IssuedDocument: ) if obj.get("acc_inv_template") is not None else None, - "h_margins": obj.get("h_margins") - if obj.get("h_margins") is not None - else None, - "v_margins": obj.get("v_margins") - if obj.get("v_margins") is not None - else None, - "show_payments": obj.get("show_payments") - if obj.get("show_payments") is not None - else None, - "show_payment_method": obj.get("show_payment_method") - if obj.get("show_payment_method") is not None - else None, + "h_margins": obj.get("h_margins"), + "v_margins": obj.get("v_margins"), + "show_payments": obj.get("show_payments"), + "show_payment_method": obj.get("show_payment_method"), "show_totals": obj.get("show_totals"), - "show_paypal_button": obj.get("show_paypal_button") - if obj.get("show_paypal_button") is not None - else None, - "show_notification_button": obj.get("show_notification_button") - if obj.get("show_notification_button") is not None - else None, - "show_tspay_button": obj.get("show_tspay_button") - if obj.get("show_tspay_button") is not None - else None, - "delivery_note": obj.get("delivery_note") - if obj.get("delivery_note") is not None - else None, - "accompanying_invoice": obj.get("accompanying_invoice") - if obj.get("accompanying_invoice") is not None - else None, - "dn_number": obj.get("dn_number") - if obj.get("dn_number") is not None - else None, - "dn_date": obj.get("dn_date") - if obj.get("dn_date") is not None - else None, - "dn_ai_packages_number": obj.get("dn_ai_packages_number") - if obj.get("dn_ai_packages_number") is not None - else None, - "dn_ai_weight": obj.get("dn_ai_weight") - if obj.get("dn_ai_weight") is not None - else None, - "dn_ai_causal": obj.get("dn_ai_causal") - if obj.get("dn_ai_causal") is not None - else None, - "dn_ai_destination": obj.get("dn_ai_destination") - if obj.get("dn_ai_destination") is not None - else None, - "dn_ai_transporter": obj.get("dn_ai_transporter") - if obj.get("dn_ai_transporter") is not None - else None, - "dn_ai_notes": obj.get("dn_ai_notes") - if obj.get("dn_ai_notes") is not None - else None, - "is_marked": obj.get("is_marked") - if obj.get("is_marked") is not None - else None, - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "amount_due_discount": float(obj.get("amount_due_discount")) - if obj.get("amount_due_discount") is not None - else None, - "amount_rivalsa": float(obj.get("amount_rivalsa")) - if obj.get("amount_rivalsa") is not None - else None, - "amount_rivalsa_taxable": float(obj.get("amount_rivalsa_taxable")) - if obj.get("amount_rivalsa_taxable") is not None - else None, - "amount_withholding_tax": float(obj.get("amount_withholding_tax")) - if obj.get("amount_withholding_tax") is not None - else None, - "amount_withholding_tax_taxable": float( - obj.get("amount_withholding_tax_taxable") - ) - if obj.get("amount_withholding_tax_taxable") is not None - else None, - "amount_other_withholding_tax": float( - obj.get("amount_other_withholding_tax") - ) - if obj.get("amount_other_withholding_tax") is not None - else None, - "amount_other_withholding_tax_taxable": float( - obj.get("amount_other_withholding_tax_taxable") - ) - if obj.get("amount_other_withholding_tax_taxable") is not None - else None, - "amount_enasarco_taxable": float(obj.get("amount_enasarco_taxable")) - if obj.get("amount_enasarco_taxable") is not None - else None, + "show_paypal_button": obj.get("show_paypal_button"), + "show_notification_button": obj.get("show_notification_button"), + "show_tspay_button": obj.get("show_tspay_button"), + "delivery_note": obj.get("delivery_note"), + "accompanying_invoice": obj.get("accompanying_invoice"), + "dn_number": obj.get("dn_number"), + "dn_date": obj.get("dn_date"), + "dn_ai_packages_number": obj.get("dn_ai_packages_number"), + "dn_ai_weight": obj.get("dn_ai_weight"), + "dn_ai_causal": obj.get("dn_ai_causal"), + "dn_ai_destination": obj.get("dn_ai_destination"), + "dn_ai_transporter": obj.get("dn_ai_transporter"), + "dn_ai_notes": obj.get("dn_ai_notes"), + "is_marked": obj.get("is_marked"), + "amount_net": obj.get("amount_net"), + "amount_vat": obj.get("amount_vat"), + "amount_gross": obj.get("amount_gross"), + "amount_due_discount": obj.get("amount_due_discount"), + "amount_rivalsa": obj.get("amount_rivalsa"), + "amount_rivalsa_taxable": obj.get("amount_rivalsa_taxable"), + "amount_withholding_tax": obj.get("amount_withholding_tax"), + "amount_withholding_tax_taxable": obj.get( + "amount_withholding_tax_taxable" + ), + "amount_other_withholding_tax": obj.get("amount_other_withholding_tax"), + "amount_other_withholding_tax_taxable": obj.get( + "amount_other_withholding_tax_taxable" + ), + "amount_enasarco_taxable": obj.get("amount_enasarco_taxable"), "extra_data": IssuedDocumentExtraData.from_dict(obj.get("extra_data")) if obj.get("extra_data") is not None else None, - "seen_date": obj.get("seen_date") - if obj.get("seen_date") is not None - else None, - "next_due_date": obj.get("next_due_date") - if obj.get("next_due_date") is not None - else None, - "url": obj.get("url") if obj.get("url") is not None else None, - "dn_url": obj.get("dn_url") if obj.get("dn_url") is not None else None, - "ai_url": obj.get("ai_url") if obj.get("ai_url") is not None else None, - "attachment_url": obj.get("attachment_url") - if obj.get("attachment_url") is not None - else None, - "attachment_token": obj.get("attachment_token") - if obj.get("attachment_token") is not None - else None, - "ei_raw": obj.get("ei_raw") if obj.get("ei_raw") is not None else None, - "ei_status": obj.get("ei_status") - if obj.get("ei_status") is not None - else None, - "locked": obj.get("locked") if obj.get("locked") is not None else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + "seen_date": obj.get("seen_date"), + "next_due_date": obj.get("next_due_date"), + "url": obj.get("url"), + "dn_url": obj.get("dn_url"), + "ai_url": obj.get("ai_url"), + "attachment_url": obj.get("attachment_url"), + "attachment_token": obj.get("attachment_token"), + "ei_raw": obj.get("ei_raw"), + "ei_status": obj.get("ei_status"), + "locked": obj.get("locked"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_ei_data.py b/fattureincloud_python_sdk/models/issued_document_ei_data.py index 40afb6d1..2527f0e4 100644 --- a/fattureincloud_python_sdk/models/issued_document_ei_data.py +++ b/fattureincloud_python_sdk/models/issued_document_ei_data.py @@ -19,41 +19,53 @@ import json from datetime import date -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.original_document_type import OriginalDocumentType from fattureincloud_python_sdk.models.vat_kind import VatKind +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentEiData(BaseModel): """ - Issued document e-invoice data [Only if e_invoice=true] # noqa: E501 - """ + Issued document e-invoice data [Only if e_invoice=true] + """ # noqa: E501 vat_kind: Optional[VatKind] = None original_document_type: Optional[OriginalDocumentType] = None od_number: Optional[StrictStr] = Field( - None, description="E-invoice original document number" + default=None, description="E-invoice original document number" ) od_date: Optional[date] = Field( - None, description="E-invoice original document date" + default=None, description="E-invoice original document date" ) - cig: Optional[StrictStr] = Field(None, description="E-invoice CIG") - cup: Optional[StrictStr] = Field(None, description="E-invoice CUP") + cig: Optional[StrictStr] = Field(default=None, description="E-invoice CIG") + cup: Optional[StrictStr] = Field(default=None, description="E-invoice CUP") payment_method: Optional[StrictStr] = Field( - None, + default=None, description="E-invoice payment method [required for e-invoices] (see [here](https://www.fatturapa.gov.it/export/documenti/fatturapa/v1.2.2/Rappresentazione_Tabellare_FattOrdinaria_V1.2.2.pdf) for the accepted values of ModalitaPagamento)", ) - bank_name: Optional[StrictStr] = Field(None, description="E-invoice bank name") - bank_iban: Optional[StrictStr] = Field(None, description="E-invoice bank IBAN") + bank_name: Optional[StrictStr] = Field( + default=None, description="E-invoice bank name" + ) + bank_iban: Optional[StrictStr] = Field( + default=None, description="E-invoice bank IBAN" + ) bank_beneficiary: Optional[StrictStr] = Field( - None, description="E-invoice bank beneficiary" + default=None, description="E-invoice bank beneficiary" ) invoice_number: Optional[StrictStr] = Field( - None, description="E-invoice invoice number" + default=None, description="E-invoice invoice number" + ) + invoice_date: Optional[date] = Field( + default=None, description="E-invoice invoice date" ) - invoice_date: Optional[date] = Field(None, description="E-invoice invoice date") - __properties = [ + __properties: ClassVar[List[str]] = [ "vat_kind", "original_document_type", "od_number", @@ -68,69 +80,62 @@ class IssuedDocumentEiData(BaseModel): "invoice_date", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentEiData: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentEiData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentEiData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentEiData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentEiData.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentEiData.parse_obj( + _obj = cls.model_validate( { "vat_kind": obj.get("vat_kind"), "original_document_type": obj.get("original_document_type"), - "od_number": obj.get("od_number") - if obj.get("od_number") is not None - else None, - "od_date": obj.get("od_date") - if obj.get("od_date") is not None - else None, - "cig": obj.get("cig") if obj.get("cig") is not None else None, - "cup": obj.get("cup") if obj.get("cup") is not None else None, - "payment_method": obj.get("payment_method") - if obj.get("payment_method") is not None - else None, - "bank_name": obj.get("bank_name") - if obj.get("bank_name") is not None - else None, - "bank_iban": obj.get("bank_iban") - if obj.get("bank_iban") is not None - else None, - "bank_beneficiary": obj.get("bank_beneficiary") - if obj.get("bank_beneficiary") is not None - else None, - "invoice_number": obj.get("invoice_number") - if obj.get("invoice_number") is not None - else None, - "invoice_date": obj.get("invoice_date") - if obj.get("invoice_date") is not None - else None, + "od_number": obj.get("od_number"), + "od_date": obj.get("od_date"), + "cig": obj.get("cig"), + "cup": obj.get("cup"), + "payment_method": obj.get("payment_method"), + "bank_name": obj.get("bank_name"), + "bank_iban": obj.get("bank_iban"), + "bank_beneficiary": obj.get("bank_beneficiary"), + "invoice_number": obj.get("invoice_number"), + "invoice_date": obj.get("invoice_date"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_extra_data.py b/fattureincloud_python_sdk/models/issued_document_extra_data.py index a9425845..3bf54922 100644 --- a/fattureincloud_python_sdk/models/issued_document_extra_data.py +++ b/fattureincloud_python_sdk/models/issued_document_extra_data.py @@ -19,50 +19,56 @@ import json from datetime import date -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class IssuedDocumentExtraData(BaseModel): """ - Issued document extra data [TS fields follow the technical specifications provided by \"Sistema Tessera Sanitaria\"] # noqa: E501 - """ + Issued document extra data [TS fields follow the technical specifications provided by \"Sistema Tessera Sanitaria\"] + """ # noqa: E501 show_sofort_button: Optional[StrictBool] = None multifatture_sent: Optional[StrictInt] = None ts_communication: Optional[StrictBool] = Field( - None, description='Send issued document to "Sistema Tessera Sanitaria"' + default=None, description='Send issued document to "Sistema Tessera Sanitaria"' ) ts_flag_tipo_spesa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, + default=None, description='Issued document ts "tipo spesa" [TK, FC, FV, SV,SP, AD, AS, ECG, SR]', ) ts_pagamento_tracciato: Optional[StrictBool] = Field( - None, description="Issued document ts traced payment" + default=None, description="Issued document ts traced payment" ) ts_tipo_spesa: Optional[StrictStr] = Field( - None, + default=None, description="Can be [ 'TK', 'FC', 'FV', 'SV', 'SP', 'AD', 'AS', 'SR', 'CT', 'PI', 'IC', 'AA' ]. Refer to the technical specifications to learn more.", ) ts_opposizione: Optional[StrictBool] = Field( - None, description='Issued document ts "opposizione"' + default=None, description='Issued document ts "opposizione"' ) ts_status: Optional[StrictInt] = Field( - None, description="Issued document ts status" + default=None, description="Issued document ts status" ) ts_file_id: Optional[StrictStr] = Field( - None, description="Issued document ts file id" + default=None, description="Issued document ts file id" ) ts_sent_date: Optional[date] = Field( - None, description="Issued document ts sent date" + default=None, description="Issued document ts sent date" ) ts_full_amount: Optional[StrictBool] = Field( - None, description="Issued document ts total amount" + default=None, description="Issued document ts total amount" ) imported_by: Optional[StrictStr] = Field( - None, description="Issued document imported by software" + default=None, description="Issued document imported by software" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "show_sofort_button", "multifatture_sent", "ts_communication", @@ -77,77 +83,62 @@ class IssuedDocumentExtraData(BaseModel): "imported_by", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentExtraData: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentExtraData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentExtraData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentExtraData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentExtraData.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentExtraData.parse_obj( + _obj = cls.model_validate( { - "show_sofort_button": obj.get("show_sofort_button") - if obj.get("show_sofort_button") is not None - else None, - "multifatture_sent": obj.get("multifatture_sent") - if obj.get("multifatture_sent") is not None - else None, - "ts_communication": obj.get("ts_communication") - if obj.get("ts_communication") is not None - else None, - "ts_flag_tipo_spesa": float(obj.get("ts_flag_tipo_spesa")) - if obj.get("ts_flag_tipo_spesa") is not None - else None, - "ts_pagamento_tracciato": obj.get("ts_pagamento_tracciato") - if obj.get("ts_pagamento_tracciato") is not None - else None, - "ts_tipo_spesa": obj.get("ts_tipo_spesa") - if obj.get("ts_tipo_spesa") is not None - else None, - "ts_opposizione": obj.get("ts_opposizione") - if obj.get("ts_opposizione") is not None - else None, - "ts_status": obj.get("ts_status") - if obj.get("ts_status") is not None - else None, - "ts_file_id": obj.get("ts_file_id") - if obj.get("ts_file_id") is not None - else None, - "ts_sent_date": obj.get("ts_sent_date") - if obj.get("ts_sent_date") is not None - else None, - "ts_full_amount": obj.get("ts_full_amount") - if obj.get("ts_full_amount") is not None - else None, - "imported_by": obj.get("imported_by") - if obj.get("imported_by") is not None - else None, + "show_sofort_button": obj.get("show_sofort_button"), + "multifatture_sent": obj.get("multifatture_sent"), + "ts_communication": obj.get("ts_communication"), + "ts_flag_tipo_spesa": obj.get("ts_flag_tipo_spesa"), + "ts_pagamento_tracciato": obj.get("ts_pagamento_tracciato"), + "ts_tipo_spesa": obj.get("ts_tipo_spesa"), + "ts_opposizione": obj.get("ts_opposizione"), + "ts_status": obj.get("ts_status"), + "ts_file_id": obj.get("ts_file_id"), + "ts_sent_date": obj.get("ts_sent_date"), + "ts_full_amount": obj.get("ts_full_amount"), + "imported_by": obj.get("imported_by"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_items_list_item.py b/fattureincloud_python_sdk/models/issued_document_items_list_item.py index 640acf15..7e8623f3 100644 --- a/fattureincloud_python_sdk/models/issued_document_items_list_item.py +++ b/fattureincloud_python_sdk/models/issued_document_items_list_item.py @@ -19,68 +19,75 @@ import json -from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentItemsListItem(BaseModel): """ IssuedDocumentItemsListItem - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Issued document item id") + id: Optional[StrictInt] = Field(default=None, description="Issued document item id") product_id: Optional[StrictInt] = Field( - None, description="Issued document item product id" + default=None, description="Issued document item product id" ) code: Optional[StrictStr] = Field( - None, description="Issued document item product code" + default=None, description="Issued document item product code" ) name: Optional[StrictStr] = Field( - None, description="Issued document item product name" + default=None, description="Issued document item product name" ) category: Optional[StrictStr] = Field( - None, description="Issued document item product category" + default=None, description="Issued document item product category" ) description: Optional[StrictStr] = Field( - None, description="Issued document product description" + default=None, description="Issued document product description" ) qty: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document item quantity" + default=None, description="Issued document item quantity" ) measure: Optional[StrictStr] = Field( - None, description="Issued document item measure" + default=None, description="Issued document item measure" ) net_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document item net price" + default=None, description="Issued document item net price" ) gross_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document item gross price" + default=None, description="Issued document item gross price" ) vat: Optional[VatType] = None not_taxable: Optional[StrictBool] = Field( - None, description="Issued document item is not taxable" + default=None, description="Issued document item is not taxable" ) apply_withholding_taxes: Optional[StrictBool] = Field( - None, + default=None, description="Issued document item apply withholding taxes, rivalsa and cassa", ) discount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document item discount percentual value" + default=None, description="Issued document item discount percentual value" ) discount_highlight: Optional[StrictBool] = Field( - None, description="Issued document item highlight discount" + default=None, description="Issued document item highlight discount" ) in_dn: Optional[StrictBool] = Field( - None, description="Issued document item add in delivery note" + default=None, description="Issued document item add in delivery note" ) stock: Optional[StrictBool] = Field( - None, description="Issued document item move stock" + default=None, description="Issued document item move stock" ) - ei_raw: Optional[Dict[str, Any]] = Field( - None, description="Issued document advanced raw attributes for e-invoices" + ei_raw: Optional[Union[str, Any]] = Field( + default=None, + description="Issued document advanced raw attributes for e-invoices", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "product_id", "code", @@ -101,84 +108,73 @@ class IssuedDocumentItemsListItem(BaseModel): "ei_raw", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentItemsListItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentItemsListItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of vat if self.vat: _dict["vat"] = self.vat.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentItemsListItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentItemsListItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentItemsListItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentItemsListItem.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "product_id": obj.get("product_id") - if obj.get("product_id") is not None - else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - "qty": float(obj.get("qty")) if obj.get("qty") is not None else None, - "measure": obj.get("measure") - if obj.get("measure") is not None - else None, - "net_price": float(obj.get("net_price")) - if obj.get("net_price") is not None - else None, - "gross_price": float(obj.get("gross_price")) - if obj.get("gross_price") is not None - else None, + "id": obj.get("id"), + "product_id": obj.get("product_id"), + "code": obj.get("code"), + "name": obj.get("name"), + "category": obj.get("category"), + "description": obj.get("description"), + "qty": obj.get("qty"), + "measure": obj.get("measure"), + "net_price": obj.get("net_price"), + "gross_price": obj.get("gross_price"), "vat": VatType.from_dict(obj.get("vat")) if obj.get("vat") is not None else None, - "not_taxable": obj.get("not_taxable") - if obj.get("not_taxable") is not None - else None, - "apply_withholding_taxes": obj.get("apply_withholding_taxes") - if obj.get("apply_withholding_taxes") is not None - else None, - "discount": float(obj.get("discount")) - if obj.get("discount") is not None - else None, - "discount_highlight": obj.get("discount_highlight") - if obj.get("discount_highlight") is not None - else None, - "in_dn": obj.get("in_dn") if obj.get("in_dn") is not None else None, - "stock": obj.get("stock") if obj.get("stock") is not None else None, - "ei_raw": obj.get("ei_raw") if obj.get("ei_raw") is not None else None, + "not_taxable": obj.get("not_taxable"), + "apply_withholding_taxes": obj.get("apply_withholding_taxes"), + "discount": obj.get("discount"), + "discount_highlight": obj.get("discount_highlight"), + "in_dn": obj.get("in_dn"), + "stock": obj.get("stock"), + "ei_raw": obj.get("ei_raw"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_options.py b/fattureincloud_python_sdk/models/issued_document_options.py index eabea942..1c1e2ce7 100644 --- a/fattureincloud_python_sdk/models/issued_document_options.py +++ b/fattureincloud_python_sdk/models/issued_document_options.py @@ -19,31 +19,38 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class IssuedDocumentOptions(BaseModel): """ IssuedDocumentOptions - """ + """ # noqa: E501 fix_payments: Optional[StrictBool] = Field( - None, description="Fixes your last payment amount to match your document total" + default=None, + description="Fixes your last payment amount to match your document total", ) - create_from: Optional[conlist(StrictStr)] = Field( - None, description="Original documents ids [only for join/transform]" + create_from: Optional[List[StrictStr]] = Field( + default=None, description="Original documents ids [only for join/transform]" ) transform: Optional[StrictBool] = Field( - None, description="Tranform a document [only for transform]" + default=None, description="Tranform a document [only for transform]" ) keep_copy: Optional[StrictBool] = Field( - None, description="Keep original document [only for transform]" + default=None, description="Keep original document [only for transform]" ) join_type: Optional[StrictStr] = Field( - None, description="Join type [only for join]" + default=None, description="Join type [only for join]" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "fix_payments", "create_from", "transform", @@ -51,54 +58,55 @@ class IssuedDocumentOptions(BaseModel): "join_type", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentOptions: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentOptions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentOptions: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentOptions from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentOptions.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentOptions.parse_obj( + _obj = cls.model_validate( { - "fix_payments": obj.get("fix_payments") - if obj.get("fix_payments") is not None - else None, + "fix_payments": obj.get("fix_payments"), "create_from": obj.get("create_from"), - "transform": obj.get("transform") - if obj.get("transform") is not None - else None, - "keep_copy": obj.get("keep_copy") - if obj.get("keep_copy") is not None - else None, - "join_type": obj.get("join_type") - if obj.get("join_type") is not None - else None, + "transform": obj.get("transform"), + "keep_copy": obj.get("keep_copy"), + "join_type": obj.get("join_type"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_payments_list_item.py b/fattureincloud_python_sdk/models/issued_document_payments_list_item.py index c68bf21a..ff9c5f71 100644 --- a/fattureincloud_python_sdk/models/issued_document_payments_list_item.py +++ b/fattureincloud_python_sdk/models/issued_document_payments_list_item.py @@ -19,38 +19,47 @@ import json from datetime import date -from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field from fattureincloud_python_sdk.models.issued_document_payments_list_item_payment_terms import ( IssuedDocumentPaymentsListItemPaymentTerms, ) from fattureincloud_python_sdk.models.issued_document_status import IssuedDocumentStatus from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPaymentsListItem(BaseModel): """ IssuedDocumentPaymentsListItem - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Issued document payment item id") + id: Optional[StrictInt] = Field( + default=None, description="Issued document payment item id" + ) due_date: Optional[date] = Field( - None, description="Issued document payment due date" + default=None, description="Issued document payment due date" ) amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document payment amount" + default=None, description="Issued document payment amount" ) status: Optional[IssuedDocumentStatus] = None payment_account: Optional[PaymentAccount] = None paid_date: Optional[date] = Field( - None, description="Issued document payment date [Only if status is paid]" + default=None, + description="Issued document payment date [Only if status is paid]", ) - ei_raw: Optional[Dict[str, Any]] = Field( - None, + ei_raw: Optional[Union[str, Any]] = Field( + default=None, description="Issued document payment advanced raw attributes for e-invoices", ) payment_terms: Optional[IssuedDocumentPaymentsListItemPaymentTerms] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "due_date", "amount", @@ -61,28 +70,37 @@ class IssuedDocumentPaymentsListItem(BaseModel): "payment_terms", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentPaymentsListItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPaymentsListItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of payment_account if self.payment_account: _dict["payment_account"] = self.payment_account.to_dict() @@ -92,31 +110,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPaymentsListItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPaymentsListItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPaymentsListItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPaymentsListItem.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "due_date": obj.get("due_date") - if obj.get("due_date") is not None - else None, - "amount": float(obj.get("amount")) - if obj.get("amount") is not None - else None, + "id": obj.get("id"), + "due_date": obj.get("due_date"), + "amount": obj.get("amount"), "status": obj.get("status"), "payment_account": PaymentAccount.from_dict(obj.get("payment_account")) if obj.get("payment_account") is not None else None, - "paid_date": obj.get("paid_date") - if obj.get("paid_date") is not None - else None, - "ei_raw": obj.get("ei_raw") if obj.get("ei_raw") is not None else None, + "paid_date": obj.get("paid_date"), + "ei_raw": obj.get("ei_raw"), "payment_terms": IssuedDocumentPaymentsListItemPaymentTerms.from_dict( obj.get("payment_terms") ) diff --git a/fattureincloud_python_sdk/models/issued_document_payments_list_item_payment_terms.py b/fattureincloud_python_sdk/models/issued_document_payments_list_item_payment_terms.py index c5eb698e..1d9c451e 100644 --- a/fattureincloud_python_sdk/models/issued_document_payments_list_item_payment_terms.py +++ b/fattureincloud_python_sdk/models/issued_document_payments_list_item_payment_terms.py @@ -19,60 +19,70 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt +from pydantic import Field from fattureincloud_python_sdk.models.payment_terms_type import PaymentTermsType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPaymentsListItemPaymentTerms(BaseModel): """ IssuedDocumentPaymentsListItemPaymentTerms - """ + """ # noqa: E501 days: Optional[StrictInt] = Field( - None, + default=None, description="Issued document payment number of days by which the payment must be made", ) type: Optional[PaymentTermsType] = None - __properties = ["days", "type"] + __properties: ClassVar[List[str]] = ["days", "type"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentPaymentsListItemPaymentTerms: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPaymentsListItemPaymentTerms from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPaymentsListItemPaymentTerms: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPaymentsListItemPaymentTerms from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPaymentsListItemPaymentTerms.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPaymentsListItemPaymentTerms.parse_obj( - { - "days": obj.get("days") if obj.get("days") is not None else None, - "type": obj.get("type"), - } - ) + _obj = cls.model_validate({"days": obj.get("days"), "type": obj.get("type")}) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_pre_create_info.py b/fattureincloud_python_sdk/models/issued_document_pre_create_info.py index 1950e57a..3ccd6f24 100644 --- a/fattureincloud_python_sdk/models/issued_document_pre_create_info.py +++ b/fattureincloud_python_sdk/models/issued_document_pre_create_info.py @@ -19,8 +19,9 @@ import json -from typing import Dict, List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.currency import Currency from fattureincloud_python_sdk.models.document_template import DocumentTemplate from fattureincloud_python_sdk.models.issued_document_pre_create_info_default_values import ( @@ -37,11 +38,16 @@ from fattureincloud_python_sdk.models.payment_method import PaymentMethod from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPreCreateInfo(BaseModel): """ IssuedDocumentPreCreateInfo - """ + """ # noqa: E501 numerations: Optional[Dict[str, Dict[str, StrictInt]]] = None dn_numerations: Optional[Dict[str, Dict[str, StrictInt]]] = None @@ -50,34 +56,34 @@ class IssuedDocumentPreCreateInfo(BaseModel): IssuedDocumentPreCreateInfoExtraDataDefaultValues ] = None items_default_values: Optional[IssuedDocumentPreCreateInfoItemsDefaultValues] = None - countries_list: Optional[conlist(StrictStr)] = Field( - None, description="Countries list" + countries_list: Optional[List[StrictStr]] = Field( + default=None, description="Countries list" ) - currencies_list: Optional[conlist(Currency)] = Field( - None, description="Currencies list" + currencies_list: Optional[List[Currency]] = Field( + default=None, description="Currencies list" ) - templates_list: Optional[conlist(DocumentTemplate)] = Field( - None, description="Document templates list" + templates_list: Optional[List[DocumentTemplate]] = Field( + default=None, description="Document templates list" ) - dn_templates_list: Optional[conlist(DocumentTemplate)] = Field( - None, description="Delivery note templates list" + dn_templates_list: Optional[List[DocumentTemplate]] = Field( + default=None, description="Delivery note templates list" ) - ai_templates_list: Optional[conlist(DocumentTemplate)] = Field( - None, description="Accompanying invoice templates list" + ai_templates_list: Optional[List[DocumentTemplate]] = Field( + default=None, description="Accompanying invoice templates list" ) - payment_methods_list: Optional[conlist(PaymentMethod)] = Field( - None, description="Payment methods list" + payment_methods_list: Optional[List[PaymentMethod]] = Field( + default=None, description="Payment methods list" ) - payment_accounts_list: Optional[conlist(PaymentAccount)] = Field( - None, description="Payment accounts list" + payment_accounts_list: Optional[List[PaymentAccount]] = Field( + default=None, description="Payment accounts list" ) - vat_types_list: Optional[conlist(VatType)] = Field( - None, description="Vat types list" + vat_types_list: Optional[List[VatType]] = Field( + default=None, description="Vat types list" ) - languages_list: Optional[conlist(Language)] = Field( - None, description="Languages list" + languages_list: Optional[List[Language]] = Field( + default=None, description="Languages list" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "numerations", "dn_numerations", "default_values", @@ -94,28 +100,37 @@ class IssuedDocumentPreCreateInfo(BaseModel): "languages_list", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentPreCreateInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPreCreateInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_values if self.default_values: _dict["default_values"] = self.default_values.to_dict() @@ -186,15 +201,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPreCreateInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPreCreateInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPreCreateInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPreCreateInfo.parse_obj( + _obj = cls.model_validate( { "numerations": obj.get("numerations"), "dn_numerations": obj.get("dn_numerations"), diff --git a/fattureincloud_python_sdk/models/issued_document_pre_create_info_default_values.py b/fattureincloud_python_sdk/models/issued_document_pre_create_info_default_values.py index bcd8b4f6..4c229c88 100644 --- a/fattureincloud_python_sdk/models/issued_document_pre_create_info_default_values.py +++ b/fattureincloud_python_sdk/models/issued_document_pre_create_info_default_values.py @@ -19,41 +19,47 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.document_template import DocumentTemplate from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPreCreateInfoDefaultValues(BaseModel): """ - Issued document default values # noqa: E501 - """ + Issued document default values + """ # noqa: E501 default_template: Optional[DocumentTemplate] = None dn_template: Optional[DocumentTemplate] = None ai_template: Optional[DocumentTemplate] = None - notes: Optional[StrictStr] = Field(None, description="Default notes.") + notes: Optional[StrictStr] = Field(default=None, description="Default notes.") rivalsa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Default rivalsa percentage." + default=None, description="Default rivalsa percentage." ) cassa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Default cassa percentage." + default=None, description="Default cassa percentage." ) withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Default withholding tax percentage." + default=None, description="Default withholding tax percentage." ) withholding_tax_taxable: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Default withholding tax taxable percentage." + default=None, description="Default withholding tax taxable percentage." ) other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Default other withholding tax percentage." + default=None, description="Default other withholding tax percentage." ) use_gross_prices: Optional[StrictBool] = Field( - None, description="Use gross price by default." + default=None, description="Use gross price by default." ) payment_method: Optional[PaymentMethod] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "default_template", "dn_template", "ai_template", @@ -67,28 +73,37 @@ class IssuedDocumentPreCreateInfoDefaultValues(BaseModel): "payment_method", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentPreCreateInfoDefaultValues: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPreCreateInfoDefaultValues from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_template if self.default_template: _dict["default_template"] = self.default_template.to_dict() @@ -104,15 +119,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPreCreateInfoDefaultValues: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPreCreateInfoDefaultValues from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPreCreateInfoDefaultValues.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPreCreateInfoDefaultValues.parse_obj( + _obj = cls.model_validate( { "default_template": DocumentTemplate.from_dict( obj.get("default_template") @@ -125,25 +140,13 @@ def from_dict(cls, obj: dict) -> IssuedDocumentPreCreateInfoDefaultValues: "ai_template": DocumentTemplate.from_dict(obj.get("ai_template")) if obj.get("ai_template") is not None else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "rivalsa": float(obj.get("rivalsa")) - if obj.get("rivalsa") is not None - else None, - "cassa": float(obj.get("cassa")) - if obj.get("cassa") is not None - else None, - "withholding_tax": float(obj.get("withholding_tax")) - if obj.get("withholding_tax") is not None - else None, - "withholding_tax_taxable": float(obj.get("withholding_tax_taxable")) - if obj.get("withholding_tax_taxable") is not None - else None, - "other_withholding_tax": float(obj.get("other_withholding_tax")) - if obj.get("other_withholding_tax") is not None - else None, - "use_gross_prices": obj.get("use_gross_prices") - if obj.get("use_gross_prices") is not None - else None, + "notes": obj.get("notes"), + "rivalsa": obj.get("rivalsa"), + "cassa": obj.get("cassa"), + "withholding_tax": obj.get("withholding_tax"), + "withholding_tax_taxable": obj.get("withholding_tax_taxable"), + "other_withholding_tax": obj.get("other_withholding_tax"), + "use_gross_prices": obj.get("use_gross_prices"), "payment_method": PaymentMethod.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, diff --git a/fattureincloud_python_sdk/models/issued_document_pre_create_info_extra_data_default_values.py b/fattureincloud_python_sdk/models/issued_document_pre_create_info_extra_data_default_values.py index 28ceedf0..bef69a21 100644 --- a/fattureincloud_python_sdk/models/issued_document_pre_create_info_extra_data_default_values.py +++ b/fattureincloud_python_sdk/models/issued_document_pre_create_info_extra_data_default_values.py @@ -19,75 +19,79 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPreCreateInfoExtraDataDefaultValues(BaseModel): """ - Issued document extra data default values # noqa: E501 - """ + Issued document extra data default values + """ # noqa: E501 ts_communication: Optional[StrictBool] = None ts_tipo_spesa: Optional[StrictStr] = None ts_flag_tipo_spesa: Optional[StrictInt] = None ts_pagamento_tracciato: Optional[StrictBool] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "ts_communication", "ts_tipo_spesa", "ts_flag_tipo_spesa", "ts_pagamento_tracciato", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json( - cls, json_str: str - ) -> IssuedDocumentPreCreateInfoExtraDataDefaultValues: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPreCreateInfoExtraDataDefaultValues from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPreCreateInfoExtraDataDefaultValues: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPreCreateInfoExtraDataDefaultValues from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPreCreateInfoExtraDataDefaultValues.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPreCreateInfoExtraDataDefaultValues.parse_obj( + _obj = cls.model_validate( { - "ts_communication": obj.get("ts_communication") - if obj.get("ts_communication") is not None - else None, - "ts_tipo_spesa": obj.get("ts_tipo_spesa") - if obj.get("ts_tipo_spesa") is not None - else None, - "ts_flag_tipo_spesa": obj.get("ts_flag_tipo_spesa") - if obj.get("ts_flag_tipo_spesa") is not None - else None, - "ts_pagamento_tracciato": obj.get("ts_pagamento_tracciato") - if obj.get("ts_pagamento_tracciato") is not None - else None, + "ts_communication": obj.get("ts_communication"), + "ts_tipo_spesa": obj.get("ts_tipo_spesa"), + "ts_flag_tipo_spesa": obj.get("ts_flag_tipo_spesa"), + "ts_pagamento_tracciato": obj.get("ts_pagamento_tracciato"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/issued_document_pre_create_info_items_default_values.py b/fattureincloud_python_sdk/models/issued_document_pre_create_info_items_default_values.py index 6d67ad8f..620a533b 100644 --- a/fattureincloud_python_sdk/models/issued_document_pre_create_info_items_default_values.py +++ b/fattureincloud_python_sdk/models/issued_document_pre_create_info_items_default_values.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class IssuedDocumentPreCreateInfoItemsDefaultValues(BaseModel): """ - Issued document items default values # noqa: E501 - """ + Issued document items default values + """ # noqa: E501 vat: Optional[VatType] = None - __properties = ["vat"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["vat"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentPreCreateInfoItemsDefaultValues: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentPreCreateInfoItemsDefaultValues from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of vat if self.vat: _dict["vat"] = self.vat.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentPreCreateInfoItemsDefaultValues: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentPreCreateInfoItemsDefaultValues from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentPreCreateInfoItemsDefaultValues.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentPreCreateInfoItemsDefaultValues.parse_obj( + _obj = cls.model_validate( { "vat": VatType.from_dict(obj.get("vat")) if obj.get("vat") is not None diff --git a/fattureincloud_python_sdk/models/issued_document_status.py b/fattureincloud_python_sdk/models/issued_document_status.py index c3292959..4f3434db 100644 --- a/fattureincloud_python_sdk/models/issued_document_status.py +++ b/fattureincloud_python_sdk/models/issued_document_status.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class IssuedDocumentStatus(str, Enum): @@ -32,6 +39,6 @@ class IssuedDocumentStatus(str, Enum): REVERSED = "reversed" @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentStatus: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentStatus from a JSON string""" - return IssuedDocumentStatus(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/issued_document_totals.py b/fattureincloud_python_sdk/models/issued_document_totals.py index d16724ea..b809c1c5 100644 --- a/fattureincloud_python_sdk/models/issued_document_totals.py +++ b/fattureincloud_python_sdk/models/issued_document_totals.py @@ -19,65 +19,75 @@ import json -from typing import Any, Dict, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt +from pydantic import Field + +from fattureincloud_python_sdk.models.vat_item import VatItem + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class IssuedDocumentTotals(BaseModel): """ IssuedDocumentTotals - """ + """ # noqa: E501 amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document total net amount" + default=None, description="Issued document total net amount" ) amount_rivalsa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document rivalsa amount" + default=None, description="Issued document rivalsa amount" ) amount_net_with_rivalsa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document net amount with rivalsa" + default=None, description="Issued document net amount with rivalsa" ) amount_cassa: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document cassa amount" + default=None, description="Issued document cassa amount" ) taxable_amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document taxable amount" + default=None, description="Issued document taxable amount" ) not_taxable_amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document not taxable amount" + default=None, description="Issued document not taxable amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document total vat amount" + default=None, description="Issued document total vat amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document total gross amount" + default=None, description="Issued document total gross amount" ) taxable_amount_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document Taxable withholding tax amount" + default=None, description="Issued document Taxable withholding tax amount" ) amount_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document withholding tax amount" + default=None, description="Issued document withholding tax amount" ) taxable_amount_other_withholding_tax: Optional[ Union[StrictFloat, StrictInt] - ] = Field(None, description="Issued document other withholding tax taxable amount") + ] = Field( + default=None, description="Issued document other withholding tax taxable amount" + ) amount_other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document other withholding tax amount" + default=None, description="Issued document other withholding tax amount" ) stamp_duty: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document stamp duty value [0 if not present]." + default=None, description="Issued document stamp duty value [0 if not present]." ) amount_due: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document total amount due" + default=None, description="Issued document total amount due" ) is_enasarco_maximal_exceeded: Optional[StrictBool] = Field( - None, description="Is enasarco maximal excedeed" + default=None, description="Is enasarco maximal excedeed" ) payments_sum: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Issued document payments sum" + default=None, description="Issued document payments sum" ) - vat_list: Optional[Dict[str, Dict[str, Any]]] = None - __properties = [ + vat_list: Optional[Dict[str, Union[str, Any]]] = None + __properties: ClassVar[List[str]] = [ "amount_net", "amount_rivalsa", "amount_net_with_rivalsa", @@ -97,28 +107,37 @@ class IssuedDocumentTotals(BaseModel): "vat_list", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentTotals: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentTotals from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each value in vat_list (dict) _field_dict = {} if self.vat_list: @@ -129,70 +148,36 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> IssuedDocumentTotals: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of IssuedDocumentTotals from a dict""" if obj is None: return None if not isinstance(obj, dict): - return IssuedDocumentTotals.parse_obj(obj) + return cls.model_validate(obj) - _obj = IssuedDocumentTotals.parse_obj( + _obj = cls.model_validate( { - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_rivalsa": float(obj.get("amount_rivalsa")) - if obj.get("amount_rivalsa") is not None - else None, - "amount_net_with_rivalsa": float(obj.get("amount_net_with_rivalsa")) - if obj.get("amount_net_with_rivalsa") is not None - else None, - "amount_cassa": float(obj.get("amount_cassa")) - if obj.get("amount_cassa") is not None - else None, - "taxable_amount": float(obj.get("taxable_amount")) - if obj.get("taxable_amount") is not None - else None, - "not_taxable_amount": float(obj.get("not_taxable_amount")) - if obj.get("not_taxable_amount") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "taxable_amount_withholding_tax": float( - obj.get("taxable_amount_withholding_tax") - ) - if obj.get("taxable_amount_withholding_tax") is not None - else None, - "amount_withholding_tax": float(obj.get("amount_withholding_tax")) - if obj.get("amount_withholding_tax") is not None - else None, - "taxable_amount_other_withholding_tax": float( - obj.get("taxable_amount_other_withholding_tax") - ) - if obj.get("taxable_amount_other_withholding_tax") is not None - else None, - "amount_other_withholding_tax": float( - obj.get("amount_other_withholding_tax") - ) - if obj.get("amount_other_withholding_tax") is not None - else None, - "stamp_duty": float(obj.get("stamp_duty")) - if obj.get("stamp_duty") is not None - else None, - "amount_due": float(obj.get("amount_due")) - if obj.get("amount_due") is not None - else None, - "is_enasarco_maximal_exceeded": obj.get("is_enasarco_maximal_exceeded") - if obj.get("is_enasarco_maximal_exceeded") is not None - else None, - "payments_sum": float(obj.get("payments_sum")) - if obj.get("payments_sum") is not None - else None, + "amount_net": obj.get("amount_net"), + "amount_rivalsa": obj.get("amount_rivalsa"), + "amount_net_with_rivalsa": obj.get("amount_net_with_rivalsa"), + "amount_cassa": obj.get("amount_cassa"), + "taxable_amount": obj.get("taxable_amount"), + "not_taxable_amount": obj.get("not_taxable_amount"), + "amount_vat": obj.get("amount_vat"), + "amount_gross": obj.get("amount_gross"), + "taxable_amount_withholding_tax": obj.get( + "taxable_amount_withholding_tax" + ), + "amount_withholding_tax": obj.get("amount_withholding_tax"), + "taxable_amount_other_withholding_tax": obj.get( + "taxable_amount_other_withholding_tax" + ), + "amount_other_withholding_tax": obj.get("amount_other_withholding_tax"), + "stamp_duty": obj.get("stamp_duty"), + "amount_due": obj.get("amount_due"), + "is_enasarco_maximal_exceeded": obj.get("is_enasarco_maximal_exceeded"), + "payments_sum": obj.get("payments_sum"), "vat_list": dict( (_k, VatItem.from_dict(_v)) for _k, _v in obj.get("vat_list").items() diff --git a/fattureincloud_python_sdk/models/issued_document_type.py b/fattureincloud_python_sdk/models/issued_document_type.py index 078451a0..8b9172f3 100644 --- a/fattureincloud_python_sdk/models/issued_document_type.py +++ b/fattureincloud_python_sdk/models/issued_document_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class IssuedDocumentType(str, Enum): @@ -40,6 +47,6 @@ class IssuedDocumentType(str, Enum): SELF_SUPPLIER_INVOICE = "self_supplier_invoice" @classmethod - def from_json(cls, json_str: str) -> IssuedDocumentType: + def from_json(cls, json_str: str) -> Self: """Create an instance of IssuedDocumentType from a JSON string""" - return IssuedDocumentType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/join_issued_documents_response.py b/fattureincloud_python_sdk/models/join_issued_documents_response.py index 29e7405d..b5e47637 100644 --- a/fattureincloud_python_sdk/models/join_issued_documents_response.py +++ b/fattureincloud_python_sdk/models/join_issued_documents_response.py @@ -19,45 +19,59 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument from fattureincloud_python_sdk.models.issued_document_options import ( IssuedDocumentOptions, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class JoinIssuedDocumentsResponse(BaseModel): """ JoinIssuedDocumentsResponse - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None options: Optional[IssuedDocumentOptions] = None - __properties = ["data", "options"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "options"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> JoinIssuedDocumentsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of JoinIssuedDocumentsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -67,15 +81,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> JoinIssuedDocumentsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of JoinIssuedDocumentsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return JoinIssuedDocumentsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = JoinIssuedDocumentsResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/language.py b/fattureincloud_python_sdk/models/language.py index 42aca250..af8d8754 100644 --- a/fattureincloud_python_sdk/models/language.py +++ b/fattureincloud_python_sdk/models/language.py @@ -19,56 +19,68 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class Language(BaseModel): """ Language - """ + """ # noqa: E501 - code: Optional[StrictStr] = Field(None, description="Language code") - name: Optional[StrictStr] = Field(None, description="Language extended name") - __properties = ["code", "name"] + code: Optional[StrictStr] = Field(default=None, description="Language code") + name: Optional[StrictStr] = Field( + default=None, description="Language extended name" + ) + __properties: ClassVar[List[str]] = ["code", "name"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Language: + def from_json(cls, json_str: str) -> Self: """Create an instance of Language from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Language: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Language from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Language.parse_obj(obj) + return cls.model_validate(obj) - _obj = Language.parse_obj( - { - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - } - ) + _obj = cls.model_validate({"code": obj.get("code"), "name": obj.get("name")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_archive_categories_response.py b/fattureincloud_python_sdk/models/list_archive_categories_response.py index c470073f..ccd73407 100644 --- a/fattureincloud_python_sdk/models/list_archive_categories_response.py +++ b/fattureincloud_python_sdk/models/list_archive_categories_response.py @@ -19,50 +19,64 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ListArchiveCategoriesResponse(BaseModel): """ ListArchiveCategoriesResponse - """ - - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListArchiveCategoriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListArchiveCategoriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListArchiveCategoriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListArchiveCategoriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListArchiveCategoriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListArchiveCategoriesResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_archive_documents_response.py b/fattureincloud_python_sdk/models/list_archive_documents_response.py index ad160eba..7161b933 100644 --- a/fattureincloud_python_sdk/models/list_archive_documents_response.py +++ b/fattureincloud_python_sdk/models/list_archive_documents_response.py @@ -19,33 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListArchiveDocumentsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(ArchiveDocument)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[ArchiveDocument]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +80,37 @@ class ListArchiveDocumentsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListArchiveDocumentsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListArchiveDocumentsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +121,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListArchiveDocumentsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListArchiveDocumentsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListArchiveDocumentsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListArchiveDocumentsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [ArchiveDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_archive_documents_response_page.py b/fattureincloud_python_sdk/models/list_archive_documents_response_page.py index 02a54ad0..066cb9d1 100644 --- a/fattureincloud_python_sdk/models/list_archive_documents_response_page.py +++ b/fattureincloud_python_sdk/models/list_archive_documents_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListArchiveDocumentsResponsePage(BaseModel): """ ListArchiveDocumentsResponsePage - """ - - data: Optional[conlist(ArchiveDocument)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[ArchiveDocument]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListArchiveDocumentsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListArchiveDocumentsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListArchiveDocumentsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListArchiveDocumentsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListArchiveDocumentsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListArchiveDocumentsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [ArchiveDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_cashbook_entries_response.py b/fattureincloud_python_sdk/models/list_cashbook_entries_response.py index df847143..20c8a13c 100644 --- a/fattureincloud_python_sdk/models/list_cashbook_entries_response.py +++ b/fattureincloud_python_sdk/models/list_cashbook_entries_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListCashbookEntriesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(CashbookEntry)] = None - __properties = ["data"] +class ListCashbookEntriesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[CashbookEntry]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListCashbookEntriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListCashbookEntriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListCashbookEntriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListCashbookEntriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListCashbookEntriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListCashbookEntriesResponse.parse_obj( + _obj = cls.model_validate( { "data": [CashbookEntry.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_cities_response.py b/fattureincloud_python_sdk/models/list_cities_response.py index b6559afe..139130f3 100644 --- a/fattureincloud_python_sdk/models/list_cities_response.py +++ b/fattureincloud_python_sdk/models/list_cities_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.city import City +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListCitiesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(City)] = None - __properties = ["data"] +class ListCitiesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[City]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListCitiesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListCitiesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListCitiesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListCitiesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListCitiesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListCitiesResponse.parse_obj( + _obj = cls.model_validate( { "data": [City.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_clients_response.py b/fattureincloud_python_sdk/models/list_clients_response.py index 6352d388..5419d7a3 100644 --- a/fattureincloud_python_sdk/models/list_clients_response.py +++ b/fattureincloud_python_sdk/models/list_clients_response.py @@ -19,33 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListClientsResponse(BaseModel): """ ListClientsResponse - """ + """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(Client)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[Client]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +82,37 @@ class ListClientsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListClientsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListClientsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +123,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListClientsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListClientsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListClientsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListClientsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [Client.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_clients_response_page.py b/fattureincloud_python_sdk/models/list_clients_response_page.py index fa5eb4ea..cc4594df 100644 --- a/fattureincloud_python_sdk/models/list_clients_response_page.py +++ b/fattureincloud_python_sdk/models/list_clients_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListClientsResponsePage(BaseModel): """ ListClientsResponsePage - """ - - data: Optional[conlist(Client)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Client]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListClientsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListClientsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListClientsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListClientsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListClientsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListClientsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [Client.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_cost_centers_response.py b/fattureincloud_python_sdk/models/list_cost_centers_response.py index 21ed072e..3998b797 100644 --- a/fattureincloud_python_sdk/models/list_cost_centers_response.py +++ b/fattureincloud_python_sdk/models/list_cost_centers_response.py @@ -19,50 +19,64 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ListCostCentersResponse(BaseModel): """ ListCostCentersResponse - """ - - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListCostCentersResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListCostCentersResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListCostCentersResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListCostCentersResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListCostCentersResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListCostCentersResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_countries_response.py b/fattureincloud_python_sdk/models/list_countries_response.py index 626bd547..a839a6fb 100644 --- a/fattureincloud_python_sdk/models/list_countries_response.py +++ b/fattureincloud_python_sdk/models/list_countries_response.py @@ -19,50 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListCountriesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListCountriesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListCountriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListCountriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListCountriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListCountriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListCountriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListCountriesResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_currencies_response.py b/fattureincloud_python_sdk/models/list_currencies_response.py index e4e20fbf..940078db 100644 --- a/fattureincloud_python_sdk/models/list_currencies_response.py +++ b/fattureincloud_python_sdk/models/list_currencies_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.currency import Currency +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListCurrenciesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(Currency)] = None - __properties = ["data"] +class ListCurrenciesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Currency]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListCurrenciesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListCurrenciesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListCurrenciesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListCurrenciesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListCurrenciesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListCurrenciesResponse.parse_obj( + _obj = cls.model_validate( { "data": [Currency.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_delivery_notes_default_causals_response.py b/fattureincloud_python_sdk/models/list_delivery_notes_default_causals_response.py index eb83c714..92d64f9a 100644 --- a/fattureincloud_python_sdk/models/list_delivery_notes_default_causals_response.py +++ b/fattureincloud_python_sdk/models/list_delivery_notes_default_causals_response.py @@ -19,52 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListDeliveryNotesDefaultCausalsResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListDeliveryNotesDefaultCausalsResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListDeliveryNotesDefaultCausalsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListDeliveryNotesDefaultCausalsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListDeliveryNotesDefaultCausalsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListDeliveryNotesDefaultCausalsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListDeliveryNotesDefaultCausalsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListDeliveryNotesDefaultCausalsResponse.parse_obj( - {"data": obj.get("data")} - ) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_detailed_countries_response.py b/fattureincloud_python_sdk/models/list_detailed_countries_response.py index 1610f7e6..82f444ee 100644 --- a/fattureincloud_python_sdk/models/list_detailed_countries_response.py +++ b/fattureincloud_python_sdk/models/list_detailed_countries_response.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.detailed_country import DetailedCountry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListDetailedCountriesResponse(BaseModel): """ ListDetailedCountriesResponse - """ - - data: Optional[conlist(DetailedCountry)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[DetailedCountry]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListDetailedCountriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListDetailedCountriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListDetailedCountriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListDetailedCountriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListDetailedCountriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListDetailedCountriesResponse.parse_obj( + _obj = cls.model_validate( { "data": [DetailedCountry.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_emails_response.py b/fattureincloud_python_sdk/models/list_emails_response.py index e6d63c59..72ba1b15 100644 --- a/fattureincloud_python_sdk/models/list_emails_response.py +++ b/fattureincloud_python_sdk/models/list_emails_response.py @@ -19,33 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.email import Email +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListEmailsResponse(BaseModel): """ ListEmailsResponse - """ + """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(Email)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[Email]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +82,37 @@ class ListEmailsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListEmailsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListEmailsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +123,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListEmailsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListEmailsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListEmailsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListEmailsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [Email.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_emails_response_page.py b/fattureincloud_python_sdk/models/list_emails_response_page.py index 7a93b557..47cea868 100644 --- a/fattureincloud_python_sdk/models/list_emails_response_page.py +++ b/fattureincloud_python_sdk/models/list_emails_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.email import Email +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListEmailsResponsePage(BaseModel): """ ListEmailsResponsePage - """ - - data: Optional[conlist(Email)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Email]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListEmailsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListEmailsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListEmailsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListEmailsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListEmailsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListEmailsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [Email.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_f24_response.py b/fattureincloud_python_sdk/models/list_f24_response.py index 8b32a5cb..24ba34a6 100644 --- a/fattureincloud_python_sdk/models/list_f24_response.py +++ b/fattureincloud_python_sdk/models/list_f24_response.py @@ -19,37 +19,57 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.f24 import F24 from fattureincloud_python_sdk.models.list_f24_response_aggregated_data import ( ListF24ResponseAggregatedData, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListF24Response(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(F24)] = None + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[F24]] = None aggregated_data: Optional[ListF24ResponseAggregatedData] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -65,28 +85,37 @@ class ListF24Response(BaseModel): "aggregated_data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListF24Response: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListF24Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -100,41 +129,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListF24Response: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListF24Response from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListF24Response.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListF24Response.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [F24.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_f24_response_aggregated_data.py b/fattureincloud_python_sdk/models/list_f24_response_aggregated_data.py index ee128db9..a5690344 100644 --- a/fattureincloud_python_sdk/models/list_f24_response_aggregated_data.py +++ b/fattureincloud_python_sdk/models/list_f24_response_aggregated_data.py @@ -19,58 +19,67 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ListF24ResponseAggregatedData(BaseModel): """ ListF24ResponseAggregatedData - """ + """ # noqa: E501 amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Total amount." + default=None, description="Total amount." ) - __properties = ["amount"] + __properties: ClassVar[List[str]] = ["amount"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListF24ResponseAggregatedData: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListF24ResponseAggregatedData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListF24ResponseAggregatedData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListF24ResponseAggregatedData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListF24ResponseAggregatedData.parse_obj(obj) - - _obj = ListF24ResponseAggregatedData.parse_obj( - { - "amount": float(obj.get("amount")) - if obj.get("amount") is not None - else None - } - ) + return cls.model_validate(obj) + + _obj = cls.model_validate({"amount": obj.get("amount")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_f24_response_aggregation.py b/fattureincloud_python_sdk/models/list_f24_response_aggregation.py index 0ec29680..1cd3a131 100644 --- a/fattureincloud_python_sdk/models/list_f24_response_aggregation.py +++ b/fattureincloud_python_sdk/models/list_f24_response_aggregation.py @@ -19,58 +19,72 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.list_f24_response_aggregated_data import ( ListF24ResponseAggregatedData, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListF24ResponseAggregation(BaseModel): """ ListF24ResponseAggregation - """ + """ # noqa: E501 aggregated_data: Optional[ListF24ResponseAggregatedData] = None - __properties = ["aggregated_data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["aggregated_data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListF24ResponseAggregation: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListF24ResponseAggregation from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of aggregated_data if self.aggregated_data: _dict["aggregated_data"] = self.aggregated_data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ListF24ResponseAggregation: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListF24ResponseAggregation from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListF24ResponseAggregation.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListF24ResponseAggregation.parse_obj( + _obj = cls.model_validate( { "aggregated_data": ListF24ResponseAggregatedData.from_dict( obj.get("aggregated_data") diff --git a/fattureincloud_python_sdk/models/list_f24_response_page.py b/fattureincloud_python_sdk/models/list_f24_response_page.py index 4c4fcb9f..d7aa62fa 100644 --- a/fattureincloud_python_sdk/models/list_f24_response_page.py +++ b/fattureincloud_python_sdk/models/list_f24_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListF24ResponsePage(BaseModel): """ ListF24ResponsePage - """ - - data: Optional[conlist(F24)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[F24]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListF24ResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListF24ResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListF24ResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListF24ResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListF24ResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListF24ResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [F24.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_issued_documents_response.py b/fattureincloud_python_sdk/models/list_issued_documents_response.py index 05fc80f8..2c43551e 100644 --- a/fattureincloud_python_sdk/models/list_issued_documents_response.py +++ b/fattureincloud_python_sdk/models/list_issued_documents_response.py @@ -19,33 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListIssuedDocumentsResponse(BaseModel): """ ListIssuedDocumentsResponse - """ + """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(IssuedDocument)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[IssuedDocument]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +82,37 @@ class ListIssuedDocumentsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListIssuedDocumentsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListIssuedDocumentsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +123,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListIssuedDocumentsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListIssuedDocumentsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListIssuedDocumentsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListIssuedDocumentsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [IssuedDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_issued_documents_response_page.py b/fattureincloud_python_sdk/models/list_issued_documents_response_page.py index c7b4d505..0bd95bd0 100644 --- a/fattureincloud_python_sdk/models/list_issued_documents_response_page.py +++ b/fattureincloud_python_sdk/models/list_issued_documents_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListIssuedDocumentsResponsePage(BaseModel): """ ListIssuedDocumentsResponsePage - """ - - data: Optional[conlist(IssuedDocument)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[IssuedDocument]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListIssuedDocumentsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListIssuedDocumentsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListIssuedDocumentsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListIssuedDocumentsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListIssuedDocumentsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListIssuedDocumentsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [IssuedDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_languages_response.py b/fattureincloud_python_sdk/models/list_languages_response.py index cdf1ae14..be580681 100644 --- a/fattureincloud_python_sdk/models/list_languages_response.py +++ b/fattureincloud_python_sdk/models/list_languages_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.language import Language +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListLanguagesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(Language)] = None - __properties = ["data"] +class ListLanguagesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Language]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListLanguagesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListLanguagesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListLanguagesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListLanguagesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListLanguagesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListLanguagesResponse.parse_obj( + _obj = cls.model_validate( { "data": [Language.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_payment_accounts_response.py b/fattureincloud_python_sdk/models/list_payment_accounts_response.py index b6a70105..67c7986e 100644 --- a/fattureincloud_python_sdk/models/list_payment_accounts_response.py +++ b/fattureincloud_python_sdk/models/list_payment_accounts_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListPaymentAccountsResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(PaymentAccount)] = None - __properties = ["data"] +class ListPaymentAccountsResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[PaymentAccount]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListPaymentAccountsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListPaymentAccountsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListPaymentAccountsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListPaymentAccountsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListPaymentAccountsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListPaymentAccountsResponse.parse_obj( + _obj = cls.model_validate( { "data": [PaymentAccount.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_payment_methods_response.py b/fattureincloud_python_sdk/models/list_payment_methods_response.py index ed2faafc..99b008f6 100644 --- a/fattureincloud_python_sdk/models/list_payment_methods_response.py +++ b/fattureincloud_python_sdk/models/list_payment_methods_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListPaymentMethodsResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(PaymentMethod)] = None - __properties = ["data"] +class ListPaymentMethodsResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[PaymentMethod]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListPaymentMethodsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListPaymentMethodsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListPaymentMethodsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListPaymentMethodsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListPaymentMethodsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListPaymentMethodsResponse.parse_obj( + _obj = cls.model_validate( { "data": [PaymentMethod.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_product_categories_response.py b/fattureincloud_python_sdk/models/list_product_categories_response.py index d1c061ff..3c7007fa 100644 --- a/fattureincloud_python_sdk/models/list_product_categories_response.py +++ b/fattureincloud_python_sdk/models/list_product_categories_response.py @@ -19,50 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListProductCategoriesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListProductCategoriesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListProductCategoriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListProductCategoriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListProductCategoriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListProductCategoriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListProductCategoriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListProductCategoriesResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_products_response.py b/fattureincloud_python_sdk/models/list_products_response.py index 75455d28..0d9eaef0 100644 --- a/fattureincloud_python_sdk/models/list_products_response.py +++ b/fattureincloud_python_sdk/models/list_products_response.py @@ -19,33 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListProductsResponse(BaseModel): """ ListProductsResponse - """ + """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(Product)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[Product]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +82,37 @@ class ListProductsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListProductsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListProductsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +123,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListProductsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListProductsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListProductsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListProductsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [Product.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_products_response_page.py b/fattureincloud_python_sdk/models/list_products_response_page.py index 6992e4a5..a180d0b6 100644 --- a/fattureincloud_python_sdk/models/list_products_response_page.py +++ b/fattureincloud_python_sdk/models/list_products_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListProductsResponsePage(BaseModel): """ ListProductsResponsePage - """ - - data: Optional[conlist(Product)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Product]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListProductsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListProductsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListProductsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListProductsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListProductsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListProductsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [Product.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_receipts_response.py b/fattureincloud_python_sdk/models/list_receipts_response.py index 83824c63..e354cae3 100644 --- a/fattureincloud_python_sdk/models/list_receipts_response.py +++ b/fattureincloud_python_sdk/models/list_receipts_response.py @@ -19,33 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListReceiptsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(Receipt)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[Receipt]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +80,37 @@ class ListReceiptsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListReceiptsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListReceiptsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +121,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListReceiptsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListReceiptsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListReceiptsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListReceiptsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [Receipt.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_receipts_response_page.py b/fattureincloud_python_sdk/models/list_receipts_response_page.py index 31b343a6..bbc6c43c 100644 --- a/fattureincloud_python_sdk/models/list_receipts_response_page.py +++ b/fattureincloud_python_sdk/models/list_receipts_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListReceiptsResponsePage(BaseModel): """ ListReceiptsResponsePage - """ - - data: Optional[conlist(Receipt)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Receipt]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListReceiptsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListReceiptsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListReceiptsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListReceiptsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListReceiptsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListReceiptsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [Receipt.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_received_document_categories_response.py b/fattureincloud_python_sdk/models/list_received_document_categories_response.py index 2df8d523..98dd23a4 100644 --- a/fattureincloud_python_sdk/models/list_received_document_categories_response.py +++ b/fattureincloud_python_sdk/models/list_received_document_categories_response.py @@ -19,52 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListReceivedDocumentCategoriesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListReceivedDocumentCategoriesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListReceivedDocumentCategoriesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListReceivedDocumentCategoriesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListReceivedDocumentCategoriesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListReceivedDocumentCategoriesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListReceivedDocumentCategoriesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListReceivedDocumentCategoriesResponse.parse_obj( - {"data": obj.get("data")} - ) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_received_documents_response.py b/fattureincloud_python_sdk/models/list_received_documents_response.py index 6ebf4d2e..c6573a86 100644 --- a/fattureincloud_python_sdk/models/list_received_documents_response.py +++ b/fattureincloud_python_sdk/models/list_received_documents_response.py @@ -19,33 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListReceivedDocumentsResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(ReceivedDocument)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[ReceivedDocument]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +80,37 @@ class ListReceivedDocumentsResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListReceivedDocumentsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListReceivedDocumentsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +121,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListReceivedDocumentsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListReceivedDocumentsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListReceivedDocumentsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListReceivedDocumentsResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [ReceivedDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_received_documents_response_page.py b/fattureincloud_python_sdk/models/list_received_documents_response_page.py index 0e1eafdc..9b270978 100644 --- a/fattureincloud_python_sdk/models/list_received_documents_response_page.py +++ b/fattureincloud_python_sdk/models/list_received_documents_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListReceivedDocumentsResponsePage(BaseModel): """ ListReceivedDocumentsResponsePage - """ - - data: Optional[conlist(ReceivedDocument)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[ReceivedDocument]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListReceivedDocumentsResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListReceivedDocumentsResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListReceivedDocumentsResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListReceivedDocumentsResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListReceivedDocumentsResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListReceivedDocumentsResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [ReceivedDocument.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_revenue_centers_response.py b/fattureincloud_python_sdk/models/list_revenue_centers_response.py index 2c99aae0..83a88249 100644 --- a/fattureincloud_python_sdk/models/list_revenue_centers_response.py +++ b/fattureincloud_python_sdk/models/list_revenue_centers_response.py @@ -19,50 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListRevenueCentersResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListRevenueCentersResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListRevenueCentersResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListRevenueCentersResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListRevenueCentersResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListRevenueCentersResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListRevenueCentersResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListRevenueCentersResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_suppliers_response.py b/fattureincloud_python_sdk/models/list_suppliers_response.py index 7de5e6b5..fa2c782f 100644 --- a/fattureincloud_python_sdk/models/list_suppliers_response.py +++ b/fattureincloud_python_sdk/models/list_suppliers_response.py @@ -19,33 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListSuppliersResponse(BaseModel): """ ListSuppliersResponse - """ + """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." + ) + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." + ) + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - data: Optional[conlist(Supplier)] = None - __properties = [ + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + data: Optional[List[Supplier]] = None + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -60,28 +82,37 @@ class ListSuppliersResponse(BaseModel): "data", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListSuppliersResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListSuppliersResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -92,41 +123,27 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListSuppliersResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListSuppliersResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListSuppliersResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListSuppliersResponse.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), "data": [Supplier.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None, diff --git a/fattureincloud_python_sdk/models/list_suppliers_response_page.py b/fattureincloud_python_sdk/models/list_suppliers_response_page.py index b628a02a..256fb690 100644 --- a/fattureincloud_python_sdk/models/list_suppliers_response_page.py +++ b/fattureincloud_python_sdk/models/list_suppliers_response_page.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListSuppliersResponsePage(BaseModel): """ ListSuppliersResponsePage - """ - - data: Optional[conlist(Supplier)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[Supplier]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListSuppliersResponsePage: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListSuppliersResponsePage from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListSuppliersResponsePage: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListSuppliersResponsePage from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListSuppliersResponsePage.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListSuppliersResponsePage.parse_obj( + _obj = cls.model_validate( { "data": [Supplier.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_templates_response.py b/fattureincloud_python_sdk/models/list_templates_response.py index 1318bedf..6afd7c8e 100644 --- a/fattureincloud_python_sdk/models/list_templates_response.py +++ b/fattureincloud_python_sdk/models/list_templates_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.document_template import DocumentTemplate +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListTemplatesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(DocumentTemplate)] = None - __properties = ["data"] +class ListTemplatesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[DocumentTemplate]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListTemplatesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListTemplatesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListTemplatesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListTemplatesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListTemplatesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListTemplatesResponse.parse_obj( + _obj = cls.model_validate( { "data": [DocumentTemplate.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_units_of_measure_response.py b/fattureincloud_python_sdk/models/list_units_of_measure_response.py index 78219dac..930b4ed1 100644 --- a/fattureincloud_python_sdk/models/list_units_of_measure_response.py +++ b/fattureincloud_python_sdk/models/list_units_of_measure_response.py @@ -19,50 +19,62 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListUnitsOfMeasureResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(StrictStr)] = None - __properties = ["data"] +class ListUnitsOfMeasureResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListUnitsOfMeasureResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListUnitsOfMeasureResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ListUnitsOfMeasureResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListUnitsOfMeasureResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListUnitsOfMeasureResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListUnitsOfMeasureResponse.parse_obj({"data": obj.get("data")}) + _obj = cls.model_validate({"data": obj.get("data")}) return _obj diff --git a/fattureincloud_python_sdk/models/list_user_companies_response.py b/fattureincloud_python_sdk/models/list_user_companies_response.py index f58ca013..dbd63d97 100644 --- a/fattureincloud_python_sdk/models/list_user_companies_response.py +++ b/fattureincloud_python_sdk/models/list_user_companies_response.py @@ -19,58 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.list_user_companies_response_data import ( ListUserCompaniesResponseData, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListUserCompaniesResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ListUserCompaniesResponseData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListUserCompaniesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListUserCompaniesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ListUserCompaniesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListUserCompaniesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListUserCompaniesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListUserCompaniesResponse.parse_obj( + _obj = cls.model_validate( { "data": ListUserCompaniesResponseData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_user_companies_response_data.py b/fattureincloud_python_sdk/models/list_user_companies_response_data.py index a85e51cb..d83bbe8c 100644 --- a/fattureincloud_python_sdk/models/list_user_companies_response_data.py +++ b/fattureincloud_python_sdk/models/list_user_companies_response_data.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.company import Company +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListUserCompaniesResponseData(BaseModel): """ ListUserCompaniesResponseData - """ - - companies: Optional[conlist(Company)] = None - __properties = ["companies"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + companies: Optional[List[Company]] = None + __properties: ClassVar[List[str]] = ["companies"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListUserCompaniesResponseData: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListUserCompaniesResponseData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in companies (list) _items = [] if self.companies: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListUserCompaniesResponseData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListUserCompaniesResponseData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListUserCompaniesResponseData.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListUserCompaniesResponseData.parse_obj( + _obj = cls.model_validate( { "companies": [ Company.from_dict(_item) for _item in obj.get("companies") diff --git a/fattureincloud_python_sdk/models/list_vat_types_response.py b/fattureincloud_python_sdk/models/list_vat_types_response.py index 87d26b8b..ec1d31d5 100644 --- a/fattureincloud_python_sdk/models/list_vat_types_response.py +++ b/fattureincloud_python_sdk/models/list_vat_types_response.py @@ -19,41 +19,53 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self -class ListVatTypesResponse(BaseModel): - """ - # noqa: E501 - """ - data: Optional[conlist(VatType)] = None - __properties = ["data"] +class ListVatTypesResponse(BaseModel): + """ """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[VatType]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListVatTypesResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListVatTypesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +76,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListVatTypesResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListVatTypesResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListVatTypesResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListVatTypesResponse.parse_obj( + _obj = cls.model_validate( { "data": [VatType.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/list_webhooks_subscriptions_response.py b/fattureincloud_python_sdk/models/list_webhooks_subscriptions_response.py index a296c657..87700e4b 100644 --- a/fattureincloud_python_sdk/models/list_webhooks_subscriptions_response.py +++ b/fattureincloud_python_sdk/models/list_webhooks_subscriptions_response.py @@ -19,41 +19,55 @@ import json -from typing import List, Optional -from pydantic import BaseModel, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ListWebhooksSubscriptionsResponse(BaseModel): """ ListWebhooksSubscriptionsResponse - """ - - data: Optional[conlist(WebhooksSubscription)] = None - __properties = ["data"] + """ # noqa: E501 - class Config: - """Pydantic configuration""" + data: Optional[List[WebhooksSubscription]] = None + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ListWebhooksSubscriptionsResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ListWebhooksSubscriptionsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: @@ -64,15 +78,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ListWebhooksSubscriptionsResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ListWebhooksSubscriptionsResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ListWebhooksSubscriptionsResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ListWebhooksSubscriptionsResponse.parse_obj( + _obj = cls.model_validate( { "data": [ WebhooksSubscription.from_dict(_item) for _item in obj.get("data") diff --git a/fattureincloud_python_sdk/models/modify_archive_document_request.py b/fattureincloud_python_sdk/models/modify_archive_document_request.py index 6f1d9f85..f4d5f762 100644 --- a/fattureincloud_python_sdk/models/modify_archive_document_request.py +++ b/fattureincloud_python_sdk/models/modify_archive_document_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyArchiveDocumentRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ArchiveDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyArchiveDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyArchiveDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyArchiveDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyArchiveDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyArchiveDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyArchiveDocumentRequest.parse_obj( + _obj = cls.model_validate( { "data": ArchiveDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_archive_document_response.py b/fattureincloud_python_sdk/models/modify_archive_document_response.py index 27ff2390..fbb9b392 100644 --- a/fattureincloud_python_sdk/models/modify_archive_document_response.py +++ b/fattureincloud_python_sdk/models/modify_archive_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.archive_document import ArchiveDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyArchiveDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ArchiveDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyArchiveDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyArchiveDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyArchiveDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyArchiveDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyArchiveDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyArchiveDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ArchiveDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_cashbook_entry_request.py b/fattureincloud_python_sdk/models/modify_cashbook_entry_request.py index 8b212e55..7151bb84 100644 --- a/fattureincloud_python_sdk/models/modify_cashbook_entry_request.py +++ b/fattureincloud_python_sdk/models/modify_cashbook_entry_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyCashbookEntryRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CashbookEntry] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyCashbookEntryRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyCashbookEntryRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyCashbookEntryRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyCashbookEntryRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyCashbookEntryRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyCashbookEntryRequest.parse_obj( + _obj = cls.model_validate( { "data": CashbookEntry.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_cashbook_entry_response.py b/fattureincloud_python_sdk/models/modify_cashbook_entry_response.py index d9195d27..c57ddb2b 100644 --- a/fattureincloud_python_sdk/models/modify_cashbook_entry_response.py +++ b/fattureincloud_python_sdk/models/modify_cashbook_entry_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.cashbook_entry import CashbookEntry +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyCashbookEntryResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[CashbookEntry] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyCashbookEntryResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyCashbookEntryResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyCashbookEntryResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyCashbookEntryResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyCashbookEntryResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyCashbookEntryResponse.parse_obj( + _obj = cls.model_validate( { "data": CashbookEntry.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_client_request.py b/fattureincloud_python_sdk/models/modify_client_request.py index fe4ee3d3..bf2711c3 100644 --- a/fattureincloud_python_sdk/models/modify_client_request.py +++ b/fattureincloud_python_sdk/models/modify_client_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyClientRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Client] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyClientRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyClientRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyClientRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyClientRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyClientRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyClientRequest.parse_obj( + _obj = cls.model_validate( { "data": Client.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_client_response.py b/fattureincloud_python_sdk/models/modify_client_response.py index dcf41873..eea41f49 100644 --- a/fattureincloud_python_sdk/models/modify_client_response.py +++ b/fattureincloud_python_sdk/models/modify_client_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.client import Client +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyClientResponse(BaseModel): """ ModifyClientResponse - """ + """ # noqa: E501 data: Optional[Client] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyClientResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyClientResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyClientResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyClientResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyClientResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyClientResponse.parse_obj( + _obj = cls.model_validate( { "data": Client.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_f24_request.py b/fattureincloud_python_sdk/models/modify_f24_request.py index 65ac8639..cdb84831 100644 --- a/fattureincloud_python_sdk/models/modify_f24_request.py +++ b/fattureincloud_python_sdk/models/modify_f24_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyF24Request(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[F24] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyF24Request: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyF24Request from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyF24Request: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyF24Request from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyF24Request.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyF24Request.parse_obj( + _obj = cls.model_validate( { "data": F24.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_f24_response.py b/fattureincloud_python_sdk/models/modify_f24_response.py index 2c536925..41833fe7 100644 --- a/fattureincloud_python_sdk/models/modify_f24_response.py +++ b/fattureincloud_python_sdk/models/modify_f24_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.f24 import F24 +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyF24Response(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[F24] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyF24Response: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyF24Response from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyF24Response: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyF24Response from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyF24Response.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyF24Response.parse_obj( + _obj = cls.model_validate( { "data": F24.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_issued_document_request.py b/fattureincloud_python_sdk/models/modify_issued_document_request.py index 353d103f..1222a3cb 100644 --- a/fattureincloud_python_sdk/models/modify_issued_document_request.py +++ b/fattureincloud_python_sdk/models/modify_issued_document_request.py @@ -19,45 +19,57 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument from fattureincloud_python_sdk.models.issued_document_options import ( IssuedDocumentOptions, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyIssuedDocumentRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[IssuedDocument] = None options: Optional[IssuedDocumentOptions] = None - __properties = ["data", "options"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "options"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyIssuedDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyIssuedDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -67,15 +79,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyIssuedDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyIssuedDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyIssuedDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyIssuedDocumentRequest.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_issued_document_response.py b/fattureincloud_python_sdk/models/modify_issued_document_response.py index 1d18c7e4..8cdbfb18 100644 --- a/fattureincloud_python_sdk/models/modify_issued_document_response.py +++ b/fattureincloud_python_sdk/models/modify_issued_document_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyIssuedDocumentResponse(BaseModel): """ ModifyIssuedDocumentResponse - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyIssuedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyIssuedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyIssuedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyIssuedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyIssuedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyIssuedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_payment_account_request.py b/fattureincloud_python_sdk/models/modify_payment_account_request.py index 6181f2bb..3a7dbd6d 100644 --- a/fattureincloud_python_sdk/models/modify_payment_account_request.py +++ b/fattureincloud_python_sdk/models/modify_payment_account_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyPaymentAccountRequest(BaseModel): """ ModifyPaymentAccountRequest - """ + """ # noqa: E501 data: Optional[PaymentAccount] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyPaymentAccountRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyPaymentAccountRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyPaymentAccountRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyPaymentAccountRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyPaymentAccountRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyPaymentAccountRequest.parse_obj( + _obj = cls.model_validate( { "data": PaymentAccount.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_payment_account_response.py b/fattureincloud_python_sdk/models/modify_payment_account_response.py index 412a01f6..89597adf 100644 --- a/fattureincloud_python_sdk/models/modify_payment_account_response.py +++ b/fattureincloud_python_sdk/models/modify_payment_account_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_account import PaymentAccount +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyPaymentAccountResponse(BaseModel): """ ModifyPaymentAccountResponse - """ + """ # noqa: E501 data: Optional[PaymentAccount] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyPaymentAccountResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyPaymentAccountResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyPaymentAccountResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyPaymentAccountResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyPaymentAccountResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyPaymentAccountResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentAccount.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_payment_method_request.py b/fattureincloud_python_sdk/models/modify_payment_method_request.py index 99fd7deb..cb7912c4 100644 --- a/fattureincloud_python_sdk/models/modify_payment_method_request.py +++ b/fattureincloud_python_sdk/models/modify_payment_method_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyPaymentMethodRequest(BaseModel): """ ModifyPaymentMethodRequest - """ + """ # noqa: E501 data: Optional[PaymentMethod] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyPaymentMethodRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyPaymentMethodRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyPaymentMethodRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyPaymentMethodRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyPaymentMethodRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyPaymentMethodRequest.parse_obj( + _obj = cls.model_validate( { "data": PaymentMethod.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_payment_method_response.py b/fattureincloud_python_sdk/models/modify_payment_method_response.py index 0105ade7..179db7d2 100644 --- a/fattureincloud_python_sdk/models/modify_payment_method_response.py +++ b/fattureincloud_python_sdk/models/modify_payment_method_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.payment_method import PaymentMethod +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyPaymentMethodResponse(BaseModel): """ ModifyPaymentMethodResponse - """ + """ # noqa: E501 data: Optional[PaymentMethod] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyPaymentMethodResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyPaymentMethodResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyPaymentMethodResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyPaymentMethodResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyPaymentMethodResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyPaymentMethodResponse.parse_obj( + _obj = cls.model_validate( { "data": PaymentMethod.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_product_request.py b/fattureincloud_python_sdk/models/modify_product_request.py index 1f3d6a3c..2dc748dc 100644 --- a/fattureincloud_python_sdk/models/modify_product_request.py +++ b/fattureincloud_python_sdk/models/modify_product_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyProductRequest(BaseModel): """ ModifyProductRequest - """ + """ # noqa: E501 data: Optional[Product] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyProductRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyProductRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyProductRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyProductRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyProductRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyProductRequest.parse_obj( + _obj = cls.model_validate( { "data": Product.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_product_response.py b/fattureincloud_python_sdk/models/modify_product_response.py index e70dd1b8..27f3bdef 100644 --- a/fattureincloud_python_sdk/models/modify_product_response.py +++ b/fattureincloud_python_sdk/models/modify_product_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.product import Product +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyProductResponse(BaseModel): """ ModifyProductResponse - """ + """ # noqa: E501 data: Optional[Product] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyProductResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyProductResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyProductResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyProductResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyProductResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyProductResponse.parse_obj( + _obj = cls.model_validate( { "data": Product.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_receipt_request.py b/fattureincloud_python_sdk/models/modify_receipt_request.py index bfb10ef1..99b2b161 100644 --- a/fattureincloud_python_sdk/models/modify_receipt_request.py +++ b/fattureincloud_python_sdk/models/modify_receipt_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyReceiptRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Receipt] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyReceiptRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyReceiptRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyReceiptRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyReceiptRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyReceiptRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyReceiptRequest.parse_obj( + _obj = cls.model_validate( { "data": Receipt.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_receipt_response.py b/fattureincloud_python_sdk/models/modify_receipt_response.py index 655677bc..dfa93167 100644 --- a/fattureincloud_python_sdk/models/modify_receipt_response.py +++ b/fattureincloud_python_sdk/models/modify_receipt_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.receipt import Receipt +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyReceiptResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[Receipt] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyReceiptResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyReceiptResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyReceiptResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyReceiptResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyReceiptResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyReceiptResponse.parse_obj( + _obj = cls.model_validate( { "data": Receipt.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_received_document_request.py b/fattureincloud_python_sdk/models/modify_received_document_request.py index db0f9d8c..7b4c074a 100644 --- a/fattureincloud_python_sdk/models/modify_received_document_request.py +++ b/fattureincloud_python_sdk/models/modify_received_document_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyReceivedDocumentRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyReceivedDocumentRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyReceivedDocumentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyReceivedDocumentRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyReceivedDocumentRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyReceivedDocumentRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyReceivedDocumentRequest.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_received_document_response.py b/fattureincloud_python_sdk/models/modify_received_document_response.py index c449f0ad..68ee664a 100644 --- a/fattureincloud_python_sdk/models/modify_received_document_response.py +++ b/fattureincloud_python_sdk/models/modify_received_document_response.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.received_document import ReceivedDocument +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyReceivedDocumentResponse(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[ReceivedDocument] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyReceivedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyReceivedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyReceivedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyReceivedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyReceivedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyReceivedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": ReceivedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_supplier_request.py b/fattureincloud_python_sdk/models/modify_supplier_request.py index 7ad58fd4..c5a76510 100644 --- a/fattureincloud_python_sdk/models/modify_supplier_request.py +++ b/fattureincloud_python_sdk/models/modify_supplier_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifySupplierRequest(BaseModel): """ ModifySupplierRequest - """ + """ # noqa: E501 data: Optional[Supplier] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifySupplierRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifySupplierRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifySupplierRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifySupplierRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifySupplierRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifySupplierRequest.parse_obj( + _obj = cls.model_validate( { "data": Supplier.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_supplier_response.py b/fattureincloud_python_sdk/models/modify_supplier_response.py index 49ec84b3..3601b722 100644 --- a/fattureincloud_python_sdk/models/modify_supplier_response.py +++ b/fattureincloud_python_sdk/models/modify_supplier_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.supplier import Supplier +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifySupplierResponse(BaseModel): """ ModifySupplierResponse - """ + """ # noqa: E501 data: Optional[Supplier] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifySupplierResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifySupplierResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifySupplierResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifySupplierResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifySupplierResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifySupplierResponse.parse_obj( + _obj = cls.model_validate( { "data": Supplier.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_vat_type_request.py b/fattureincloud_python_sdk/models/modify_vat_type_request.py index 68fde805..05782e31 100644 --- a/fattureincloud_python_sdk/models/modify_vat_type_request.py +++ b/fattureincloud_python_sdk/models/modify_vat_type_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyVatTypeRequest(BaseModel): """ ModifyVatTypeRequest - """ + """ # noqa: E501 data: Optional[VatType] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyVatTypeRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyVatTypeRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyVatTypeRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyVatTypeRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyVatTypeRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyVatTypeRequest.parse_obj( + _obj = cls.model_validate( { "data": VatType.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_vat_type_response.py b/fattureincloud_python_sdk/models/modify_vat_type_response.py index b42fb05d..775406f9 100644 --- a/fattureincloud_python_sdk/models/modify_vat_type_response.py +++ b/fattureincloud_python_sdk/models/modify_vat_type_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyVatTypeResponse(BaseModel): """ ModifyVatTypeResponse - """ + """ # noqa: E501 data: Optional[VatType] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyVatTypeResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyVatTypeResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyVatTypeResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyVatTypeResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyVatTypeResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyVatTypeResponse.parse_obj( + _obj = cls.model_validate( { "data": VatType.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_webhooks_subscription_request.py b/fattureincloud_python_sdk/models/modify_webhooks_subscription_request.py index c7e04bd6..4b76bb3a 100644 --- a/fattureincloud_python_sdk/models/modify_webhooks_subscription_request.py +++ b/fattureincloud_python_sdk/models/modify_webhooks_subscription_request.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyWebhooksSubscriptionRequest(BaseModel): """ ModifyWebhooksSubscriptionRequest - """ + """ # noqa: E501 data: Optional[WebhooksSubscription] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyWebhooksSubscriptionRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyWebhooksSubscriptionRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyWebhooksSubscriptionRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyWebhooksSubscriptionRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyWebhooksSubscriptionRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyWebhooksSubscriptionRequest.parse_obj( + _obj = cls.model_validate( { "data": WebhooksSubscription.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/modify_webhooks_subscription_response.py b/fattureincloud_python_sdk/models/modify_webhooks_subscription_response.py index 8367f1e1..6af7e1f6 100644 --- a/fattureincloud_python_sdk/models/modify_webhooks_subscription_response.py +++ b/fattureincloud_python_sdk/models/modify_webhooks_subscription_response.py @@ -19,59 +19,74 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ModifyWebhooksSubscriptionResponse(BaseModel): """ ModifyWebhooksSubscriptionResponse - """ + """ # noqa: E501 data: Optional[WebhooksSubscription] = None - warnings: Optional[conlist(StrictStr)] = Field( - None, description="Webhooks registration warnings" + warnings: Optional[List[StrictStr]] = Field( + default=None, description="Webhooks registration warnings" ) - __properties = ["data", "warnings"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "warnings"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ModifyWebhooksSubscriptionResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of ModifyWebhooksSubscriptionResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ModifyWebhooksSubscriptionResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ModifyWebhooksSubscriptionResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ModifyWebhooksSubscriptionResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = ModifyWebhooksSubscriptionResponse.parse_obj( + _obj = cls.model_validate( { "data": WebhooksSubscription.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/monthly_total.py b/fattureincloud_python_sdk/models/monthly_total.py index f43b8ba5..249a57d9 100644 --- a/fattureincloud_python_sdk/models/monthly_total.py +++ b/fattureincloud_python_sdk/models/monthly_total.py @@ -19,68 +19,79 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class MonthlyTotal(BaseModel): """ MonthlyTotal - """ + """ # noqa: E501 net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Monthly total net amount" + default=None, description="Monthly total net amount" ) gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Monthly total gross amount" + default=None, description="Monthly total gross amount" ) count: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Monthly total receipt number" + default=None, description="Monthly total receipt number" ) - __properties = ["net", "gross", "count"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["net", "gross", "count"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> MonthlyTotal: + def from_json(cls, json_str: str) -> Self: """Create an instance of MonthlyTotal from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> MonthlyTotal: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of MonthlyTotal from a dict""" if obj is None: return None if not isinstance(obj, dict): - return MonthlyTotal.parse_obj(obj) + return cls.model_validate(obj) - _obj = MonthlyTotal.parse_obj( + _obj = cls.model_validate( { - "net": float(obj.get("net")) if obj.get("net") is not None else None, - "gross": float(obj.get("gross")) - if obj.get("gross") is not None - else None, - "count": float(obj.get("count")) - if obj.get("count") is not None - else None, + "net": obj.get("net"), + "gross": obj.get("gross"), + "count": obj.get("count"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/original_document_type.py b/fattureincloud_python_sdk/models/original_document_type.py index 182fe3e3..b6a6ca66 100644 --- a/fattureincloud_python_sdk/models/original_document_type.py +++ b/fattureincloud_python_sdk/models/original_document_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class OriginalDocumentType(str, Enum): @@ -32,6 +39,6 @@ class OriginalDocumentType(str, Enum): CONVENZIONE = "convenzione" @classmethod - def from_json(cls, json_str: str) -> OriginalDocumentType: + def from_json(cls, json_str: str) -> Self: """Create an instance of OriginalDocumentType from a JSON string""" - return OriginalDocumentType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/pagination.py b/fattureincloud_python_sdk/models/pagination.py index c2cb39d4..8255c5f9 100644 --- a/fattureincloud_python_sdk/models/pagination.py +++ b/fattureincloud_python_sdk/models/pagination.py @@ -19,31 +19,51 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class Pagination(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 - current_page: Optional[StrictInt] = Field(None, description="Current page number.") - first_page_url: Optional[StrictStr] = Field(None, description="First page url.") + current_page: Optional[StrictInt] = Field( + default=None, description="Current page number." + ) + first_page_url: Optional[StrictStr] = Field( + default=None, description="First page url." + ) var_from: Optional[StrictInt] = Field( - None, alias="from", description="First result of the page." + default=None, description="First result of the page.", alias="from" + ) + last_page: Optional[StrictInt] = Field( + default=None, description="Last page number." ) - last_page: Optional[StrictInt] = Field(None, description="Last page number.") - last_page_url: Optional[StrictStr] = Field(None, description="Last page url.") - next_page_url: Optional[StrictStr] = Field(None, description="Next page url") - path: Optional[StrictStr] = Field(None, description="Request path.") + last_page_url: Optional[StrictStr] = Field( + default=None, description="Last page url." + ) + next_page_url: Optional[StrictStr] = Field( + default=None, description="Next page url" + ) + path: Optional[StrictStr] = Field(default=None, description="Request path.") per_page: Optional[StrictInt] = Field( - None, description="Number of result per page." + default=None, description="Number of result per page." + ) + prev_page_url: Optional[StrictStr] = Field( + default=None, description="Previous page url." ) - prev_page_url: Optional[StrictStr] = Field(None, description="Previous page url.") - to: Optional[StrictInt] = Field(None, description="Last result of the page.") - total: Optional[StrictInt] = Field(None, description="Total number of results") - __properties = [ + to: Optional[StrictInt] = Field( + default=None, description="Last result of the page." + ) + total: Optional[StrictInt] = Field( + default=None, description="Total number of results" + ) + __properties: ClassVar[List[str]] = [ "current_page", "first_page_url", "from", @@ -57,66 +77,61 @@ class Pagination(BaseModel): "total", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Pagination: + def from_json(cls, json_str: str) -> Self: """Create an instance of Pagination from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Pagination: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Pagination from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Pagination.parse_obj(obj) + return cls.model_validate(obj) - _obj = Pagination.parse_obj( + _obj = cls.model_validate( { - "current_page": obj.get("current_page") - if obj.get("current_page") is not None - else None, - "first_page_url": obj.get("first_page_url") - if obj.get("first_page_url") is not None - else None, - "var_from": obj.get("from") if obj.get("from") is not None else None, - "last_page": obj.get("last_page") - if obj.get("last_page") is not None - else None, - "last_page_url": obj.get("last_page_url") - if obj.get("last_page_url") is not None - else None, - "next_page_url": obj.get("next_page_url") - if obj.get("next_page_url") is not None - else None, - "path": obj.get("path") if obj.get("path") is not None else None, - "per_page": obj.get("per_page") - if obj.get("per_page") is not None - else None, - "prev_page_url": obj.get("prev_page_url") - if obj.get("prev_page_url") is not None - else None, - "to": obj.get("to") if obj.get("to") is not None else None, - "total": obj.get("total") if obj.get("total") is not None else None, + "current_page": obj.get("current_page"), + "first_page_url": obj.get("first_page_url"), + "from": obj.get("from"), + "last_page": obj.get("last_page"), + "last_page_url": obj.get("last_page_url"), + "next_page_url": obj.get("next_page_url"), + "path": obj.get("path"), + "per_page": obj.get("per_page"), + "prev_page_url": obj.get("prev_page_url"), + "to": obj.get("to"), + "total": obj.get("total"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/payment_account.py b/fattureincloud_python_sdk/models/payment_account.py index 5eee3542..1d353182 100644 --- a/fattureincloud_python_sdk/models/payment_account.py +++ b/fattureincloud_python_sdk/models/payment_account.py @@ -19,69 +19,92 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.payment_account_type import PaymentAccountType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class PaymentAccount(BaseModel): """ PaymentAccount - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Payment account id") - name: Optional[StrictStr] = Field(None, description="Payment account name") + id: Optional[StrictInt] = Field(default=None, description="Payment account id") + name: Optional[StrictStr] = Field(default=None, description="Payment account name") type: Optional[PaymentAccountType] = None - iban: Optional[StrictStr] = Field(None, description="Payment account iban") - sia: Optional[StrictStr] = Field(None, description="Payment account sia") - cuc: Optional[StrictStr] = Field(None, description="Payment account cuc") - virtual: Optional[StrictBool] = Field(None, description="Payment method is virtual") - __properties = ["id", "name", "type", "iban", "sia", "cuc", "virtual"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + iban: Optional[StrictStr] = Field(default=None, description="Payment account iban") + sia: Optional[StrictStr] = Field(default=None, description="Payment account sia") + cuc: Optional[StrictStr] = Field(default=None, description="Payment account cuc") + virtual: Optional[StrictBool] = Field( + default=None, description="Payment method is virtual" + ) + __properties: ClassVar[List[str]] = [ + "id", + "name", + "type", + "iban", + "sia", + "cuc", + "virtual", + ] + + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PaymentAccount: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentAccount from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PaymentAccount: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of PaymentAccount from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentAccount.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentAccount.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "name": obj.get("name"), "type": obj.get("type"), - "iban": obj.get("iban") if obj.get("iban") is not None else None, - "sia": obj.get("sia") if obj.get("sia") is not None else None, - "cuc": obj.get("cuc") if obj.get("cuc") is not None else None, - "virtual": obj.get("virtual") - if obj.get("virtual") is not None - else None, + "iban": obj.get("iban"), + "sia": obj.get("sia"), + "cuc": obj.get("cuc"), + "virtual": obj.get("virtual"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/payment_account_type.py b/fattureincloud_python_sdk/models/payment_account_type.py index d02dbd2d..c648d2d4 100644 --- a/fattureincloud_python_sdk/models/payment_account_type.py +++ b/fattureincloud_python_sdk/models/payment_account_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class PaymentAccountType(str, Enum): @@ -31,6 +38,6 @@ class PaymentAccountType(str, Enum): BANK = "bank" @classmethod - def from_json(cls, json_str: str) -> PaymentAccountType: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentAccountType from a JSON string""" - return PaymentAccountType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/payment_method.py b/fattureincloud_python_sdk/models/payment_method.py index 93138727..30fa60aa 100644 --- a/fattureincloud_python_sdk/models/payment_method.py +++ b/fattureincloud_python_sdk/models/payment_method.py @@ -19,37 +19,48 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import Field +from typing_extensions import Annotated from fattureincloud_python_sdk.models.payment_account import PaymentAccount from fattureincloud_python_sdk.models.payment_method_details import PaymentMethodDetails from fattureincloud_python_sdk.models.payment_method_type import PaymentMethodType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class PaymentMethod(BaseModel): """ PaymentMethod - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Payment method id") - name: Optional[StrictStr] = Field(None, description="Payment method name") + id: Optional[StrictInt] = Field(default=None, description="Payment method id") + name: Optional[StrictStr] = Field(default=None, description="Payment method name") type: Optional[PaymentMethodType] = None is_default: Optional[StrictBool] = Field( - None, description="Payment method is default" + default=None, description="Payment method is default" ) default_payment_account: Optional[PaymentAccount] = None - details: Optional[conlist(PaymentMethodDetails, max_items=5)] = Field( - None, description="Payment method details" + details: Optional[ + Annotated[List[PaymentMethodDetails], Field(max_length=5)] + ] = Field(default=None, description="Payment method details") + bank_iban: Optional[StrictStr] = Field( + default=None, description="Payment method bank iban" + ) + bank_name: Optional[StrictStr] = Field( + default=None, description="Payment method bank name" ) - bank_iban: Optional[StrictStr] = Field(None, description="Payment method bank iban") - bank_name: Optional[StrictStr] = Field(None, description="Payment method bank name") bank_beneficiary: Optional[StrictStr] = Field( - None, description="Payment method bank beneficiary" + default=None, description="Payment method bank beneficiary" ) ei_payment_method: Optional[StrictStr] = Field( - None, description="E-invoice payment method" + default=None, description="E-invoice payment method" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "name", "type", @@ -62,28 +73,37 @@ class PaymentMethod(BaseModel): "ei_payment_method", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PaymentMethod: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_payment_account if self.default_payment_account: _dict["default_payment_account"] = self.default_payment_account.to_dict() @@ -97,22 +117,20 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> PaymentMethod: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of PaymentMethod from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethod.parse_obj(obj) + return cls.model_validate(obj) - _obj = PaymentMethod.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "name": obj.get("name"), "type": obj.get("type"), - "is_default": obj.get("is_default") - if obj.get("is_default") is not None - else None, + "is_default": obj.get("is_default"), "default_payment_account": PaymentAccount.from_dict( obj.get("default_payment_account") ) @@ -124,18 +142,10 @@ def from_dict(cls, obj: dict) -> PaymentMethod: ] if obj.get("details") is not None else None, - "bank_iban": obj.get("bank_iban") - if obj.get("bank_iban") is not None - else None, - "bank_name": obj.get("bank_name") - if obj.get("bank_name") is not None - else None, - "bank_beneficiary": obj.get("bank_beneficiary") - if obj.get("bank_beneficiary") is not None - else None, - "ei_payment_method": obj.get("ei_payment_method") - if obj.get("ei_payment_method") is not None - else None, + "bank_iban": obj.get("bank_iban"), + "bank_name": obj.get("bank_name"), + "bank_beneficiary": obj.get("bank_beneficiary"), + "ei_payment_method": obj.get("ei_payment_method"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/payment_method_details.py b/fattureincloud_python_sdk/models/payment_method_details.py index a48bfcd6..08ae55da 100644 --- a/fattureincloud_python_sdk/models/payment_method_details.py +++ b/fattureincloud_python_sdk/models/payment_method_details.py @@ -19,60 +19,72 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class PaymentMethodDetails(BaseModel): """ PaymentMethodDetails - """ + """ # noqa: E501 - title: Optional[StrictStr] = Field(None, description="Payment method details title") + title: Optional[StrictStr] = Field( + default=None, description="Payment method details title" + ) description: Optional[StrictStr] = Field( - None, description="Payment method details description" + default=None, description="Payment method details description" ) - __properties = ["title", "description"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["title", "description"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PaymentMethodDetails: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentMethodDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PaymentMethodDetails: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of PaymentMethodDetails from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PaymentMethodDetails.parse_obj(obj) - - _obj = PaymentMethodDetails.parse_obj( - { - "title": obj.get("title") if obj.get("title") is not None else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"title": obj.get("title"), "description": obj.get("description")} ) return _obj diff --git a/fattureincloud_python_sdk/models/payment_method_type.py b/fattureincloud_python_sdk/models/payment_method_type.py index 17011ba5..3fbe15ee 100644 --- a/fattureincloud_python_sdk/models/payment_method_type.py +++ b/fattureincloud_python_sdk/models/payment_method_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class PaymentMethodType(str, Enum): @@ -31,6 +38,6 @@ class PaymentMethodType(str, Enum): RIBA = "riba" @classmethod - def from_json(cls, json_str: str) -> PaymentMethodType: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentMethodType from a JSON string""" - return PaymentMethodType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/payment_terms_type.py b/fattureincloud_python_sdk/models/payment_terms_type.py index 9507b441..8e0fcdc0 100644 --- a/fattureincloud_python_sdk/models/payment_terms_type.py +++ b/fattureincloud_python_sdk/models/payment_terms_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class PaymentTermsType(str, Enum): @@ -31,6 +38,6 @@ class PaymentTermsType(str, Enum): END_OF_MONTH = "end_of_month" @classmethod - def from_json(cls, json_str: str) -> PaymentTermsType: + def from_json(cls, json_str: str) -> Self: """Create an instance of PaymentTermsType from a JSON string""" - return PaymentTermsType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/permission_level.py b/fattureincloud_python_sdk/models/permission_level.py index 9b5cbe3a..f4b207dc 100644 --- a/fattureincloud_python_sdk/models/permission_level.py +++ b/fattureincloud_python_sdk/models/permission_level.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class PermissionLevel(str, Enum): @@ -33,6 +40,6 @@ class PermissionLevel(str, Enum): DETAILED = "detailed" @classmethod - def from_json(cls, json_str: str) -> PermissionLevel: + def from_json(cls, json_str: str) -> Self: """Create an instance of PermissionLevel from a JSON string""" - return PermissionLevel(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/permissions.py b/fattureincloud_python_sdk/models/permissions.py index a455ac57..a374370e 100644 --- a/fattureincloud_python_sdk/models/permissions.py +++ b/fattureincloud_python_sdk/models/permissions.py @@ -19,18 +19,21 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.permission_level import PermissionLevel from fattureincloud_python_sdk.models.permissions_fic_issued_documents_detailed import ( PermissionsFicIssuedDocumentsDetailed, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Permissions(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 fic_situation: Optional[PermissionLevel] = None fic_clients: Optional[PermissionLevel] = None @@ -59,7 +62,7 @@ class Permissions(BaseModel): fic_issued_documents_detailed: Optional[ PermissionsFicIssuedDocumentsDetailed ] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "fic_situation", "fic_clients", "fic_suppliers", @@ -87,28 +90,37 @@ class Permissions(BaseModel): "fic_issued_documents_detailed", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Permissions: + def from_json(cls, json_str: str) -> Self: """Create an instance of Permissions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of fic_issued_documents_detailed if self.fic_issued_documents_detailed: _dict[ @@ -117,15 +129,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Permissions: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Permissions from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Permissions.parse_obj(obj) + return cls.model_validate(obj) - _obj = Permissions.parse_obj( + _obj = cls.model_validate( { "fic_situation": obj.get("fic_situation"), "fic_clients": obj.get("fic_clients"), diff --git a/fattureincloud_python_sdk/models/permissions_fic_issued_documents_detailed.py b/fattureincloud_python_sdk/models/permissions_fic_issued_documents_detailed.py index d22ccd3e..32a4f8fc 100644 --- a/fattureincloud_python_sdk/models/permissions_fic_issued_documents_detailed.py +++ b/fattureincloud_python_sdk/models/permissions_fic_issued_documents_detailed.py @@ -19,15 +19,20 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.permission_level import PermissionLevel +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class PermissionsFicIssuedDocumentsDetailed(BaseModel): """ PermissionsFicIssuedDocumentsDetailed - """ + """ # noqa: E501 quotes: Optional[PermissionLevel] = None proformas: Optional[PermissionLevel] = None @@ -39,7 +44,7 @@ class PermissionsFicIssuedDocumentsDetailed(BaseModel): work_reports: Optional[PermissionLevel] = None supplier_orders: Optional[PermissionLevel] = None self_invoices: Optional[PermissionLevel] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "quotes", "proformas", "invoices", @@ -52,40 +57,49 @@ class PermissionsFicIssuedDocumentsDetailed(BaseModel): "self_invoices", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> PermissionsFicIssuedDocumentsDetailed: + def from_json(cls, json_str: str) -> Self: """Create an instance of PermissionsFicIssuedDocumentsDetailed from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> PermissionsFicIssuedDocumentsDetailed: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of PermissionsFicIssuedDocumentsDetailed from a dict""" if obj is None: return None if not isinstance(obj, dict): - return PermissionsFicIssuedDocumentsDetailed.parse_obj(obj) + return cls.model_validate(obj) - _obj = PermissionsFicIssuedDocumentsDetailed.parse_obj( + _obj = cls.model_validate( { "quotes": obj.get("quotes"), "proformas": obj.get("proformas"), diff --git a/fattureincloud_python_sdk/models/product.py b/fattureincloud_python_sdk/models/product.py index 05d63764..ab9082a7 100644 --- a/fattureincloud_python_sdk/models/product.py +++ b/fattureincloud_python_sdk/models/product.py @@ -19,54 +19,66 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Product(BaseModel): """ Product - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Product id") - name: Optional[StrictStr] = Field(None, description="Product name") - code: Optional[StrictStr] = Field(None, description="Product code") + id: Optional[StrictInt] = Field(default=None, description="Product id") + name: Optional[StrictStr] = Field(default=None, description="Product name") + code: Optional[StrictStr] = Field(default=None, description="Product code") net_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product net price" + default=None, description="Product net price" ) gross_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product gross price" + default=None, description="Product gross price" ) use_gross_price: Optional[StrictBool] = Field( - None, description="Product uses gross prices" + default=None, description="Product uses gross prices" ) default_vat: Optional[VatType] = None net_cost: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product net cost" + default=None, description="Product net cost" + ) + measure: Optional[StrictStr] = Field(default=None, description="Product measure") + description: Optional[StrictStr] = Field( + default=None, description="Product description" + ) + category: Optional[StrictStr] = Field(default=None, description="Product category") + notes: Optional[StrictStr] = Field(default=None, description="Product extra notes") + in_stock: Optional[StrictBool] = Field( + default=None, description="Product has stock" ) - measure: Optional[StrictStr] = Field(None, description="Product measure") - description: Optional[StrictStr] = Field(None, description="Product description") - category: Optional[StrictStr] = Field(None, description="Product category") - notes: Optional[StrictStr] = Field(None, description="Product extra notes") - in_stock: Optional[StrictBool] = Field(None, description="Product has stock") stock_initial: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product initial stock" + default=None, description="Product initial stock" ) stock_current: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Product current stock" + default=None, description="[Read Only] Product current stock" ) average_cost: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product average cost" + default=None, description="Product average cost" ) average_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Product average price" + default=None, description="Product average price" + ) + created_at: Optional[StrictStr] = Field( + default=None, description="Product creation date" ) - created_at: Optional[StrictStr] = Field(None, description="Product creation date") updated_at: Optional[StrictStr] = Field( - None, description="Product last update date" + default=None, description="Product last update date" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "name", "code", @@ -88,28 +100,34 @@ class Product(BaseModel): "updated_at", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Product: + def from_json(cls, json_str: str) -> Self: """Create an instance of Product from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "stock_current", @@ -122,65 +140,37 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Product: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Product from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Product.parse_obj(obj) + return cls.model_validate(obj) - _obj = Product.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "net_price": float(obj.get("net_price")) - if obj.get("net_price") is not None - else None, - "gross_price": float(obj.get("gross_price")) - if obj.get("gross_price") is not None - else None, - "use_gross_price": obj.get("use_gross_price") - if obj.get("use_gross_price") is not None - else None, + "id": obj.get("id"), + "name": obj.get("name"), + "code": obj.get("code"), + "net_price": obj.get("net_price"), + "gross_price": obj.get("gross_price"), + "use_gross_price": obj.get("use_gross_price"), "default_vat": VatType.from_dict(obj.get("default_vat")) if obj.get("default_vat") is not None else None, - "net_cost": float(obj.get("net_cost")) - if obj.get("net_cost") is not None - else None, - "measure": obj.get("measure") - if obj.get("measure") is not None - else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "in_stock": obj.get("in_stock") - if obj.get("in_stock") is not None - else None, - "stock_initial": float(obj.get("stock_initial")) - if obj.get("stock_initial") is not None - else None, - "stock_current": float(obj.get("stock_current")) - if obj.get("stock_current") is not None - else None, - "average_cost": float(obj.get("average_cost")) - if obj.get("average_cost") is not None - else None, - "average_price": float(obj.get("average_price")) - if obj.get("average_price") is not None - else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + "net_cost": obj.get("net_cost"), + "measure": obj.get("measure"), + "description": obj.get("description"), + "category": obj.get("category"), + "notes": obj.get("notes"), + "in_stock": obj.get("in_stock"), + "stock_initial": obj.get("stock_initial"), + "stock_current": obj.get("stock_current"), + "average_cost": obj.get("average_cost"), + "average_price": obj.get("average_price"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/receipt.py b/fattureincloud_python_sdk/models/receipt.py index e8f52069..b9a3bc60 100644 --- a/fattureincloud_python_sdk/models/receipt.py +++ b/fattureincloud_python_sdk/models/receipt.py @@ -19,56 +19,64 @@ import json from datetime import date -from typing import List, Optional, Union -from pydantic import ( - BaseModel, - Field, - StrictBool, - StrictFloat, - StrictInt, - StrictStr, - conlist, -) +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.payment_account import PaymentAccount from fattureincloud_python_sdk.models.receipt_items_list_item import ( ReceiptItemsListItem, ) from fattureincloud_python_sdk.models.receipt_type import ReceiptType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Receipt(BaseModel): """ Receipt - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Receipt id") - var_date: Optional[date] = Field(None, alias="date", description="Receipt date") + id: Optional[StrictInt] = Field(default=None, description="Receipt id") + var_date: Optional[date] = Field( + default=None, description="Receipt date", alias="date" + ) number: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt number" + default=None, description="Receipt number" + ) + numeration: Optional[StrictStr] = Field( + default=None, description="Receipt numeration" ) - numeration: Optional[StrictStr] = Field(None, description="Receipt numeration") amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt total net amount" + default=None, description="Receipt total net amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt total vat amount" + default=None, description="Receipt total vat amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt total gross amount" + default=None, description="Receipt total gross amount" ) use_gross_prices: Optional[StrictBool] = Field( - None, description="Receipt uses gross prices" + default=None, description="Receipt uses gross prices" ) type: Optional[ReceiptType] = None - description: Optional[StrictStr] = Field(None, description="Receipt description") - rc_center: Optional[StrictStr] = Field(None, description="Receipt revenue center") - created_at: Optional[StrictStr] = Field(None, description="Receipt creation date") + description: Optional[StrictStr] = Field( + default=None, description="Receipt description" + ) + rc_center: Optional[StrictStr] = Field( + default=None, description="Receipt revenue center" + ) + created_at: Optional[StrictStr] = Field( + default=None, description="Receipt creation date" + ) updated_at: Optional[StrictStr] = Field( - None, description="Receipt last update date" + default=None, description="Receipt last update date" ) payment_account: Optional[PaymentAccount] = None - items_list: Optional[conlist(ReceiptItemsListItem)] = None - __properties = [ + items_list: Optional[List[ReceiptItemsListItem]] = None + __properties: ClassVar[List[str]] = [ "id", "date", "number", @@ -86,28 +94,37 @@ class Receipt(BaseModel): "items_list", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Receipt: + def from_json(cls, json_str: str) -> Self: """Create an instance of Receipt from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of payment_account if self.payment_account: _dict["payment_account"] = self.payment_account.to_dict() @@ -121,49 +138,29 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> Receipt: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Receipt from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Receipt.parse_obj(obj) + return cls.model_validate(obj) - _obj = Receipt.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - "number": float(obj.get("number")) - if obj.get("number") is not None - else None, - "numeration": obj.get("numeration") - if obj.get("numeration") is not None - else None, - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "use_gross_prices": obj.get("use_gross_prices") - if obj.get("use_gross_prices") is not None - else None, + "id": obj.get("id"), + "date": obj.get("date"), + "number": obj.get("number"), + "numeration": obj.get("numeration"), + "amount_net": obj.get("amount_net"), + "amount_vat": obj.get("amount_vat"), + "amount_gross": obj.get("amount_gross"), + "use_gross_prices": obj.get("use_gross_prices"), "type": obj.get("type"), - "description": obj.get("description") - if obj.get("description") is not None - else None, - "rc_center": obj.get("rc_center") - if obj.get("rc_center") is not None - else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + "description": obj.get("description"), + "rc_center": obj.get("rc_center"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), "payment_account": PaymentAccount.from_dict(obj.get("payment_account")) if obj.get("payment_account") is not None else None, diff --git a/fattureincloud_python_sdk/models/receipt_items_list_item.py b/fattureincloud_python_sdk/models/receipt_items_list_item.py index b67c8c38..2efe15e9 100644 --- a/fattureincloud_python_sdk/models/receipt_items_list_item.py +++ b/fattureincloud_python_sdk/models/receipt_items_list_item.py @@ -19,75 +19,92 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceiptItemsListItem(BaseModel): """ ReceiptItemsListItem - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Receipt item id") + id: Optional[StrictInt] = Field(default=None, description="Receipt item id") amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt item total net amount" + default=None, description="Receipt item total net amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Receipt item total gross amount" + default=None, description="Receipt item total gross amount" + ) + category: Optional[StrictStr] = Field( + default=None, description="Receipt item category" ) - category: Optional[StrictStr] = Field(None, description="Receipt item category") vat: Optional[VatType] = None - __properties = ["id", "amount_net", "amount_gross", "category", "vat"] + __properties: ClassVar[List[str]] = [ + "id", + "amount_net", + "amount_gross", + "category", + "vat", + ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceiptItemsListItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceiptItemsListItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of vat if self.vat: _dict["vat"] = self.vat.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceiptItemsListItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceiptItemsListItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceiptItemsListItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceiptItemsListItem.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, + "id": obj.get("id"), + "amount_net": obj.get("amount_net"), + "amount_gross": obj.get("amount_gross"), + "category": obj.get("category"), "vat": VatType.from_dict(obj.get("vat")) if obj.get("vat") is not None else None, diff --git a/fattureincloud_python_sdk/models/receipt_pre_create_info.py b/fattureincloud_python_sdk/models/receipt_pre_create_info.py index 7b0e0511..8ed89598 100644 --- a/fattureincloud_python_sdk/models/receipt_pre_create_info.py +++ b/fattureincloud_python_sdk/models/receipt_pre_create_info.py @@ -19,34 +19,40 @@ import json -from typing import Dict, List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.payment_account import PaymentAccount from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceiptPreCreateInfo(BaseModel): """ ReceiptPreCreateInfo - """ + """ # noqa: E501 numerations: Optional[Dict[str, Dict[str, StrictInt]]] = None - numerations_list: Optional[conlist(StrictStr)] = Field( - None, description="Receipt used numerations list" + numerations_list: Optional[List[StrictStr]] = Field( + default=None, description="Receipt used numerations list" ) - rc_centers_list: Optional[conlist(StrictStr)] = Field( - None, description="Receipt used revenue centers list" + rc_centers_list: Optional[List[StrictStr]] = Field( + default=None, description="Receipt used revenue centers list" ) - payment_accounts_list: Optional[conlist(PaymentAccount)] = Field( - None, description="Payment accounts list" + payment_accounts_list: Optional[List[PaymentAccount]] = Field( + default=None, description="Payment accounts list" ) - categories_list: Optional[conlist(StrictStr)] = Field( - None, description="Receipt categories list" + categories_list: Optional[List[StrictStr]] = Field( + default=None, description="Receipt categories list" ) - vat_types_list: Optional[conlist(VatType)] = Field( - None, description="Vat types list" + vat_types_list: Optional[List[VatType]] = Field( + default=None, description="Vat types list" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "numerations", "numerations_list", "rc_centers_list", @@ -55,28 +61,37 @@ class ReceiptPreCreateInfo(BaseModel): "vat_types_list", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceiptPreCreateInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceiptPreCreateInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of each item in payment_accounts_list (list) _items = [] if self.payment_accounts_list: @@ -94,15 +109,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceiptPreCreateInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceiptPreCreateInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceiptPreCreateInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceiptPreCreateInfo.parse_obj( + _obj = cls.model_validate( { "numerations": obj.get("numerations"), "numerations_list": obj.get("numerations_list"), diff --git a/fattureincloud_python_sdk/models/receipt_type.py b/fattureincloud_python_sdk/models/receipt_type.py index 3a4a2172..3f16598d 100644 --- a/fattureincloud_python_sdk/models/receipt_type.py +++ b/fattureincloud_python_sdk/models/receipt_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ReceiptType(str, Enum): @@ -31,6 +38,6 @@ class ReceiptType(str, Enum): SALES_RECEIPT = "sales_receipt" @classmethod - def from_json(cls, json_str: str) -> ReceiptType: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceiptType from a JSON string""" - return ReceiptType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/received_document.py b/fattureincloud_python_sdk/models/received_document.py index 76ac8b5f..21b6ad3b 100644 --- a/fattureincloud_python_sdk/models/received_document.py +++ b/fattureincloud_python_sdk/models/received_document.py @@ -19,16 +19,9 @@ import json from datetime import date -from typing import List, Optional, Union -from pydantic import ( - BaseModel, - Field, - StrictBool, - StrictFloat, - StrictInt, - StrictStr, - conlist, -) +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.currency import Currency from fattureincloud_python_sdk.models.entity import Entity from fattureincloud_python_sdk.models.received_document_items_list_item import ( @@ -39,98 +32,103 @@ ) from fattureincloud_python_sdk.models.received_document_type import ReceivedDocumentType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocument(BaseModel): """ ReceivedDocument - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Received document id") + id: Optional[StrictInt] = Field(default=None, description="Received document id") type: Optional[ReceivedDocumentType] = None entity: Optional[Entity] = None var_date: Optional[date] = Field( - None, - alias="date", + default=None, description="Received document date [defaults to today's date]", + alias="date", ) category: Optional[StrictStr] = Field( - None, description="Received document category" + default=None, description="Received document category" ) description: Optional[StrictStr] = Field( - None, description="Received document description" + default=None, description="Received document description" ) amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total net amount" + default=None, description="Received document total net amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total vat amount" + default=None, description="Received document total vat amount" ) amount_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document withholding tax amount" + default=None, description="Received document withholding tax amount" ) amount_other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document other withholding tax amount" + default=None, description="Received document other withholding tax amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Received document total gross amount" + default=None, description="[Read Only] Received document total gross amount" ) amortization: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document amortization value" + default=None, description="Received document amortization value" ) rc_center: Optional[StrictStr] = Field( - None, description="Received document revenue center" + default=None, description="Received document revenue center" ) invoice_number: Optional[StrictStr] = Field( - None, description="Received document invoice number" + default=None, description="Received document invoice number" ) is_marked: Optional[StrictBool] = Field( - None, description="Received document is marked" + default=None, description="Received document is marked" ) is_detailed: Optional[StrictBool] = Field( - None, description="Received document has items" + default=None, description="Received document has items" ) e_invoice: Optional[StrictBool] = Field( - None, description="[Read Only] Received document is an e-invoice" + default=None, description="[Read Only] Received document is an e-invoice" ) next_due_date: Optional[date] = Field( - None, + default=None, description="[Read Only] Received document date of the next not paid payment", ) currency: Optional[Currency] = None tax_deductibility: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document tax deducibility percentage" + default=None, description="Received document tax deducibility percentage" ) vat_deductibility: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document vat deducibility percentage" + default=None, description="Received document vat deducibility percentage" ) - items_list: Optional[conlist(ReceivedDocumentItemsListItem)] = None - payments_list: Optional[conlist(ReceivedDocumentPaymentsListItem)] = None + items_list: Optional[List[ReceivedDocumentItemsListItem]] = None + payments_list: Optional[List[ReceivedDocumentPaymentsListItem]] = None attachment_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Received document url of the attached file", ) attachment_preview_url: Optional[StrictStr] = Field( - None, + default=None, description="[Temporary] [Read Only] Received document url of the attachment preview", ) auto_calculate: Optional[StrictBool] = Field( - None, + default=None, description="Received document total items amount and total payments amount can differ if this field is set to false", ) attachment_token: Optional[StrictStr] = Field( - None, + default=None, description="[Write Only] Received document attachment token returned by POST /received_documents/attachment", ) locked: Optional[StrictBool] = Field( - None, description="Received Document can't be edited" + default=None, description="Received Document can't be edited" ) created_at: Optional[StrictStr] = Field( - None, description="Received document creation date" + default=None, description="Received document creation date" ) updated_at: Optional[StrictStr] = Field( - None, description="Received document last update date" + default=None, description="Received document last update date" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "type", "entity", @@ -163,28 +161,37 @@ class ReceivedDocument(BaseModel): "updated_at", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocument: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocument from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "amount_gross", @@ -217,75 +224,41 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocument: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocument from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocument.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocument.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, + "id": obj.get("id"), "type": obj.get("type"), "entity": Entity.from_dict(obj.get("entity")) if obj.get("entity") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - "amount_withholding_tax": float(obj.get("amount_withholding_tax")) - if obj.get("amount_withholding_tax") is not None - else None, - "amount_other_withholding_tax": float( - obj.get("amount_other_withholding_tax") - ) - if obj.get("amount_other_withholding_tax") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "amortization": float(obj.get("amortization")) - if obj.get("amortization") is not None - else None, - "rc_center": obj.get("rc_center") - if obj.get("rc_center") is not None - else None, - "invoice_number": obj.get("invoice_number") - if obj.get("invoice_number") is not None - else None, - "is_marked": obj.get("is_marked") - if obj.get("is_marked") is not None - else None, - "is_detailed": obj.get("is_detailed") - if obj.get("is_detailed") is not None - else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, - "next_due_date": obj.get("next_due_date") - if obj.get("next_due_date") is not None - else None, + "date": obj.get("date"), + "category": obj.get("category"), + "description": obj.get("description"), + "amount_net": obj.get("amount_net"), + "amount_vat": obj.get("amount_vat"), + "amount_withholding_tax": obj.get("amount_withholding_tax"), + "amount_other_withholding_tax": obj.get("amount_other_withholding_tax"), + "amount_gross": obj.get("amount_gross"), + "amortization": obj.get("amortization"), + "rc_center": obj.get("rc_center"), + "invoice_number": obj.get("invoice_number"), + "is_marked": obj.get("is_marked"), + "is_detailed": obj.get("is_detailed"), + "e_invoice": obj.get("e_invoice"), + "next_due_date": obj.get("next_due_date"), "currency": Currency.from_dict(obj.get("currency")) if obj.get("currency") is not None else None, - "tax_deductibility": float(obj.get("tax_deductibility")) - if obj.get("tax_deductibility") is not None - else None, - "vat_deductibility": float(obj.get("vat_deductibility")) - if obj.get("vat_deductibility") is not None - else None, + "tax_deductibility": obj.get("tax_deductibility"), + "vat_deductibility": obj.get("vat_deductibility"), "items_list": [ ReceivedDocumentItemsListItem.from_dict(_item) for _item in obj.get("items_list") @@ -298,25 +271,13 @@ def from_dict(cls, obj: dict) -> ReceivedDocument: ] if obj.get("payments_list") is not None else None, - "attachment_url": obj.get("attachment_url") - if obj.get("attachment_url") is not None - else None, - "attachment_preview_url": obj.get("attachment_preview_url") - if obj.get("attachment_preview_url") is not None - else None, - "auto_calculate": obj.get("auto_calculate") - if obj.get("auto_calculate") is not None - else None, - "attachment_token": obj.get("attachment_token") - if obj.get("attachment_token") is not None - else None, - "locked": obj.get("locked") if obj.get("locked") is not None else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + "attachment_url": obj.get("attachment_url"), + "attachment_preview_url": obj.get("attachment_preview_url"), + "auto_calculate": obj.get("auto_calculate"), + "attachment_token": obj.get("attachment_token"), + "locked": obj.get("locked"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_info.py b/fattureincloud_python_sdk/models/received_document_info.py index 9f7cb8f5..ddd3297e 100644 --- a/fattureincloud_python_sdk/models/received_document_info.py +++ b/fattureincloud_python_sdk/models/received_document_info.py @@ -19,8 +19,9 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.currency import Currency from fattureincloud_python_sdk.models.payment_account import PaymentAccount from fattureincloud_python_sdk.models.received_document_info_default_values import ( @@ -31,30 +32,35 @@ ) from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocumentInfo(BaseModel): """ ReceivedDocumentInfo - """ + """ # noqa: E501 default_values: Optional[ReceivedDocumentInfoDefaultValues] = None items_default_values: Optional[ReceivedDocumentInfoItemsDefaultValues] = None - countries_list: Optional[conlist(StrictStr)] = Field( - None, description="Countries list" + countries_list: Optional[List[StrictStr]] = Field( + default=None, description="Countries list" ) - currencies_list: Optional[conlist(Currency)] = Field( - None, description="Currencies list" + currencies_list: Optional[List[Currency]] = Field( + default=None, description="Currencies list" ) - categories_list: Optional[conlist(StrictStr)] = Field( - None, description="Categories list" + categories_list: Optional[List[StrictStr]] = Field( + default=None, description="Categories list" ) - payment_accounts_list: Optional[conlist(PaymentAccount)] = Field( - None, description="Payments accounts list" + payment_accounts_list: Optional[List[PaymentAccount]] = Field( + default=None, description="Payments accounts list" ) - vat_types_list: Optional[conlist(VatType)] = Field( - None, description="Vat types list" + vat_types_list: Optional[List[VatType]] = Field( + default=None, description="Vat types list" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "default_values", "items_default_values", "countries_list", @@ -64,28 +70,37 @@ class ReceivedDocumentInfo(BaseModel): "vat_types_list", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentInfo: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of default_values if self.default_values: _dict["default_values"] = self.default_values.to_dict() @@ -116,15 +131,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentInfo: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentInfo from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentInfo.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentInfo.parse_obj( + _obj = cls.model_validate( { "default_values": ReceivedDocumentInfoDefaultValues.from_dict( obj.get("default_values") diff --git a/fattureincloud_python_sdk/models/received_document_info_default_values.py b/fattureincloud_python_sdk/models/received_document_info_default_values.py index 95ef4a9c..c3cbe4e9 100644 --- a/fattureincloud_python_sdk/models/received_document_info_default_values.py +++ b/fattureincloud_python_sdk/models/received_document_info_default_values.py @@ -19,56 +19,64 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocumentInfoDefaultValues(BaseModel): """ - Received document default values # noqa: E501 - """ + Received document default values + """ # noqa: E501 detailed: Optional[StrictBool] = None - __properties = ["detailed"] + __properties: ClassVar[List[str]] = ["detailed"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentInfoDefaultValues: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentInfoDefaultValues from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentInfoDefaultValues: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentInfoDefaultValues from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentInfoDefaultValues.parse_obj(obj) - - _obj = ReceivedDocumentInfoDefaultValues.parse_obj( - { - "detailed": obj.get("detailed") - if obj.get("detailed") is not None - else None - } - ) + return cls.model_validate(obj) + + _obj = cls.model_validate({"detailed": obj.get("detailed")}) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_info_items_default_values.py b/fattureincloud_python_sdk/models/received_document_info_items_default_values.py index 61b3a087..a28acf99 100644 --- a/fattureincloud_python_sdk/models/received_document_info_items_default_values.py +++ b/fattureincloud_python_sdk/models/received_document_info_items_default_values.py @@ -19,54 +19,67 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ReceivedDocumentInfoItemsDefaultValues(BaseModel): """ - Received document items default values # noqa: E501 - """ + Received document items default values + """ # noqa: E501 vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Vat default value" + default=None, description="Vat default value" ) - __properties = ["vat"] + __properties: ClassVar[List[str]] = ["vat"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentInfoItemsDefaultValues: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentInfoItemsDefaultValues from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentInfoItemsDefaultValues: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentInfoItemsDefaultValues from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentInfoItemsDefaultValues.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentInfoItemsDefaultValues.parse_obj( - {"vat": float(obj.get("vat")) if obj.get("vat") is not None else None} - ) + _obj = cls.model_validate({"vat": obj.get("vat")}) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_items_list_item.py b/fattureincloud_python_sdk/models/received_document_items_list_item.py index 3c44b2b8..f0abd03f 100644 --- a/fattureincloud_python_sdk/models/received_document_items_list_item.py +++ b/fattureincloud_python_sdk/models/received_document_items_list_item.py @@ -19,43 +19,52 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.vat_type import VatType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocumentItemsListItem(BaseModel): """ ReceivedDocumentItemsListItem - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Received document item id") + id: Optional[StrictInt] = Field( + default=None, description="Received document item id" + ) product_id: Optional[StrictInt] = Field( - None, description="Received document product id" + default=None, description="Received document product id" ) code: Optional[StrictStr] = Field( - None, description="Received document item product code" + default=None, description="Received document item product code" ) name: Optional[StrictStr] = Field( - None, description="Received document item product name" + default=None, description="Received document item product name" ) measure: Optional[StrictStr] = Field( - None, description="Received document item measure" + default=None, description="Received document item measure" ) net_price: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document item product net price" + default=None, description="Received document item product net price" ) category: Optional[StrictStr] = Field( - None, description="Received document item product category" + default=None, description="Received document item product category" ) qty: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document item quantity" + default=None, description="Received document item quantity" ) vat: Optional[VatType] = None stock: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document item product number of items in stock" + default=None, + description="Received document item product number of items in stock", ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "product_id", "code", @@ -68,66 +77,65 @@ class ReceivedDocumentItemsListItem(BaseModel): "stock", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentItemsListItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentItemsListItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of vat if self.vat: _dict["vat"] = self.vat.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentItemsListItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentItemsListItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentItemsListItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentItemsListItem.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "product_id": obj.get("product_id") - if obj.get("product_id") is not None - else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "measure": obj.get("measure") - if obj.get("measure") is not None - else None, - "net_price": float(obj.get("net_price")) - if obj.get("net_price") is not None - else None, - "category": obj.get("category") - if obj.get("category") is not None - else None, - "qty": float(obj.get("qty")) if obj.get("qty") is not None else None, + "id": obj.get("id"), + "product_id": obj.get("product_id"), + "code": obj.get("code"), + "name": obj.get("name"), + "measure": obj.get("measure"), + "net_price": obj.get("net_price"), + "category": obj.get("category"), + "qty": obj.get("qty"), "vat": VatType.from_dict(obj.get("vat")) if obj.get("vat") is not None else None, - "stock": float(obj.get("stock")) - if obj.get("stock") is not None - else None, + "stock": obj.get("stock"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_payments_list_item.py b/fattureincloud_python_sdk/models/received_document_payments_list_item.py index 66b330cc..cfc08afb 100644 --- a/fattureincloud_python_sdk/models/received_document_payments_list_item.py +++ b/fattureincloud_python_sdk/models/received_document_payments_list_item.py @@ -19,33 +19,41 @@ import json from datetime import date -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.payment_account import PaymentAccount from fattureincloud_python_sdk.models.received_document_payments_list_item_payment_terms import ( ReceivedDocumentPaymentsListItemPaymentTerms, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocumentPaymentsListItem(BaseModel): """ ReceivedDocumentPaymentsListItem - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Received document payment id") + id: Optional[StrictInt] = Field( + default=None, description="Received document payment id" + ) amount: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document payment total amount" + default=None, description="Received document payment total amount" ) - due_date: Optional[date] = Field(None, description="Due date") + due_date: Optional[date] = Field(default=None, description="Due date") paid_date: Optional[date] = Field( - None, description="Received document payment paid date" + default=None, description="Received document payment paid date" ) payment_terms: Optional[ReceivedDocumentPaymentsListItemPaymentTerms] = None status: Optional[StrictStr] = Field( - None, description="Received document payment status" + default=None, description="Received document payment status" ) payment_account: Optional[PaymentAccount] = None - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "amount", "due_date", @@ -55,28 +63,37 @@ class ReceivedDocumentPaymentsListItem(BaseModel): "payment_account", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentPaymentsListItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentPaymentsListItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of payment_terms if self.payment_terms: _dict["payment_terms"] = self.payment_terms.to_dict() @@ -86,32 +103,26 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentPaymentsListItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentPaymentsListItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentPaymentsListItem.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentPaymentsListItem.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "amount": float(obj.get("amount")) - if obj.get("amount") is not None - else None, - "due_date": obj.get("due_date") - if obj.get("due_date") is not None - else None, - "paid_date": obj.get("paid_date") - if obj.get("paid_date") is not None - else None, + "id": obj.get("id"), + "amount": obj.get("amount"), + "due_date": obj.get("due_date"), + "paid_date": obj.get("paid_date"), "payment_terms": ReceivedDocumentPaymentsListItemPaymentTerms.from_dict( obj.get("payment_terms") ) if obj.get("payment_terms") is not None else None, - "status": obj.get("status") if obj.get("status") is not None else None, + "status": obj.get("status"), "payment_account": PaymentAccount.from_dict(obj.get("payment_account")) if obj.get("payment_account") is not None else None, diff --git a/fattureincloud_python_sdk/models/received_document_payments_list_item_payment_terms.py b/fattureincloud_python_sdk/models/received_document_payments_list_item_payment_terms.py index bbfe9a4d..e98773dd 100644 --- a/fattureincloud_python_sdk/models/received_document_payments_list_item_payment_terms.py +++ b/fattureincloud_python_sdk/models/received_document_payments_list_item_payment_terms.py @@ -19,60 +19,70 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt +from pydantic import Field from fattureincloud_python_sdk.models.payment_terms_type import PaymentTermsType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ReceivedDocumentPaymentsListItemPaymentTerms(BaseModel): """ ReceivedDocumentPaymentsListItemPaymentTerms - """ + """ # noqa: E501 days: Optional[StrictInt] = Field( - None, + default=None, description="Received document payment number of days by which the payment must be made", ) type: Optional[PaymentTermsType] = None - __properties = ["days", "type"] + __properties: ClassVar[List[str]] = ["days", "type"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentPaymentsListItemPaymentTerms: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentPaymentsListItemPaymentTerms from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentPaymentsListItemPaymentTerms: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentPaymentsListItemPaymentTerms from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentPaymentsListItemPaymentTerms.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentPaymentsListItemPaymentTerms.parse_obj( - { - "days": obj.get("days") if obj.get("days") is not None else None, - "type": obj.get("type"), - } - ) + _obj = cls.model_validate({"days": obj.get("days"), "type": obj.get("type")}) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_totals.py b/fattureincloud_python_sdk/models/received_document_totals.py index 0eced432..803e245c 100644 --- a/fattureincloud_python_sdk/models/received_document_totals.py +++ b/fattureincloud_python_sdk/models/received_document_totals.py @@ -19,37 +19,43 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ReceivedDocumentTotals(BaseModel): """ ReceivedDocumentTotals - """ + """ # noqa: E501 amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total net amount" + default=None, description="Received document total net amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total vat amount" + default=None, description="Received document total vat amount" ) amount_gross: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total gross amount" + default=None, description="Received document total gross amount" ) amount_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document withholding tax amount" + default=None, description="Received document withholding tax amount" ) amount_other_withholding_tax: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document other withholding tax amount" + default=None, description="Received document other withholding tax amount" ) amount_due: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document total amount due" + default=None, description="Received document total amount due" ) payments_sum: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Received document payments sum" + default=None, description="Received document payments sum" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "amount_net", "amount_vat", "amount_gross", @@ -59,64 +65,57 @@ class ReceivedDocumentTotals(BaseModel): "payments_sum", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentTotals: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentTotals from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> ReceivedDocumentTotals: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ReceivedDocumentTotals from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ReceivedDocumentTotals.parse_obj(obj) + return cls.model_validate(obj) - _obj = ReceivedDocumentTotals.parse_obj( + _obj = cls.model_validate( { - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - "amount_gross": float(obj.get("amount_gross")) - if obj.get("amount_gross") is not None - else None, - "amount_withholding_tax": float(obj.get("amount_withholding_tax")) - if obj.get("amount_withholding_tax") is not None - else None, - "amount_other_withholding_tax": float( - obj.get("amount_other_withholding_tax") - ) - if obj.get("amount_other_withholding_tax") is not None - else None, - "amount_due": float(obj.get("amount_due")) - if obj.get("amount_due") is not None - else None, - "payments_sum": float(obj.get("payments_sum")) - if obj.get("payments_sum") is not None - else None, + "amount_net": obj.get("amount_net"), + "amount_vat": obj.get("amount_vat"), + "amount_gross": obj.get("amount_gross"), + "amount_withholding_tax": obj.get("amount_withholding_tax"), + "amount_other_withholding_tax": obj.get("amount_other_withholding_tax"), + "amount_due": obj.get("amount_due"), + "payments_sum": obj.get("payments_sum"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/received_document_type.py b/fattureincloud_python_sdk/models/received_document_type.py index ff57793b..f5f1fc20 100644 --- a/fattureincloud_python_sdk/models/received_document_type.py +++ b/fattureincloud_python_sdk/models/received_document_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ReceivedDocumentType(str, Enum): @@ -32,6 +39,6 @@ class ReceivedDocumentType(str, Enum): PASSIVE_DELIVERY_NOTE = "passive_delivery_note" @classmethod - def from_json(cls, json_str: str) -> ReceivedDocumentType: + def from_json(cls, json_str: str) -> Self: """Create an instance of ReceivedDocumentType from a JSON string""" - return ReceivedDocumentType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/schedule_email_request.py b/fattureincloud_python_sdk/models/schedule_email_request.py index f563ccee..60a55f02 100644 --- a/fattureincloud_python_sdk/models/schedule_email_request.py +++ b/fattureincloud_python_sdk/models/schedule_email_request.py @@ -19,56 +19,68 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.email_schedule import EmailSchedule +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class ScheduleEmailRequest(BaseModel): - """ - # noqa: E501 - """ + """ """ # noqa: E501 data: Optional[EmailSchedule] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> ScheduleEmailRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of ScheduleEmailRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> ScheduleEmailRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of ScheduleEmailRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return ScheduleEmailRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = ScheduleEmailRequest.parse_obj( + _obj = cls.model_validate( { "data": EmailSchedule.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/send_e_invoice_request.py b/fattureincloud_python_sdk/models/send_e_invoice_request.py index 16ad782b..eafd6543 100644 --- a/fattureincloud_python_sdk/models/send_e_invoice_request.py +++ b/fattureincloud_python_sdk/models/send_e_invoice_request.py @@ -19,7 +19,7 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.send_e_invoice_request_data import ( SendEInvoiceRequestData, @@ -28,38 +28,52 @@ SendEInvoiceRequestOptions, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class SendEInvoiceRequest(BaseModel): """ SendEInvoiceRequest - """ + """ # noqa: E501 data: Optional[SendEInvoiceRequestData] = None options: Optional[SendEInvoiceRequestOptions] = None - __properties = ["data", "options"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "options"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SendEInvoiceRequest: + def from_json(cls, json_str: str) -> Self: """Create an instance of SendEInvoiceRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -69,15 +83,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> SendEInvoiceRequest: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SendEInvoiceRequest from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SendEInvoiceRequest.parse_obj(obj) + return cls.model_validate(obj) - _obj = SendEInvoiceRequest.parse_obj( + _obj = cls.model_validate( { "data": SendEInvoiceRequestData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/send_e_invoice_request_data.py b/fattureincloud_python_sdk/models/send_e_invoice_request_data.py index 6c91bed7..2fc94d3b 100644 --- a/fattureincloud_python_sdk/models/send_e_invoice_request_data.py +++ b/fattureincloud_python_sdk/models/send_e_invoice_request_data.py @@ -19,66 +19,77 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class SendEInvoiceRequestData(BaseModel): """ SendEInvoiceRequestData - """ + """ # noqa: E501 cassa_type: Optional[StrictStr] = Field( - None, + default=None, description="Value of TipoCassa used (optional, override the company default value).", ) withholding_tax_causal: Optional[StrictStr] = Field( - None, + default=None, description="Value of CausalePagamento used (optional, override the company default value).", ) - __properties = ["cassa_type", "withholding_tax_causal"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["cassa_type", "withholding_tax_causal"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SendEInvoiceRequestData: + def from_json(cls, json_str: str) -> Self: """Create an instance of SendEInvoiceRequestData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SendEInvoiceRequestData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SendEInvoiceRequestData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SendEInvoiceRequestData.parse_obj(obj) + return cls.model_validate(obj) - _obj = SendEInvoiceRequestData.parse_obj( + _obj = cls.model_validate( { - "cassa_type": obj.get("cassa_type") - if obj.get("cassa_type") is not None - else None, - "withholding_tax_causal": obj.get("withholding_tax_causal") - if obj.get("withholding_tax_causal") is not None - else None, + "cassa_type": obj.get("cassa_type"), + "withholding_tax_causal": obj.get("withholding_tax_causal"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/send_e_invoice_request_options.py b/fattureincloud_python_sdk/models/send_e_invoice_request_options.py index eaf895b4..b67f2c52 100644 --- a/fattureincloud_python_sdk/models/send_e_invoice_request_options.py +++ b/fattureincloud_python_sdk/models/send_e_invoice_request_options.py @@ -19,54 +19,68 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class SendEInvoiceRequestOptions(BaseModel): """ SendEInvoiceRequestOptions - """ + """ # noqa: E501 dry_run: Optional[StrictBool] = Field( - None, description="If set to true the e-invoice will not be sent to the SDI." + default=None, + description="If set to true the e-invoice will not be sent to the SDI.", ) - __properties = ["dry_run"] + __properties: ClassVar[List[str]] = ["dry_run"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SendEInvoiceRequestOptions: + def from_json(cls, json_str: str) -> Self: """Create an instance of SendEInvoiceRequestOptions from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SendEInvoiceRequestOptions: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SendEInvoiceRequestOptions from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SendEInvoiceRequestOptions.parse_obj(obj) + return cls.model_validate(obj) - _obj = SendEInvoiceRequestOptions.parse_obj( - {"dry_run": obj.get("dry_run") if obj.get("dry_run") is not None else None} - ) + _obj = cls.model_validate({"dry_run": obj.get("dry_run")}) return _obj diff --git a/fattureincloud_python_sdk/models/send_e_invoice_response.py b/fattureincloud_python_sdk/models/send_e_invoice_response.py index 559e353a..580a8933 100644 --- a/fattureincloud_python_sdk/models/send_e_invoice_response.py +++ b/fattureincloud_python_sdk/models/send_e_invoice_response.py @@ -19,58 +19,72 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.send_e_invoice_response_data import ( SendEInvoiceResponseData, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class SendEInvoiceResponse(BaseModel): """ SendEInvoiceResponse - """ + """ # noqa: E501 data: Optional[SendEInvoiceResponseData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SendEInvoiceResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of SendEInvoiceResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> SendEInvoiceResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SendEInvoiceResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SendEInvoiceResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = SendEInvoiceResponse.parse_obj( + _obj = cls.model_validate( { "data": SendEInvoiceResponseData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/send_e_invoice_response_data.py b/fattureincloud_python_sdk/models/send_e_invoice_response_data.py index 269de3ac..bcb5dd9a 100644 --- a/fattureincloud_python_sdk/models/send_e_invoice_response_data.py +++ b/fattureincloud_python_sdk/models/send_e_invoice_response_data.py @@ -19,58 +19,68 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class SendEInvoiceResponseData(BaseModel): """ SendEInvoiceResponseData - """ + """ # noqa: E501 - name: Optional[StrictStr] = Field(None, description="Response message.") + name: Optional[StrictStr] = Field(default=None, description="Response message.") var_date: Optional[StrictStr] = Field( - None, alias="date", description="E-invoice sent date." + default=None, description="E-invoice sent date.", alias="date" ) - __properties = ["name", "date"] + __properties: ClassVar[List[str]] = ["name", "date"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SendEInvoiceResponseData: + def from_json(cls, json_str: str) -> Self: """Create an instance of SendEInvoiceResponseData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SendEInvoiceResponseData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SendEInvoiceResponseData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SendEInvoiceResponseData.parse_obj(obj) + return cls.model_validate(obj) - _obj = SendEInvoiceResponseData.parse_obj( - { - "name": obj.get("name") if obj.get("name") is not None else None, - "var_date": obj.get("date") if obj.get("date") is not None else None, - } - ) + _obj = cls.model_validate({"name": obj.get("name"), "date": obj.get("date")}) return _obj diff --git a/fattureincloud_python_sdk/models/sender_email.py b/fattureincloud_python_sdk/models/sender_email.py index e66cd8ed..f6a4720a 100644 --- a/fattureincloud_python_sdk/models/sender_email.py +++ b/fattureincloud_python_sdk/models/sender_email.py @@ -19,56 +19,66 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class SenderEmail(BaseModel): """ SenderEmail - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Sender email id") - email: Optional[StrictStr] = Field(None, description="Sender email address") - __properties = ["id", "email"] + id: Optional[StrictInt] = Field(default=None, description="Sender email id") + email: Optional[StrictStr] = Field(default=None, description="Sender email address") + __properties: ClassVar[List[str]] = ["id", "email"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> SenderEmail: + def from_json(cls, json_str: str) -> Self: """Create an instance of SenderEmail from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> SenderEmail: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of SenderEmail from a dict""" if obj is None: return None if not isinstance(obj, dict): - return SenderEmail.parse_obj(obj) + return cls.model_validate(obj) - _obj = SenderEmail.parse_obj( - { - "id": obj.get("id") if obj.get("id") is not None else None, - "email": obj.get("email") if obj.get("email") is not None else None, - } - ) + _obj = cls.model_validate({"id": obj.get("id"), "email": obj.get("email")}) return _obj diff --git a/fattureincloud_python_sdk/models/show_totals_mode.py b/fattureincloud_python_sdk/models/show_totals_mode.py index 9488a8b7..64aedfcf 100644 --- a/fattureincloud_python_sdk/models/show_totals_mode.py +++ b/fattureincloud_python_sdk/models/show_totals_mode.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class ShowTotalsMode(str, Enum): @@ -32,6 +39,6 @@ class ShowTotalsMode(str, Enum): ALL = "all" @classmethod - def from_json(cls, json_str: str) -> ShowTotalsMode: + def from_json(cls, json_str: str) -> Self: """Create an instance of ShowTotalsMode from a JSON string""" - return ShowTotalsMode(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/supplier.py b/fattureincloud_python_sdk/models/supplier.py index 7bf7b607..a74715cc 100644 --- a/fattureincloud_python_sdk/models/supplier.py +++ b/fattureincloud_python_sdk/models/supplier.py @@ -19,55 +19,73 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.supplier_type import SupplierType +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class Supplier(BaseModel): """ Supplier - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Supplier id") - code: Optional[StrictStr] = Field(None, description="Supplier code") - name: Optional[StrictStr] = Field(None, description="Supplier name") + id: Optional[StrictInt] = Field(default=None, description="Supplier id") + code: Optional[StrictStr] = Field(default=None, description="Supplier code") + name: Optional[StrictStr] = Field(default=None, description="Supplier name") type: Optional[SupplierType] = None - first_name: Optional[StrictStr] = Field(None, description="Supplier first name") - last_name: Optional[StrictStr] = Field(None, description="Supplier last name") + first_name: Optional[StrictStr] = Field( + default=None, description="Supplier first name" + ) + last_name: Optional[StrictStr] = Field( + default=None, description="Supplier last name" + ) contact_person: Optional[StrictStr] = Field( - None, description="Supplier contact person" + default=None, description="Supplier contact person" + ) + vat_number: Optional[StrictStr] = Field( + default=None, description="Supplier vat number" ) - vat_number: Optional[StrictStr] = Field(None, description="Supplier vat number") - tax_code: Optional[StrictStr] = Field(None, description="Supplier tax code") + tax_code: Optional[StrictStr] = Field(default=None, description="Supplier tax code") address_street: Optional[StrictStr] = Field( - None, description="Supplier street address" + default=None, description="Supplier street address" ) address_postal_code: Optional[StrictStr] = Field( - None, description="Supplier postal code" + default=None, description="Supplier postal code" + ) + address_city: Optional[StrictStr] = Field(default=None, description="Supplier city") + address_province: Optional[StrictStr] = Field( + default=None, description="Supplier province" ) - address_city: Optional[StrictStr] = Field(None, description="Supplier city") - address_province: Optional[StrictStr] = Field(None, description="Supplier province") address_extra: Optional[StrictStr] = Field( - None, description="Supplier address extra info" + default=None, description="Supplier address extra info" ) - country: Optional[StrictStr] = Field(None, description="Supplier country") + country: Optional[StrictStr] = Field(default=None, description="Supplier country") country_iso: Optional[StrictStr] = Field( - None, description="Supplier country iso code" + default=None, description="Supplier country iso code" ) - email: Optional[StrictStr] = Field(None, description="Supplier email") + email: Optional[StrictStr] = Field(default=None, description="Supplier email") certified_email: Optional[StrictStr] = Field( - None, description="Supplier certified email" + default=None, description="Supplier certified email" + ) + phone: Optional[StrictStr] = Field(default=None, description="Supplier phone") + fax: Optional[StrictStr] = Field(default=None, description="Supplier fax") + notes: Optional[StrictStr] = Field(default=None, description="Supplier extra notes") + bank_iban: Optional[StrictStr] = Field( + default=None, description="Supplier bank IBAN" + ) + created_at: Optional[StrictStr] = Field( + default=None, description="Supplier creation date" ) - phone: Optional[StrictStr] = Field(None, description="Supplier phone") - fax: Optional[StrictStr] = Field(None, description="Supplier fax") - notes: Optional[StrictStr] = Field(None, description="Supplier extra notes") - bank_iban: Optional[StrictStr] = Field(None, description="Supplier bank IBAN") - created_at: Optional[StrictStr] = Field(None, description="Supplier creation date") updated_at: Optional[StrictStr] = Field( - None, description="Supplier last update date" + default=None, description="Supplier last update date" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "code", "name", @@ -94,97 +112,74 @@ class Supplier(BaseModel): "updated_at", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Supplier: + def from_json(cls, json_str: str) -> Self: """Create an instance of Supplier from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> Supplier: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of Supplier from a dict""" if obj is None: return None if not isinstance(obj, dict): - return Supplier.parse_obj(obj) + return cls.model_validate(obj) - _obj = Supplier.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "code": obj.get("code") if obj.get("code") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, + "id": obj.get("id"), + "code": obj.get("code"), + "name": obj.get("name"), "type": obj.get("type"), - "first_name": obj.get("first_name") - if obj.get("first_name") is not None - else None, - "last_name": obj.get("last_name") - if obj.get("last_name") is not None - else None, - "contact_person": obj.get("contact_person") - if obj.get("contact_person") is not None - else None, - "vat_number": obj.get("vat_number") - if obj.get("vat_number") is not None - else None, - "tax_code": obj.get("tax_code") - if obj.get("tax_code") is not None - else None, - "address_street": obj.get("address_street") - if obj.get("address_street") is not None - else None, - "address_postal_code": obj.get("address_postal_code") - if obj.get("address_postal_code") is not None - else None, - "address_city": obj.get("address_city") - if obj.get("address_city") is not None - else None, - "address_province": obj.get("address_province") - if obj.get("address_province") is not None - else None, - "address_extra": obj.get("address_extra") - if obj.get("address_extra") is not None - else None, - "country": obj.get("country") - if obj.get("country") is not None - else None, - "country_iso": obj.get("country_iso") - if obj.get("country_iso") is not None - else None, - "email": obj.get("email") if obj.get("email") is not None else None, - "certified_email": obj.get("certified_email") - if obj.get("certified_email") is not None - else None, - "phone": obj.get("phone") if obj.get("phone") is not None else None, - "fax": obj.get("fax") if obj.get("fax") is not None else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "bank_iban": obj.get("bank_iban") - if obj.get("bank_iban") is not None - else None, - "created_at": obj.get("created_at") - if obj.get("created_at") is not None - else None, - "updated_at": obj.get("updated_at") - if obj.get("updated_at") is not None - else None, + "first_name": obj.get("first_name"), + "last_name": obj.get("last_name"), + "contact_person": obj.get("contact_person"), + "vat_number": obj.get("vat_number"), + "tax_code": obj.get("tax_code"), + "address_street": obj.get("address_street"), + "address_postal_code": obj.get("address_postal_code"), + "address_city": obj.get("address_city"), + "address_province": obj.get("address_province"), + "address_extra": obj.get("address_extra"), + "country": obj.get("country"), + "country_iso": obj.get("country_iso"), + "email": obj.get("email"), + "certified_email": obj.get("certified_email"), + "phone": obj.get("phone"), + "fax": obj.get("fax"), + "notes": obj.get("notes"), + "bank_iban": obj.get("bank_iban"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/supplier_type.py b/fattureincloud_python_sdk/models/supplier_type.py index 8338fa1a..9069fed4 100644 --- a/fattureincloud_python_sdk/models/supplier_type.py +++ b/fattureincloud_python_sdk/models/supplier_type.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class SupplierType(str, Enum): @@ -33,6 +40,6 @@ class SupplierType(str, Enum): CONDO = "condo" @classmethod - def from_json(cls, json_str: str) -> SupplierType: + def from_json(cls, json_str: str) -> Self: """Create an instance of SupplierType from a JSON string""" - return SupplierType(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/transform_issued_document_response.py b/fattureincloud_python_sdk/models/transform_issued_document_response.py index 221182f6..e0d419ea 100644 --- a/fattureincloud_python_sdk/models/transform_issued_document_response.py +++ b/fattureincloud_python_sdk/models/transform_issued_document_response.py @@ -19,45 +19,59 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.issued_document import IssuedDocument from fattureincloud_python_sdk.models.issued_document_options import ( IssuedDocumentOptions, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class TransformIssuedDocumentResponse(BaseModel): """ TransformIssuedDocumentResponse - """ + """ # noqa: E501 data: Optional[IssuedDocument] = None options: Optional[IssuedDocumentOptions] = None - __properties = ["data", "options"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data", "options"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> TransformIssuedDocumentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of TransformIssuedDocumentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() @@ -67,15 +81,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> TransformIssuedDocumentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of TransformIssuedDocumentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return TransformIssuedDocumentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = TransformIssuedDocumentResponse.parse_obj( + _obj = cls.model_validate( { "data": IssuedDocument.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/upload_archive_attachment_response.py b/fattureincloud_python_sdk/models/upload_archive_attachment_response.py index 909e92a9..38540b9f 100644 --- a/fattureincloud_python_sdk/models/upload_archive_attachment_response.py +++ b/fattureincloud_python_sdk/models/upload_archive_attachment_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.attachment_data import AttachmentData +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class UploadArchiveAttachmentResponse(BaseModel): """ UploadArchiveAttachmentResponse - """ + """ # noqa: E501 data: Optional[AttachmentData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> UploadArchiveAttachmentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of UploadArchiveAttachmentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> UploadArchiveAttachmentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of UploadArchiveAttachmentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UploadArchiveAttachmentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = UploadArchiveAttachmentResponse.parse_obj( + _obj = cls.model_validate( { "data": AttachmentData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/upload_f24_attachment_response.py b/fattureincloud_python_sdk/models/upload_f24_attachment_response.py index afa40bad..cb6c5e4a 100644 --- a/fattureincloud_python_sdk/models/upload_f24_attachment_response.py +++ b/fattureincloud_python_sdk/models/upload_f24_attachment_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.attachment_data import AttachmentData +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class UploadF24AttachmentResponse(BaseModel): """ UploadF24AttachmentResponse - """ + """ # noqa: E501 data: Optional[AttachmentData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> UploadF24AttachmentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of UploadF24AttachmentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> UploadF24AttachmentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of UploadF24AttachmentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UploadF24AttachmentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = UploadF24AttachmentResponse.parse_obj( + _obj = cls.model_validate( { "data": AttachmentData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/upload_issued_document_attachment_response.py b/fattureincloud_python_sdk/models/upload_issued_document_attachment_response.py index bf46ee54..463cb62e 100644 --- a/fattureincloud_python_sdk/models/upload_issued_document_attachment_response.py +++ b/fattureincloud_python_sdk/models/upload_issued_document_attachment_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.attachment_data import AttachmentData +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class UploadIssuedDocumentAttachmentResponse(BaseModel): """ UploadIssuedDocumentAttachmentResponse - """ + """ # noqa: E501 data: Optional[AttachmentData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> UploadIssuedDocumentAttachmentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of UploadIssuedDocumentAttachmentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> UploadIssuedDocumentAttachmentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of UploadIssuedDocumentAttachmentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UploadIssuedDocumentAttachmentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = UploadIssuedDocumentAttachmentResponse.parse_obj( + _obj = cls.model_validate( { "data": AttachmentData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/upload_received_document_attachment_response.py b/fattureincloud_python_sdk/models/upload_received_document_attachment_response.py index f6bca10f..bd6b9b8f 100644 --- a/fattureincloud_python_sdk/models/upload_received_document_attachment_response.py +++ b/fattureincloud_python_sdk/models/upload_received_document_attachment_response.py @@ -19,56 +19,70 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.attachment_data import AttachmentData +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class UploadReceivedDocumentAttachmentResponse(BaseModel): """ UploadReceivedDocumentAttachmentResponse - """ + """ # noqa: E501 data: Optional[AttachmentData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> UploadReceivedDocumentAttachmentResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of UploadReceivedDocumentAttachmentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> UploadReceivedDocumentAttachmentResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of UploadReceivedDocumentAttachmentResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return UploadReceivedDocumentAttachmentResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = UploadReceivedDocumentAttachmentResponse.parse_obj( + _obj = cls.model_validate( { "data": AttachmentData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/user.py b/fattureincloud_python_sdk/models/user.py index af9eeb8d..6264bc36 100644 --- a/fattureincloud_python_sdk/models/user.py +++ b/fattureincloud_python_sdk/models/user.py @@ -19,72 +19,89 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class User(BaseModel): """ User - """ - - id: Optional[StrictInt] = Field(None, description="User id") - name: Optional[StrictStr] = Field(None, description="User full name") - first_name: Optional[StrictStr] = Field(None, description="User first name") - last_name: Optional[StrictStr] = Field(None, description="User last name") - email: Optional[StrictStr] = Field(None, description="User email address") - hash: Optional[StrictStr] = Field(None, description="User hash") - picture: Optional[StrictStr] = Field(None, description="User picture") - __properties = ["id", "name", "first_name", "last_name", "email", "hash", "picture"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + """ # noqa: E501 + + id: Optional[StrictInt] = Field(default=None, description="User id") + name: Optional[StrictStr] = Field(default=None, description="User full name") + first_name: Optional[StrictStr] = Field(default=None, description="User first name") + last_name: Optional[StrictStr] = Field(default=None, description="User last name") + email: Optional[StrictStr] = Field(default=None, description="User email address") + hash: Optional[StrictStr] = Field(default=None, description="User hash") + picture: Optional[StrictStr] = Field(default=None, description="User picture") + __properties: ClassVar[List[str]] = [ + "id", + "name", + "first_name", + "last_name", + "email", + "hash", + "picture", + ] + + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> User: + def from_json(cls, json_str: str) -> Self: """Create an instance of User from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> User: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of User from a dict""" if obj is None: return None if not isinstance(obj, dict): - return User.parse_obj(obj) + return cls.model_validate(obj) - _obj = User.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "name": obj.get("name") if obj.get("name") is not None else None, - "first_name": obj.get("first_name") - if obj.get("first_name") is not None - else None, - "last_name": obj.get("last_name") - if obj.get("last_name") is not None - else None, - "email": obj.get("email") if obj.get("email") is not None else None, - "hash": obj.get("hash") if obj.get("hash") is not None else None, - "picture": obj.get("picture") - if obj.get("picture") is not None - else None, + "id": obj.get("id"), + "name": obj.get("name"), + "first_name": obj.get("first_name"), + "last_name": obj.get("last_name"), + "email": obj.get("email"), + "hash": obj.get("hash"), + "picture": obj.get("picture"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/user_company_role.py b/fattureincloud_python_sdk/models/user_company_role.py index b3c73c13..30481526 100644 --- a/fattureincloud_python_sdk/models/user_company_role.py +++ b/fattureincloud_python_sdk/models/user_company_role.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class UserCompanyRole(str, Enum): @@ -32,6 +39,6 @@ class UserCompanyRole(str, Enum): EMPLOYEE = "employee" @classmethod - def from_json(cls, json_str: str) -> UserCompanyRole: + def from_json(cls, json_str: str) -> Self: """Create an instance of UserCompanyRole from a JSON string""" - return UserCompanyRole(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/vat_item.py b/fattureincloud_python_sdk/models/vat_item.py index e05d1492..5c720b3f 100644 --- a/fattureincloud_python_sdk/models/vat_item.py +++ b/fattureincloud_python_sdk/models/vat_item.py @@ -19,64 +19,72 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VatItem(BaseModel): """ VatItem - """ + """ # noqa: E501 amount_net: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Vat item net amount" + default=None, description="Vat item net amount" ) amount_vat: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="Vat item vat amount" + default=None, description="Vat item vat amount" ) - __properties = ["amount_net", "amount_vat"] + __properties: ClassVar[List[str]] = ["amount_net", "amount_vat"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VatItem: + def from_json(cls, json_str: str) -> Self: """Create an instance of VatItem from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VatItem: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VatItem from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VatItem.parse_obj(obj) - - _obj = VatItem.parse_obj( - { - "amount_net": float(obj.get("amount_net")) - if obj.get("amount_net") is not None - else None, - "amount_vat": float(obj.get("amount_vat")) - if obj.get("amount_vat") is not None - else None, - } + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"amount_net": obj.get("amount_net"), "amount_vat": obj.get("amount_vat")} ) return _obj diff --git a/fattureincloud_python_sdk/models/vat_kind.py b/fattureincloud_python_sdk/models/vat_kind.py index cc761667..ad450ca9 100644 --- a/fattureincloud_python_sdk/models/vat_kind.py +++ b/fattureincloud_python_sdk/models/vat_kind.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VatKind(str, Enum): @@ -33,6 +40,6 @@ class VatKind(str, Enum): S = "S" @classmethod - def from_json(cls, json_str: str) -> VatKind: + def from_json(cls, json_str: str) -> Self: """Create an instance of VatKind from a JSON string""" - return VatKind(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/models/vat_type.py b/fattureincloud_python_sdk/models/vat_type.py index c5c1d372..3a55f3ac 100644 --- a/fattureincloud_python_sdk/models/vat_type.py +++ b/fattureincloud_python_sdk/models/vat_type.py @@ -19,41 +19,47 @@ import json -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VatType(BaseModel): """ VatType - """ + """ # noqa: E501 - id: Optional[StrictInt] = Field(None, description="Vat type id") + id: Optional[StrictInt] = Field(default=None, description="Vat type id") value: Optional[Union[StrictFloat, StrictInt]] = Field( - None, description="[Read Only] Vat type percentual value" + default=None, description="[Read Only] Vat type percentual value" ) description: Optional[StrictStr] = Field( - None, description="Vat type short description" + default=None, description="Vat type short description" ) notes: Optional[StrictStr] = Field( - None, description="Vat type notes shown in documents" + default=None, description="Vat type notes shown in documents" ) e_invoice: Optional[StrictBool] = Field( - None, description="Vat type is usable for e-invoices" + default=None, description="Vat type is usable for e-invoices" ) ei_type: Optional[StrictStr] = Field( - None, description="Vat type e-invoice type (natura)" + default=None, description="Vat type e-invoice type (natura)" ) ei_description: Optional[StrictStr] = Field( - None, description="Vat type e-invoice description" + default=None, description="Vat type e-invoice description" ) editable: Optional[StrictBool] = Field( - None, description="[Read Only] Is the vat type is editable." + default=None, description="[Read Only] Is the vat type is editable." ) is_disabled: Optional[StrictBool] = Field( - None, description="Is the vat type disabled" + default=None, description="Is the vat type disabled" ) - __properties = [ + __properties: ClassVar[List[str]] = [ "id", "value", "description", @@ -65,28 +71,34 @@ class VatType(BaseModel): "is_disabled", ] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VatType: + def from_json(cls, json_str: str) -> Self: """Create an instance of VatType from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict( + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + _dict = self.model_dump( by_alias=True, exclude={ "editable", @@ -96,39 +108,25 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VatType: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VatType from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VatType.parse_obj(obj) + return cls.model_validate(obj) - _obj = VatType.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "value": float(obj.get("value")) - if obj.get("value") is not None - else None, - "description": obj.get("description") - if obj.get("description") is not None - else None, - "notes": obj.get("notes") if obj.get("notes") is not None else None, - "e_invoice": obj.get("e_invoice") - if obj.get("e_invoice") is not None - else None, - "ei_type": obj.get("ei_type") - if obj.get("ei_type") is not None - else None, - "ei_description": obj.get("ei_description") - if obj.get("ei_description") is not None - else None, - "editable": obj.get("editable") - if obj.get("editable") is not None - else None, - "is_disabled": obj.get("is_disabled") - if obj.get("is_disabled") is not None - else None, + "id": obj.get("id"), + "value": obj.get("value"), + "description": obj.get("description"), + "notes": obj.get("notes"), + "e_invoice": obj.get("e_invoice"), + "ei_type": obj.get("ei_type"), + "ei_description": obj.get("ei_description"), + "editable": obj.get("editable"), + "is_disabled": obj.get("is_disabled"), } ) return _obj diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response.py index 6e896bcc..c2b94bc4 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response.py @@ -19,7 +19,7 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.verify_e_invoice_xml_error_response_error import ( VerifyEInvoiceXmlErrorResponseError, @@ -28,38 +28,52 @@ VerifyEInvoiceXmlErrorResponseExtra, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class VerifyEInvoiceXmlErrorResponse(BaseModel): """ VerifyEInvoiceXmlErrorResponse - """ + """ # noqa: E501 error: Optional[VerifyEInvoiceXmlErrorResponseError] = None extra: Optional[VerifyEInvoiceXmlErrorResponseExtra] = None - __properties = ["error", "extra"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["error", "extra"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VerifyEInvoiceXmlErrorResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of error if self.error: _dict["error"] = self.error.to_dict() @@ -69,15 +83,15 @@ def to_dict(self): return _dict @classmethod - def from_dict(cls, obj: dict) -> VerifyEInvoiceXmlErrorResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlErrorResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlErrorResponse.parse_obj( + _obj = cls.model_validate( { "error": VerifyEInvoiceXmlErrorResponseError.from_dict(obj.get("error")) if obj.get("error") is not None diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error.py index 06949a9b..2cf5a686 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error.py @@ -19,65 +19,77 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from fattureincloud_python_sdk.models.verify_e_invoice_xml_error_response_error_validation_result import ( VerifyEInvoiceXmlErrorResponseErrorValidationResult, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class VerifyEInvoiceXmlErrorResponseError(BaseModel): """ VerifyEInvoiceXmlErrorResponseError - """ + """ # noqa: E501 message: Optional[StrictStr] = None validation_result: Optional[ VerifyEInvoiceXmlErrorResponseErrorValidationResult ] = None - __properties = ["message", "validation_result"] + __properties: ClassVar[List[str]] = ["message", "validation_result"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VerifyEInvoiceXmlErrorResponseError: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseError from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of validation_result if self.validation_result: _dict["validation_result"] = self.validation_result.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> VerifyEInvoiceXmlErrorResponseError: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseError from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlErrorResponseError.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlErrorResponseError.parse_obj( + _obj = cls.model_validate( { - "message": obj.get("message") - if obj.get("message") is not None - else None, + "message": obj.get("message"), "validation_result": VerifyEInvoiceXmlErrorResponseErrorValidationResult.from_dict( obj.get("validation_result") ) diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error_validation_result.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error_validation_result.py index 99d25cbe..3e8a03ea 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error_validation_result.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_error_validation_result.py @@ -19,56 +19,64 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VerifyEInvoiceXmlErrorResponseErrorValidationResult(BaseModel): """ VerifyEInvoiceXmlErrorResponseErrorValidationResult - """ + """ # noqa: E501 - xml_errors: Optional[conlist(StrictStr)] = None - __properties = ["xml_errors"] + xml_errors: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["xml_errors"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json( - cls, json_str: str - ) -> VerifyEInvoiceXmlErrorResponseErrorValidationResult: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseErrorValidationResult from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict( - cls, obj: dict - ) -> VerifyEInvoiceXmlErrorResponseErrorValidationResult: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseErrorValidationResult from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlErrorResponseErrorValidationResult.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlErrorResponseErrorValidationResult.parse_obj( - {"xml_errors": obj.get("xml_errors")} - ) + _obj = cls.model_validate({"xml_errors": obj.get("xml_errors")}) return _obj diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_extra.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_extra.py index 029e1df7..f14cb325 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_extra.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_error_response_extra.py @@ -19,52 +19,64 @@ import json -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VerifyEInvoiceXmlErrorResponseExtra(BaseModel): """ VerifyEInvoiceXmlErrorResponseExtra - """ + """ # noqa: E501 - errors: Optional[conlist(StrictStr)] = None - __properties = ["errors"] + errors: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["errors"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VerifyEInvoiceXmlErrorResponseExtra: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseExtra from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VerifyEInvoiceXmlErrorResponseExtra: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlErrorResponseExtra from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlErrorResponseExtra.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlErrorResponseExtra.parse_obj( - {"errors": obj.get("errors")} - ) + _obj = cls.model_validate({"errors": obj.get("errors")}) return _obj diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_response.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_response.py index 328d1c78..5bab02fc 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_response.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_response.py @@ -19,58 +19,72 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.verify_e_invoice_xml_response_data import ( VerifyEInvoiceXmlResponseData, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class VerifyEInvoiceXmlResponse(BaseModel): """ VerifyEInvoiceXmlResponse - """ + """ # noqa: E501 data: Optional[VerifyEInvoiceXmlResponseData] = None - __properties = ["data"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["data"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VerifyEInvoiceXmlResponse: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of data if self.data: _dict["data"] = self.data.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> VerifyEInvoiceXmlResponse: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlResponse from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlResponse.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlResponse.parse_obj( + _obj = cls.model_validate( { "data": VerifyEInvoiceXmlResponseData.from_dict(obj.get("data")) if obj.get("data") is not None diff --git a/fattureincloud_python_sdk/models/verify_e_invoice_xml_response_data.py b/fattureincloud_python_sdk/models/verify_e_invoice_xml_response_data.py index 02599d30..5adcde43 100644 --- a/fattureincloud_python_sdk/models/verify_e_invoice_xml_response_data.py +++ b/fattureincloud_python_sdk/models/verify_e_invoice_xml_response_data.py @@ -19,54 +19,67 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool +from pydantic import Field + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class VerifyEInvoiceXmlResponseData(BaseModel): """ VerifyEInvoiceXmlResponseData - """ + """ # noqa: E501 success: Optional[StrictBool] = Field( - None, description="Determine if the invoice XML is valid." + default=None, description="Determine if the invoice XML is valid." ) - __properties = ["success"] + __properties: ClassVar[List[str]] = ["success"] - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> VerifyEInvoiceXmlResponseData: + def from_json(cls, json_str: str) -> Self: """Create an instance of VerifyEInvoiceXmlResponseData from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> VerifyEInvoiceXmlResponseData: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of VerifyEInvoiceXmlResponseData from a dict""" if obj is None: return None if not isinstance(obj, dict): - return VerifyEInvoiceXmlResponseData.parse_obj(obj) + return cls.model_validate(obj) - _obj = VerifyEInvoiceXmlResponseData.parse_obj( - {"success": obj.get("success") if obj.get("success") is not None else None} - ) + _obj = cls.model_validate({"success": obj.get("success")}) return _obj diff --git a/fattureincloud_python_sdk/models/webhooks_subscription.py b/fattureincloud_python_sdk/models/webhooks_subscription.py index b0c65149..7aefa6b3 100644 --- a/fattureincloud_python_sdk/models/webhooks_subscription.py +++ b/fattureincloud_python_sdk/models/webhooks_subscription.py @@ -19,74 +19,91 @@ import json -from typing import List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictStr +from pydantic import Field from fattureincloud_python_sdk.models.event_type import EventType from fattureincloud_python_sdk.models.webhooks_subscription_config import ( WebhooksSubscriptionConfig, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class WebhooksSubscription(BaseModel): """ WebhooksSubscription - """ + """ # noqa: E501 - id: Optional[StrictStr] = Field(None, description="Webhooks subscription id") - sink: Optional[StrictStr] = Field(None, description="Webhooks callback uri.") + id: Optional[StrictStr] = Field( + default=None, description="Webhooks subscription id" + ) + sink: Optional[StrictStr] = Field( + default=None, description="Webhooks callback uri." + ) verified: Optional[StrictBool] = Field( - None, + default=None, description="[Read Only] True if the webhooks subscription has been verified.", ) - types: Optional[conlist(EventType)] = Field( - None, description="Webhooks events types." + types: Optional[List[EventType]] = Field( + default=None, description="Webhooks events types." ) config: Optional[WebhooksSubscriptionConfig] = None - __properties = ["id", "sink", "verified", "types", "config"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["id", "sink", "verified", "types", "config"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebhooksSubscription: + def from_json(cls, json_str: str) -> Self: """Create an instance of WebhooksSubscription from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) # override the default output from pydantic by calling `to_dict()` of config if self.config: _dict["config"] = self.config.to_dict() return _dict @classmethod - def from_dict(cls, obj: dict) -> WebhooksSubscription: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of WebhooksSubscription from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebhooksSubscription.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebhooksSubscription.parse_obj( + _obj = cls.model_validate( { - "id": obj.get("id") if obj.get("id") is not None else None, - "sink": obj.get("sink") if obj.get("sink") is not None else None, - "verified": obj.get("verified") - if obj.get("verified") is not None - else None, + "id": obj.get("id"), + "sink": obj.get("sink"), + "verified": obj.get("verified"), "types": obj.get("types"), "config": WebhooksSubscriptionConfig.from_dict(obj.get("config")) if obj.get("config") is not None diff --git a/fattureincloud_python_sdk/models/webhooks_subscription_config.py b/fattureincloud_python_sdk/models/webhooks_subscription_config.py index 1ce6de25..83a1f448 100644 --- a/fattureincloud_python_sdk/models/webhooks_subscription_config.py +++ b/fattureincloud_python_sdk/models/webhooks_subscription_config.py @@ -19,53 +19,67 @@ import json -from typing import Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from fattureincloud_python_sdk.models.webhooks_subscription_mapping import ( WebhooksSubscriptionMapping, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self + class WebhooksSubscriptionConfig(BaseModel): """ WebhooksSubscriptionConfig - """ + """ # noqa: E501 mapping: Optional[WebhooksSubscriptionMapping] = None - __properties = ["mapping"] - - class Config: - """Pydantic configuration""" + __properties: ClassVar[List[str]] = ["mapping"] - allow_population_by_field_name = True - validate_assignment = True + model_config = {"populate_by_name": True, "validate_assignment": True} def to_str(self) -> str: """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) + return pprint.pformat(self.model_dump(by_alias=True)) def to_json(self) -> str: """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> WebhooksSubscriptionConfig: + def from_json(cls, json_str: str) -> Self: """Create an instance of WebhooksSubscriptionConfig from a JSON string""" return cls.from_dict(json.loads(json_str)) - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) return _dict @classmethod - def from_dict(cls, obj: dict) -> WebhooksSubscriptionConfig: + def from_dict(cls, obj: Dict) -> Self: """Create an instance of WebhooksSubscriptionConfig from a dict""" if obj is None: return None if not isinstance(obj, dict): - return WebhooksSubscriptionConfig.parse_obj(obj) + return cls.model_validate(obj) - _obj = WebhooksSubscriptionConfig.parse_obj({"mapping": obj.get("mapping")}) + _obj = cls.model_validate({"mapping": obj.get("mapping")}) return _obj diff --git a/fattureincloud_python_sdk/models/webhooks_subscription_mapping.py b/fattureincloud_python_sdk/models/webhooks_subscription_mapping.py index c8d7b76c..53f753eb 100644 --- a/fattureincloud_python_sdk/models/webhooks_subscription_mapping.py +++ b/fattureincloud_python_sdk/models/webhooks_subscription_mapping.py @@ -13,10 +13,17 @@ """ # noqa: E501 +from __future__ import annotations import json import pprint import re # noqa: F401 -from aenum import Enum, no_arg +from enum import Enum + + +try: + from typing import Self +except ImportError: + from typing_extensions import Self class WebhooksSubscriptionMapping(str, Enum): @@ -31,6 +38,6 @@ class WebhooksSubscriptionMapping(str, Enum): STRUCTURED = "structured" @classmethod - def from_json(cls, json_str: str) -> WebhooksSubscriptionMapping: + def from_json(cls, json_str: str) -> Self: """Create an instance of WebhooksSubscriptionMapping from a JSON string""" - return WebhooksSubscriptionMapping(json.loads(json_str)) + return cls(json.loads(json_str)) diff --git a/fattureincloud_python_sdk/rest.py b/fattureincloud_python_sdk/rest.py index 3d11ac55..105b8c1d 100644 --- a/fattureincloud_python_sdk/rest.py +++ b/fattureincloud_python_sdk/rest.py @@ -15,49 +15,42 @@ import io import json -import logging import re import ssl -from urllib.parse import urlencode, quote_plus import urllib3 -from fattureincloud_python_sdk.exceptions import ( - ApiException, - UnauthorizedException, - ForbiddenException, - NotFoundException, - ServiceException, - ApiValueError, - BadRequestException, -) +from fattureincloud_python_sdk.exceptions import ApiException, ApiValueError - -logger = logging.getLogger(__name__) +RESTResponseType = urllib3.HTTPResponse class RESTResponse(io.IOBase): def __init__(self, resp) -> None: - self.urllib3_response = resp + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = resp.data + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data def getheaders(self): """Returns a dictionary of the response headers.""" - return self.urllib3_response.headers + return self.response.headers def getheader(self, name, default=None): """Returns a given response header.""" - return self.urllib3_response.headers.get(name, default) + return self.response.headers.get(name, default) class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + def __init__(self, configuration) -> None: # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs @@ -68,9 +61,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - "assert_hostname" - ] = configuration.assert_hostname # noqa: E501 + addition_pool_args["assert_hostname"] = configuration.assert_hostname if configuration.retries is not None: addition_pool_args["retries"] = configuration.retries @@ -81,17 +72,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: if configuration.socket_options is not None: addition_pool_args["socket_options"] = configuration.socket_options - if maxsize is None: - if configuration.connection_pool_maxsize is not None: - maxsize = configuration.connection_pool_maxsize - else: - maxsize = 4 - # https pool manager if configuration.proxy: self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, cert_reqs=cert_reqs, ca_certs=configuration.ssl_ca_cert, cert_file=configuration.cert_file, @@ -102,8 +85,6 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: ) else: self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, cert_reqs=cert_reqs, ca_certs=configuration.ssl_ca_cert, cert_file=configuration.cert_file, @@ -115,26 +96,20 @@ def request( self, method, url, - query_params=None, headers=None, body=None, post_params=None, - _preload_content=True, _request_timeout=None, ): """Perform requests. :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -150,13 +125,10 @@ def request( post_params = post_params or {} headers = headers or {} - # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, float)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, float)): timeout = urllib3.Timeout(total=_request_timeout) elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: timeout = urllib3.Timeout( @@ -167,9 +139,8 @@ def request( # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: # no content type provided or payload is json - if not headers.get("Content-Type") or re.search( - "json", headers["Content-Type"], re.IGNORECASE - ): + content_type = headers.get("Content-Type") + if not content_type or re.search("json", content_type, re.IGNORECASE): request_body = None if body is not None: request_body = json.dumps(body) @@ -177,23 +148,21 @@ def request( method, url, body=request_body, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) - elif ( - headers["Content-Type"] == "application/x-www-form-urlencoded" - ): # noqa: E501 + elif content_type == "application/x-www-form-urlencoded": r = self.pool_manager.request( method, url, fields=post_params, encode_multipart=False, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) - elif headers["Content-Type"] == "multipart/form-data": + elif content_type == "multipart/form-data": # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. @@ -203,9 +172,9 @@ def request( url, fields=post_params, encode_multipart=True, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is @@ -216,9 +185,9 @@ def request( method, url, body=request_body, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) else: # Cannot generate the request from given parameters @@ -232,173 +201,12 @@ def request( method, url, fields={}, - preload_content=_preload_content, timeout=timeout, headers=headers, + preload_content=False, ) except urllib3.exceptions.SSLError as e: - msg = "{0}\n{1}".format(type(e).__name__, str(e)) + msg = "\n".join([type(e).__name__, str(e)]) raise ApiException(status=0, reason=msg) - if _preload_content: - r = RESTResponse(r) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - if r.status == 400: - raise BadRequestException(http_resp=r) - - if r.status == 401: - raise UnauthorizedException(http_resp=r) - - if r.status == 403: - raise ForbiddenException(http_resp=r) - - if r.status == 404: - raise NotFoundException(http_resp=r) - - if 500 <= r.status <= 599: - raise ServiceException(http_resp=r) - - raise ApiException(http_resp=r) - - return r - - def get_request( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def head_request( - self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def options_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def delete_request( - self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def post_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def put_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def patch_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return RESTResponse(r) diff --git a/pyproject.toml b/pyproject.toml index e429ccc3..cd591672 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fattureincloud_python_sdk" -version = "2.0.16" +version = "2.0.17" description = "Fatture in Cloud API v2 - API Reference" authors = ["Fatture in Cloud "] license = "MIT" @@ -14,8 +14,8 @@ python = "^3.7" urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" -pydantic = "^1.10.5, <2" -aenum = ">=3.1.11" +pydantic = ">=2" +typing-extensions = ">=4.7.1" [tool.poetry.dev-dependencies] pytest = ">=7.2.1" diff --git a/requirements.txt b/requirements.txt index 516a393b..68450a4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.26.8, < 2.1.0 -pydantic >= 1.10.5, < 2 -aenum >= 3.1.11 +pydantic >= 2 +typing-extensions >= 4.7.1 diff --git a/sdk-version.yaml b/sdk-version.yaml index eacdaaa8..382249ec 100644 --- a/sdk-version.yaml +++ b/sdk-version.yaml @@ -1,2 +1,2 @@ info: - version: 2.0.16 + version: 2.0.17 diff --git a/setup.py b/setup.py index e0f9b3cc..68f6dce1 100644 --- a/setup.py +++ b/setup.py @@ -22,13 +22,13 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "fattureincloud-python-sdk" -VERSION = "2.0.16" +VERSION = "2.0.17" PYTHON_REQUIRES = ">=3.7" REQUIRES = [ "urllib3 >= 1.26.8, < 2.1.0", "python-dateutil", - "pydantic >= 1.10.5, < 2", - "aenum", + "pydantic >= 2", + "typing-extensions >= 4.7.1", ] diff --git a/test/test_archive_api.py b/test/test_archive_api.py index 3a111ce0..1494deed 100644 --- a/test/test_archive_api.py +++ b/test/test_archive_api.py @@ -58,7 +58,7 @@ def test_create_archive_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateArchiveDocumentResponse( @@ -81,7 +81,7 @@ def test_delete_archive_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_archive_document(2, 12345) @@ -98,7 +98,7 @@ def test_get_archive_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetArchiveDocumentResponse( @@ -125,7 +125,7 @@ def test_list_archive_documents(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListArchiveDocumentsResponse( @@ -161,7 +161,7 @@ def test_modify_archive_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyArchiveDocumentResponse( @@ -188,7 +188,7 @@ def test_upload_archive_document_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = UploadArchiveAttachmentResponse( diff --git a/test/test_cashbook_api.py b/test/test_cashbook_api.py index 7d55ca46..d5d96e64 100644 --- a/test/test_cashbook_api.py +++ b/test/test_cashbook_api.py @@ -62,7 +62,7 @@ def test_create_cashbook_entry(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateCashbookEntryResponse( @@ -89,7 +89,7 @@ def test_delete_cashbook_entry(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_cashbook_entry(2, "12345") @@ -106,7 +106,7 @@ def test_get_cashbook_entry(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetCashbookEntryResponse( @@ -137,7 +137,7 @@ def test_list_cashbook_entries(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListCashbookEntriesResponse( @@ -180,7 +180,7 @@ def test_modify_cashbook_entry(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyCashbookEntryResponse( diff --git a/test/test_clients_api.py b/test/test_clients_api.py index 754fdfe4..655afed9 100644 --- a/test/test_clients_api.py +++ b/test/test_clients_api.py @@ -51,7 +51,7 @@ def test_create_client(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateClientResponse( @@ -134,7 +134,7 @@ def test_delete_client(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_client(2, 12345) @@ -151,7 +151,7 @@ def test_get_client(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetClientResponse( @@ -238,7 +238,7 @@ def test_list_clients(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListClientsResponse( @@ -394,7 +394,7 @@ def test_modify_client(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyClientResponse( diff --git a/test/test_companies_api.py b/test/test_companies_api.py index 93eb2acf..f3e0a714 100644 --- a/test/test_companies_api.py +++ b/test/test_companies_api.py @@ -58,7 +58,7 @@ def test_get_company_info(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetCompanyInfoResponse( diff --git a/test/test_emails_api.py b/test/test_emails_api.py index 19c867cd..27db1851 100644 --- a/test/test_emails_api.py +++ b/test/test_emails_api.py @@ -41,7 +41,7 @@ def test_list_emails(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListEmailsResponse( diff --git a/test/test_info_api.py b/test/test_info_api.py index ee0f3c02..71868147 100644 --- a/test/test_info_api.py +++ b/test/test_info_api.py @@ -90,7 +90,7 @@ def test_list_archive_categories(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListArchiveCategoriesResponse(data=["cat7", "cat6"]) @@ -109,7 +109,7 @@ def test_list_cities(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListCitiesResponse( @@ -126,7 +126,7 @@ def test_list_cost_centers(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListCostCentersResponse(data=["to", "mi"]) @@ -141,7 +141,7 @@ def test_list_countries(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListCountriesResponse(data=["Spagna", "Albania"]) @@ -160,7 +160,7 @@ def test_list_detailed_countries(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListDetailedCountriesResponse( @@ -196,7 +196,7 @@ def test_list_currencies(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListCurrenciesResponse( @@ -217,7 +217,7 @@ def test_list_delivery_notes_default_causals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListDeliveryNotesDefaultCausalsResponse(data=["causal3", "causal2"]) @@ -236,7 +236,7 @@ def test_list_languages(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListLanguagesResponse(data=[Language(code="ITA", name="Italiano")]) @@ -254,7 +254,7 @@ def test_list_payment_accounts(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListPaymentAccountsResponse( @@ -285,7 +285,7 @@ def test_list_payment_methods(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListPaymentMethodsResponse( @@ -328,7 +328,7 @@ def test_list_product_categories(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListProductCategoriesResponse(data=["cat7", "cat6"]) @@ -343,7 +343,7 @@ def test_list_received_document_categories(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListReceivedDocumentCategoriesResponse(data=["cat7", "cat6"]) @@ -358,7 +358,7 @@ def test_list_revenue_centers(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListRevenueCentersResponse(data=["to", "mi"]) @@ -377,7 +377,7 @@ def test_list_templates(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListTemplatesResponse( @@ -393,7 +393,7 @@ def test_list_units_of_measure(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListUnitsOfMeasureResponse(data=["kb", "km"]) @@ -412,7 +412,7 @@ def test_list_vat_types(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListVatTypesResponse( diff --git a/test/test_issued_documents_api.py b/test/test_issued_documents_api.py index 10ced28e..8974d019 100644 --- a/test/test_issued_documents_api.py +++ b/test/test_issued_documents_api.py @@ -97,7 +97,7 @@ def test_create_issued_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateIssuedDocumentResponse( @@ -134,7 +134,7 @@ def test_delete_issued_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_issued_document(2, 12345) @@ -147,7 +147,7 @@ def test_delete_issued_document_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_issued_document_attachment(2, 12345) @@ -164,7 +164,7 @@ def test_get_email_data(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetEmailDataResponse( @@ -199,7 +199,7 @@ def test_get_existing_issued_document_totals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetExistingIssuedDocumentTotalsResponse( @@ -230,7 +230,7 @@ def test_get_issued_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetIssuedDocumentResponse( @@ -271,7 +271,7 @@ def test_get_issued_document_pre_create_info(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetIssuedDocumentPreCreateInfoResponse( @@ -312,7 +312,7 @@ def test_get_new_issued_document_totals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetNewIssuedDocumentTotalsResponse( @@ -343,7 +343,7 @@ def test_list_issued_documents(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListIssuedDocumentsResponse( @@ -408,7 +408,7 @@ def test_modify_issued_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyIssuedDocumentResponse( @@ -445,7 +445,7 @@ def test_schedule_email(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.schedule_email(2, 12345) @@ -462,7 +462,7 @@ def test_upload_issued_document_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = UploadIssuedDocumentAttachmentResponse( @@ -482,7 +482,7 @@ def test_transform_issued_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = TransformIssuedDocumentResponse( @@ -537,7 +537,7 @@ def test_join_issued_documents(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = JoinIssuedDocumentsResponse( diff --git a/test/test_issued_e_invoices_api.py b/test/test_issued_e_invoices_api.py index 27fb5ac1..efd1aa8e 100644 --- a/test/test_issued_e_invoices_api.py +++ b/test/test_issued_e_invoices_api.py @@ -55,7 +55,7 @@ def test_send_e_invoice(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = SendEInvoiceResponse( @@ -72,7 +72,7 @@ def test_verify_e_invoice_xml(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = VerifyEInvoiceXmlResponse( @@ -92,7 +92,7 @@ def test_get_e_invoice_rejection_reason(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetEInvoiceRejectionReasonResponse( diff --git a/test/test_products_api.py b/test/test_products_api.py index ad705f9a..a36ee4cf 100644 --- a/test/test_products_api.py +++ b/test/test_products_api.py @@ -47,7 +47,7 @@ def test_create_product(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateProductResponse( @@ -92,7 +92,7 @@ def test_delete_product(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_product(2, 12345) @@ -109,7 +109,7 @@ def test_get_product(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetProductResponse( @@ -158,7 +158,7 @@ def test_list_products(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListProductsResponse( @@ -239,7 +239,7 @@ def test_modify_product(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyProductResponse( diff --git a/test/test_receipts_api.py b/test/test_receipts_api.py index 8d77d7d3..0585a85a 100644 --- a/test/test_receipts_api.py +++ b/test/test_receipts_api.py @@ -64,7 +64,7 @@ def test_create_receipt(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateReceiptResponse( @@ -122,7 +122,7 @@ def test_delete_receipt(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_receipt(2, 12345) @@ -139,7 +139,7 @@ def test_get_receipt(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetReceiptResponse( @@ -201,7 +201,7 @@ def test_get_receipt_pre_create_info(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetReceiptPreCreateInfoResponse( @@ -227,7 +227,7 @@ def test_get_receipts_monthly_totals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetReceiptsMonthlyTotalsResponse( @@ -250,7 +250,7 @@ def test_list_receipts(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListReceiptsResponse( @@ -314,7 +314,7 @@ def test_modify_receipt(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyReceiptResponse( diff --git a/test/test_received_documents_api.py b/test/test_received_documents_api.py index 67acd35a..64a3617a 100644 --- a/test/test_received_documents_api.py +++ b/test/test_received_documents_api.py @@ -83,7 +83,7 @@ def test_create_received_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateReceivedDocumentResponse( @@ -145,7 +145,7 @@ def test_delete_received_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_received_document(2, 12345) @@ -158,7 +158,7 @@ def test_delete_received_document_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_received_document_attachment(2, 12345) @@ -175,7 +175,7 @@ def test_get_existing_received_document_totals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetExistingReceivedDocumentTotalsResponse( @@ -206,7 +206,7 @@ def test_get_new_received_document_totals(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetNewReceivedDocumentTotalsResponse( @@ -237,7 +237,7 @@ def test_get_received_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetReceivedDocumentResponse( @@ -303,7 +303,7 @@ def test_get_received_document_pre_create_info(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetReceivedDocumentPreCreateInfoResponse( @@ -330,7 +330,7 @@ def test_list_received_documents(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListReceivedDocumentsResponse( @@ -445,7 +445,7 @@ def test_modify_received_document(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyReceivedDocumentResponse( @@ -511,7 +511,7 @@ def test_upload_received_document_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = UploadReceivedDocumentAttachmentResponse( diff --git a/test/test_settings_api.py b/test/test_settings_api.py index 0451bc08..626ff573 100644 --- a/test/test_settings_api.py +++ b/test/test_settings_api.py @@ -68,7 +68,7 @@ def test_create_payment_account(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreatePaymentAccountResponse( @@ -97,7 +97,7 @@ def test_create_payment_method(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreatePaymentMethodResponse( @@ -142,7 +142,7 @@ def test_create_vat_type(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateVatTypeResponse( @@ -168,7 +168,7 @@ def test_delete_payment_account(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_payment_account(2, 12345) @@ -181,7 +181,7 @@ def test_delete_payment_method(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_payment_method(2, 12345) @@ -194,7 +194,7 @@ def test_delete_vat_type(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_vat_type(2, 12345) @@ -211,7 +211,7 @@ def test_get_payment_account(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetPaymentAccountResponse( @@ -240,7 +240,7 @@ def test_get_payment_method(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetPaymentMethodResponse( @@ -285,7 +285,7 @@ def test_get_vat_type(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetVatTypeResponse( @@ -315,7 +315,7 @@ def test_modify_payment_account(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyPaymentAccountResponse( @@ -344,7 +344,7 @@ def test_modify_payment_method(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyPaymentMethodResponse( @@ -389,7 +389,7 @@ def test_modify_vat_type(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyVatTypeResponse( diff --git a/test/test_suppliers_api.py b/test/test_suppliers_api.py index cec66441..0baff9de 100644 --- a/test/test_suppliers_api.py +++ b/test/test_suppliers_api.py @@ -49,7 +49,7 @@ def test_create_supplier(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateSupplierResponse( @@ -89,7 +89,7 @@ def test_delete_supplier(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_supplier(2, 12345) @@ -106,7 +106,7 @@ def test_get_supplier(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetSupplierResponse( @@ -150,7 +150,7 @@ def test_list_suppliers(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListSuppliersResponse( @@ -221,7 +221,7 @@ def test_modify_supplier(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifySupplierResponse( diff --git a/test/test_taxes_api.py b/test/test_taxes_api.py index e41f1d3e..16f28058 100644 --- a/test/test_taxes_api.py +++ b/test/test_taxes_api.py @@ -51,7 +51,7 @@ def test_create_f24(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateF24Response( @@ -94,7 +94,7 @@ def test_get_f24(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetF24Response( @@ -131,7 +131,7 @@ def test_list_f24(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListF24Response( @@ -192,7 +192,7 @@ def test_modify_f24(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyF24Response( @@ -229,7 +229,7 @@ def test_upload_f24_attachment(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = UploadF24AttachmentResponse( diff --git a/test/test_user_api.py b/test/test_user_api.py index dc5ace6f..fee7463f 100644 --- a/test/test_user_api.py +++ b/test/test_user_api.py @@ -54,7 +54,7 @@ def test_get_user_info(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetUserInfoResponse( @@ -88,7 +88,7 @@ def test_list_user_companies(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListUserCompaniesResponse( diff --git a/test/test_webhooks_api.py b/test/test_webhooks_api.py index da731005..8b40f30e 100644 --- a/test/test_webhooks_api.py +++ b/test/test_webhooks_api.py @@ -16,14 +16,26 @@ import unittest import fattureincloud_python_sdk -from fattureincloud_python_sdk.models.create_webhooks_subscription_response import CreateWebhooksSubscriptionResponse +from fattureincloud_python_sdk.models.create_webhooks_subscription_response import ( + CreateWebhooksSubscriptionResponse, +) from fattureincloud_python_sdk.models.event_type import EventType -from fattureincloud_python_sdk.models.get_webhooks_subscription_response import GetWebhooksSubscriptionResponse -from fattureincloud_python_sdk.models.list_webhooks_subscriptions_response import ListWebhooksSubscriptionsResponse -from fattureincloud_python_sdk.models.modify_webhooks_subscription_response import ModifyWebhooksSubscriptionResponse +from fattureincloud_python_sdk.models.get_webhooks_subscription_response import ( + GetWebhooksSubscriptionResponse, +) +from fattureincloud_python_sdk.models.list_webhooks_subscriptions_response import ( + ListWebhooksSubscriptionsResponse, +) +from fattureincloud_python_sdk.models.modify_webhooks_subscription_response import ( + ModifyWebhooksSubscriptionResponse, +) from fattureincloud_python_sdk.models.webhooks_subscription import WebhooksSubscription -from fattureincloud_python_sdk.models.webhooks_subscription_config import WebhooksSubscriptionConfig -from fattureincloud_python_sdk.models.webhooks_subscription_mapping import WebhooksSubscriptionMapping +from fattureincloud_python_sdk.models.webhooks_subscription_config import ( + WebhooksSubscriptionConfig, +) +from fattureincloud_python_sdk.models.webhooks_subscription_mapping import ( + WebhooksSubscriptionMapping, +) import functions from fattureincloud_python_sdk.api.webhooks_api import WebhooksApi # noqa: E501 from fattureincloud_python_sdk.rest import RESTResponse @@ -49,16 +61,18 @@ def test_create_webhooks_subscription(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.post_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = CreateWebhooksSubscriptionResponse( - data= WebhooksSubscription( + data=WebhooksSubscription( id="SUB1234", sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), ) ) @@ -73,7 +87,7 @@ def test_delete_webhooks_subscription(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.delete_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) actual = self.api.delete_webhooks_subscription(2, "SUB12345") @@ -90,16 +104,18 @@ def test_get_webhooks_subscription(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = GetWebhooksSubscriptionResponse( - data= WebhooksSubscription( + data=WebhooksSubscription( id="SUB1234", sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), ) ) @@ -118,25 +134,29 @@ def test_list_webhooks_subscriptions(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.get_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ListWebhooksSubscriptionsResponse( - data = [ + data=[ WebhooksSubscription( id="SUB0", sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), ), WebhooksSubscription( id="SUB1", sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), - ) + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), + ), ] ) @@ -156,16 +176,18 @@ def test_modify_webhooks_subscription(self): mock_resp.getheader = unittest.mock.MagicMock(return_value=None) mock_resp.getheaders = unittest.mock.MagicMock(return_value=None) - self.api.api_client.rest_client.put_request = unittest.mock.MagicMock( + self.api.api_client.rest_client.request = unittest.mock.MagicMock( return_value=mock_resp ) expected = ModifyWebhooksSubscriptionResponse( - data= WebhooksSubscription( + data=WebhooksSubscription( id="SUB1234", sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), ) ) diff --git a/test/test_webhooks_subscription.py b/test/test_webhooks_subscription.py index 881bbde2..74ce9331 100644 --- a/test/test_webhooks_subscription.py +++ b/test/test_webhooks_subscription.py @@ -22,8 +22,12 @@ from fattureincloud_python_sdk.models.webhooks_subscription import ( WebhooksSubscription, ) -from fattureincloud_python_sdk.models.webhooks_subscription_config import WebhooksSubscriptionConfig -from fattureincloud_python_sdk.models.webhooks_subscription_mapping import WebhooksSubscriptionMapping # noqa: E501 +from fattureincloud_python_sdk.models.webhooks_subscription_config import ( + WebhooksSubscriptionConfig, +) +from fattureincloud_python_sdk.models.webhooks_subscription_mapping import ( + WebhooksSubscriptionMapping, +) # noqa: E501 from fattureincloud_python_sdk.rest import ApiException from functions import create_from_json, json_serial @@ -44,7 +48,9 @@ def testWebhooksSubscription(self): sink="https://endpoint.test", verified=True, types=[EventType.CASHBOOK_CREATE], - config=WebhooksSubscriptionConfig(mapping=WebhooksSubscriptionMapping('binary')), + config=WebhooksSubscriptionConfig( + mapping=WebhooksSubscriptionMapping("binary") + ), ) expected_json = '{"id": "SUB123", "sink": "https://endpoint.test", "verified": true, "types": ["it.fattureincloud.webhooks.cashbook.create"], "config": {"mapping": "binary"}}' actual_json = json.dumps(model.to_dict(), default=json_serial) diff --git a/test/test_webhooks_subscription_config.py b/test/test_webhooks_subscription_config.py index 70e2fe35..6e0133c6 100644 --- a/test/test_webhooks_subscription_config.py +++ b/test/test_webhooks_subscription_config.py @@ -15,7 +15,9 @@ import unittest import json -from fattureincloud_python_sdk.models.webhooks_subscription_mapping import WebhooksSubscriptionMapping +from fattureincloud_python_sdk.models.webhooks_subscription_mapping import ( + WebhooksSubscriptionMapping, +) from functions import json_serial from fattureincloud_python_sdk.models.webhooks_subscription_config import ( @@ -36,7 +38,7 @@ def testWebhooksSubscriptionConfig(self): """Test WebhooksSubscriptionConfig""" model = WebhooksSubscriptionConfig( - mapping = WebhooksSubscriptionMapping('binary') + mapping=WebhooksSubscriptionMapping("binary") ) expected_json = '{"mapping": "binary"}' actual_json = json.dumps(model.to_dict(), default=json_serial)