- Implement tests for basic and bearer authentication headers in `test_auth.py`. - Create tests for the `EasybillWebhookParser` in `test_webhooks.py`, covering JSON and form-encoded payloads, as well as a generic parse and acknowledgement method.
1618 lines
70 KiB
Python
1618 lines
70 KiB
Python
"""
|
|
easybill REST API
|
|
|
|
The first version of the easybill REST API. [CHANGELOG](https://api.easybill.de/rest/v1/CHANGELOG.md) ## Authentication You can choose between two available methods: `Basic Auth` or `Bearer Token`. In each HTTP request, one of the following HTTP headers is required: ``` # Basic Auth Authorization: Basic base64_encode('<email>:<api_key>') # Bearer Token Authorization: Bearer <api_key> ``` ## Limitations ### Request Limit * PLUS: 10 requests per minute * BUSINESS: 60 requests per minute If the limit is exceeded, you will receive the HTTP error: `429 Too Many Requests` ### Result Limit All result lists are limited to 100 by default. This limit can be increased by the query parameter `limit` to a maximum of 1000. ## Query filter Many list resources can be filtered. In `/documents` you can filter e.g. by number with `/documents?number=111028654`. If you want to filter multiple numbers, you can either enter them separated by commas `/documents?number=111028654,222006895` or as an array `/documents?number[]=111028654&number[]=222006895`. **Warning**: The maximum size of an HTTP request line in bytes is 4094. If this limit is exceeded, you will receive the HTTP error: `414 Request-URI Too Large` ### Escape commas in query You can escape commans in query `name=Patrick\\, Peter` if you submit the header `X-Easybill-Escape: true` in your request. ## Property login_id This is the login of your admin or employee account. ## Date and Date-Time format Please use the timezone `Europe/Berlin`. * **date** = *Y-m-d* = `2016-12-31` * **date-time** = *Y-m-d H:i:s* = `2016-12-31 03:13:37` Date or datetime can be `null` because the attributes have been added later and the entry is older.
|
|
|
|
The version of the OpenAPI document: 1.96.0
|
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
Do not edit the class manually.
|
|
""" # noqa: E501
|
|
|
|
|
|
import warnings
|
|
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
from typing_extensions import Annotated
|
|
|
|
from pydantic import Field, StrictInt, StrictStr, field_validator
|
|
from typing import Optional
|
|
from typing_extensions import Annotated
|
|
from easybill_generated_async.models.customer import Customer
|
|
from easybill_generated_async.models.customers import Customers
|
|
|
|
from easybill_generated_async.api_client import ApiClient, RequestSerialized
|
|
from easybill_generated_async.api_response import ApiResponse
|
|
from easybill_generated_async.rest import RESTResponseType
|
|
|
|
|
|
class CustomerApi:
|
|
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
Ref: https://openapi-generator.tech
|
|
|
|
Do not edit the class manually.
|
|
"""
|
|
|
|
def __init__(self, api_client=None) -> None:
|
|
if api_client is None:
|
|
api_client = ApiClient.get_default()
|
|
self.api_client = api_client
|
|
|
|
|
|
@validate_call
|
|
async def customers_get(
|
|
self,
|
|
limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Limited the result. Default is 100. Maximum can be 1000.")] = None,
|
|
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Set current Page. Default is 1.")] = None,
|
|
group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
additional_group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
number: Annotated[Optional[StrictStr], Field(description="Filter customers by number. You can add multiple numbers separate by comma like no,no,no.")] = None,
|
|
country: Annotated[Optional[StrictStr], Field(description="Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.")] = None,
|
|
zip_code: Annotated[Optional[StrictStr], Field(description="Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.")] = None,
|
|
emails: Annotated[Optional[StrictStr], Field(description="Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.")] = None,
|
|
first_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
last_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
company_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
created_at: Annotated[Optional[StrictStr], Field(description="Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.")] = 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,
|
|
) -> Customers:
|
|
"""Fetch customers list
|
|
|
|
|
|
:param limit: Limited the result. Default is 100. Maximum can be 1000.
|
|
:type limit: int
|
|
:param page: Set current Page. Default is 1.
|
|
:type page: int
|
|
:param group_id: Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type group_id: str
|
|
:param additional_group_id: Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type additional_group_id: str
|
|
:param number: Filter customers by number. You can add multiple numbers separate by comma like no,no,no.
|
|
:type number: str
|
|
:param country: Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.
|
|
:type country: str
|
|
:param zip_code: Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.
|
|
:type zip_code: str
|
|
:param emails: Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.
|
|
:type emails: str
|
|
:param first_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type first_name: str
|
|
:param last_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type last_name: str
|
|
:param company_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type company_name: str
|
|
:param created_at: Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.
|
|
:type created_at: 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._customers_get_serialize(
|
|
limit=limit,
|
|
page=page,
|
|
group_id=group_id,
|
|
additional_group_id=additional_group_id,
|
|
number=number,
|
|
country=country,
|
|
zip_code=zip_code,
|
|
emails=emails,
|
|
first_name=first_name,
|
|
last_name=last_name,
|
|
company_name=company_name,
|
|
created_at=created_at,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customers",
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
async def customers_get_with_http_info(
|
|
self,
|
|
limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Limited the result. Default is 100. Maximum can be 1000.")] = None,
|
|
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Set current Page. Default is 1.")] = None,
|
|
group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
additional_group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
number: Annotated[Optional[StrictStr], Field(description="Filter customers by number. You can add multiple numbers separate by comma like no,no,no.")] = None,
|
|
country: Annotated[Optional[StrictStr], Field(description="Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.")] = None,
|
|
zip_code: Annotated[Optional[StrictStr], Field(description="Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.")] = None,
|
|
emails: Annotated[Optional[StrictStr], Field(description="Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.")] = None,
|
|
first_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
last_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
company_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
created_at: Annotated[Optional[StrictStr], Field(description="Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.")] = 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,
|
|
) -> ApiResponse[Customers]:
|
|
"""Fetch customers list
|
|
|
|
|
|
:param limit: Limited the result. Default is 100. Maximum can be 1000.
|
|
:type limit: int
|
|
:param page: Set current Page. Default is 1.
|
|
:type page: int
|
|
:param group_id: Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type group_id: str
|
|
:param additional_group_id: Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type additional_group_id: str
|
|
:param number: Filter customers by number. You can add multiple numbers separate by comma like no,no,no.
|
|
:type number: str
|
|
:param country: Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.
|
|
:type country: str
|
|
:param zip_code: Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.
|
|
:type zip_code: str
|
|
:param emails: Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.
|
|
:type emails: str
|
|
:param first_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type first_name: str
|
|
:param last_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type last_name: str
|
|
:param company_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type company_name: str
|
|
:param created_at: Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.
|
|
:type created_at: 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._customers_get_serialize(
|
|
limit=limit,
|
|
page=page,
|
|
group_id=group_id,
|
|
additional_group_id=additional_group_id,
|
|
number=number,
|
|
country=country,
|
|
zip_code=zip_code,
|
|
emails=emails,
|
|
first_name=first_name,
|
|
last_name=last_name,
|
|
company_name=company_name,
|
|
created_at=created_at,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customers",
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
async def customers_get_without_preload_content(
|
|
self,
|
|
limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Limited the result. Default is 100. Maximum can be 1000.")] = None,
|
|
page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Set current Page. Default is 1.")] = None,
|
|
group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
additional_group_id: Annotated[Optional[StrictStr], Field(description="Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.")] = None,
|
|
number: Annotated[Optional[StrictStr], Field(description="Filter customers by number. You can add multiple numbers separate by comma like no,no,no.")] = None,
|
|
country: Annotated[Optional[StrictStr], Field(description="Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.")] = None,
|
|
zip_code: Annotated[Optional[StrictStr], Field(description="Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.")] = None,
|
|
emails: Annotated[Optional[StrictStr], Field(description="Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.")] = None,
|
|
first_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
last_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
company_name: Annotated[Optional[StrictStr], Field(description="Filter customers by first_name. You can add multiple names separate by comma like name,name,name.")] = None,
|
|
created_at: Annotated[Optional[StrictStr], Field(description="Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.")] = 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:
|
|
"""Fetch customers list
|
|
|
|
|
|
:param limit: Limited the result. Default is 100. Maximum can be 1000.
|
|
:type limit: int
|
|
:param page: Set current Page. Default is 1.
|
|
:type page: int
|
|
:param group_id: Filter customers by group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type group_id: str
|
|
:param additional_group_id: Filter customers by additional_group_id. You can add multiple group ids separate by comma like id,id,id.
|
|
:type additional_group_id: str
|
|
:param number: Filter customers by number. You can add multiple numbers separate by comma like no,no,no.
|
|
:type number: str
|
|
:param country: Filter customers by country. You can add multiple countries separate by comma like DE,PL,FR.
|
|
:type country: str
|
|
:param zip_code: Filter customers by zip_code. You can add multiple zip codes separate by comma like zip,zip,zip.
|
|
:type zip_code: str
|
|
:param emails: Filter customers by emails. You can add multiple emails separate by comma like mail,mail,mail.
|
|
:type emails: str
|
|
:param first_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type first_name: str
|
|
:param last_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type last_name: str
|
|
:param company_name: Filter customers by first_name. You can add multiple names separate by comma like name,name,name.
|
|
:type company_name: str
|
|
:param created_at: Filter customers by created_at. You can filter one date with created_at=2014-12-10 or between like 2015-01-01,2015-12-31.
|
|
:type created_at: 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._customers_get_serialize(
|
|
limit=limit,
|
|
page=page,
|
|
group_id=group_id,
|
|
additional_group_id=additional_group_id,
|
|
number=number,
|
|
country=country,
|
|
zip_code=zip_code,
|
|
emails=emails,
|
|
first_name=first_name,
|
|
last_name=last_name,
|
|
company_name=company_name,
|
|
created_at=created_at,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customers",
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _customers_get_serialize(
|
|
self,
|
|
limit,
|
|
page,
|
|
group_id,
|
|
additional_group_id,
|
|
number,
|
|
country,
|
|
zip_code,
|
|
emails,
|
|
first_name,
|
|
last_name,
|
|
company_name,
|
|
created_at,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
# process the query parameters
|
|
if limit is not None:
|
|
|
|
_query_params.append(('limit', limit))
|
|
|
|
if page is not None:
|
|
|
|
_query_params.append(('page', page))
|
|
|
|
if group_id is not None:
|
|
|
|
_query_params.append(('group_id', group_id))
|
|
|
|
if additional_group_id is not None:
|
|
|
|
_query_params.append(('additional_group_id', additional_group_id))
|
|
|
|
if number is not None:
|
|
|
|
_query_params.append(('number', number))
|
|
|
|
if country is not None:
|
|
|
|
_query_params.append(('country', country))
|
|
|
|
if zip_code is not None:
|
|
|
|
_query_params.append(('zip_code', zip_code))
|
|
|
|
if emails is not None:
|
|
|
|
_query_params.append(('emails', emails))
|
|
|
|
if first_name is not None:
|
|
|
|
_query_params.append(('first_name', first_name))
|
|
|
|
if last_name is not None:
|
|
|
|
_query_params.append(('last_name', last_name))
|
|
|
|
if company_name is not None:
|
|
|
|
_query_params.append(('company_name', company_name))
|
|
|
|
if created_at is not None:
|
|
|
|
_query_params.append(('created_at', created_at))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
if 'Accept' not in _header_params:
|
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
[
|
|
'application/json'
|
|
]
|
|
)
|
|
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'basicAuth',
|
|
'Bearer'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='GET',
|
|
resource_path='/customers',
|
|
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
|
|
async def customers_id_delete(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be deleted")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[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 customer
|
|
|
|
|
|
:param id: ID of customer that needs to be deleted (required)
|
|
: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._customers_id_delete_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'204': None,
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_delete_with_http_info(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be deleted")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[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 customer
|
|
|
|
|
|
:param id: ID of customer that needs to be deleted (required)
|
|
: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._customers_id_delete_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'204': None,
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_delete_without_preload_content(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be deleted")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[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 customer
|
|
|
|
|
|
:param id: ID of customer that needs to be deleted (required)
|
|
: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._customers_id_delete_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'204': None,
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _customers_id_delete_serialize(
|
|
self,
|
|
id,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
if id is not None:
|
|
_path_params['id'] = id
|
|
# process the query parameters
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
|
|
|
|
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'basicAuth',
|
|
'Bearer'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='DELETE',
|
|
resource_path='/customers/{id}',
|
|
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
|
|
async def customers_id_get(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be fetched")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> Customer:
|
|
"""Fetch customer
|
|
|
|
|
|
:param id: ID of customer that needs to be fetched (required)
|
|
: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._customers_id_get_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_get_with_http_info(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be fetched")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[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[Customer]:
|
|
"""Fetch customer
|
|
|
|
|
|
:param id: ID of customer that needs to be fetched (required)
|
|
: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._customers_id_get_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_get_without_preload_content(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be fetched")],
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[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:
|
|
"""Fetch customer
|
|
|
|
|
|
:param id: ID of customer that needs to be fetched (required)
|
|
: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._customers_id_get_serialize(
|
|
id=id,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'404': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _customers_id_get_serialize(
|
|
self,
|
|
id,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
if id is not None:
|
|
_path_params['id'] = id
|
|
# process the query parameters
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
if 'Accept' not in _header_params:
|
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
[
|
|
'application/json'
|
|
]
|
|
)
|
|
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'basicAuth',
|
|
'Bearer'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='GET',
|
|
resource_path='/customers/{id}',
|
|
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
|
|
async def customers_id_put(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be updated")],
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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,
|
|
) -> Customer:
|
|
"""Update Customer
|
|
|
|
|
|
:param id: ID of customer that needs to be updated (required)
|
|
:type id: int
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_id_put_serialize(
|
|
id=id,
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_put_with_http_info(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be updated")],
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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,
|
|
) -> ApiResponse[Customer]:
|
|
"""Update Customer
|
|
|
|
|
|
:param id: ID of customer that needs to be updated (required)
|
|
:type id: int
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_id_put_serialize(
|
|
id=id,
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
async def customers_id_put_without_preload_content(
|
|
self,
|
|
id: Annotated[StrictInt, Field(description="ID of customer that needs to be updated")],
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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:
|
|
"""Update Customer
|
|
|
|
|
|
:param id: ID of customer that needs to be updated (required)
|
|
:type id: int
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_id_put_serialize(
|
|
id=id,
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _customers_id_put_serialize(
|
|
self,
|
|
id,
|
|
body,
|
|
type,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
if id is not None:
|
|
_path_params['id'] = id
|
|
# process the query parameters
|
|
if type is not None:
|
|
|
|
_query_params.append(('type', type))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
if body is not None:
|
|
_body_params = body
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
if 'Accept' not in _header_params:
|
|
_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] = [
|
|
'basicAuth',
|
|
'Bearer'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='PUT',
|
|
resource_path='/customers/{id}',
|
|
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
|
|
async def customers_post(
|
|
self,
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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,
|
|
) -> Customer:
|
|
"""Create customer
|
|
|
|
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_post_serialize(
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
async def customers_post_with_http_info(
|
|
self,
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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,
|
|
) -> ApiResponse[Customer]:
|
|
"""Create customer
|
|
|
|
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_post_serialize(
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
await response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
async def customers_post_without_preload_content(
|
|
self,
|
|
body: Customer,
|
|
type: Annotated[Optional[StrictStr], Field(description="Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".")] = 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 customer
|
|
|
|
|
|
:param body: (required)
|
|
:type body: Customer
|
|
:param type: Controls the type of the customer. If provided and the field \"number\" or \"supplier_number\" is empty or omitted, the type will force the generation of the relevant number if applicable. I. e. omitting \"supplier_number\" but providing the query parameter \"SUPPLIER\" will generate a \"supplier_number\".
|
|
: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._customers_post_serialize(
|
|
body=body,
|
|
type=type,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "Customer",
|
|
'400': None,
|
|
'429': None,
|
|
}
|
|
response_data = await self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _customers_post_serialize(
|
|
self,
|
|
body,
|
|
type,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_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, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
# process the query parameters
|
|
if type is not None:
|
|
|
|
_query_params.append(('type', type))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
if body is not None:
|
|
_body_params = body
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
if 'Accept' not in _header_params:
|
|
_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] = [
|
|
'basicAuth',
|
|
'Bearer'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='POST',
|
|
resource_path='/customers',
|
|
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
|
|
)
|
|
|
|
|