# coding: utf-8

"""
Waybiller External API - with fixes

The **Waybiller External API** is a feature that allows companies to access **Waybiller** data as JSON objects and create **Waybiller** instances out of their own data.  To make integration easier for the companies, the external API provides mapping support - it is possible to create company-specific mappings for object identifiers (such as destination and origin).  These mappings will be used for representing companies data from external API, and for converting the values during the creation of **Waybiller** instances (such as transport orders and waybills).  Most of the API responses contain mapped values, which may be null if the company doesn't have a mapping for this object.  Unique **Waybiller** identifiers and values can be accessed via the `raw_data` key.  The API is HTTPS and JSON based.  ### Pagination  By default, list endpoint responses are presented in pages of 30 items.  It is possible to control the page size using the `limit` parameter: `/external-api/<some-list-endpoint>/?limit=<number>`, where `<number>` is an integer between 1 and 1000.

The version of the OpenAPI document: v1
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""  # noqa: E501

import warnings
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Union

from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
from typing_extensions import Annotated

from pywaybiller.openapi_client.api_client import ApiClient, RequestSerialized
from pywaybiller.openapi_client.api_response import ApiResponse
from pywaybiller.openapi_client.models.external_api_waybill_accept import (
    ExternalAPIWaybillAccept,
)
from pywaybiller.openapi_client.models.external_api_waybill_accept_request import (
    ExternalAPIWaybillAcceptRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_accepted_amounts import (
    ExternalAPIWaybillAcceptedAmounts,
)
from pywaybiller.openapi_client.models.external_api_waybill_accepted_amounts_request import (
    ExternalAPIWaybillAcceptedAmountsRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_cancel import (
    ExternalAPIWaybillCancel,
)
from pywaybiller.openapi_client.models.external_api_waybill_cancel_request import (
    ExternalAPIWaybillCancelRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_comment_request import (
    ExternalAPIWaybillCommentRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_create import (
    ExternalAPIWaybillCreate,
)
from pywaybiller.openapi_client.models.external_api_waybill_create_request import (
    ExternalAPIWaybillCreateRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_dispatched_amounts import (
    ExternalAPIWaybillDispatchedAmounts,
)
from pywaybiller.openapi_client.models.external_api_waybill_dispatched_amounts_request import (
    ExternalAPIWaybillDispatchedAmountsRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_finish_drive_request import (
    ExternalAPIWaybillFinishDriveRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_refuse import (
    ExternalAPIWaybillRefuse,
)
from pywaybiller.openapi_client.models.external_api_waybill_refuse_request import (
    ExternalAPIWaybillRefuseRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_retrieve import (
    ExternalAPIWaybillRetrieve,
)
from pywaybiller.openapi_client.models.external_api_waybill_start_drive import (
    ExternalAPIWaybillStartDrive,
)
from pywaybiller.openapi_client.models.external_api_waybill_start_drive_request import (
    ExternalAPIWaybillStartDriveRequest,
)
from pywaybiller.openapi_client.models.external_api_waybill_vehicle_location import (
    ExternalAPIWaybillVehicleLocation,
)
from pywaybiller.openapi_client.models.paginated_external_api_waybill_list_list import (
    PaginatedExternalAPIWaybillListList,
)
from pywaybiller.openapi_client.models.waybills_update_custom_fields_update_request_value import (
    WaybillsUpdateCustomFieldsUpdateRequestValue,
)
from pywaybiller.openapi_client.rest import RESTResponseType


class WaybillsApi:
    """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
    def waybills_accept_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillAccept:
        """Accepting waybill

        Sets the status of a waybill to `accepted`.         Only the receiving company of the waybill is authorized to accept the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accept_request: (required)
        :type external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_accept_update_serialize(
            id=id,
            external_api_waybill_accept_request=external_api_waybill_accept_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAccept",
            "403": "DestinationsList403Response",
        }
        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 waybills_accept_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillAccept]:
        """Accepting waybill

        Sets the status of a waybill to `accepted`.         Only the receiving company of the waybill is authorized to accept the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accept_request: (required)
        :type external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_accept_update_serialize(
            id=id,
            external_api_waybill_accept_request=external_api_waybill_accept_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAccept",
            "403": "DestinationsList403Response",
        }
        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 waybills_accept_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Accepting waybill

        Sets the status of a waybill to `accepted`.         Only the receiving company of the waybill is authorized to accept the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accept_request: (required)
        :type external_api_waybill_accept_request: ExternalAPIWaybillAcceptRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_accept_update_serialize(
            id=id,
            external_api_waybill_accept_request=external_api_waybill_accept_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAccept",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_accept_update_serialize(
        self,
        id,
        external_api_waybill_accept_request,
        _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
        if external_api_waybill_accept_request is not None:
            _body_params = external_api_waybill_accept_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/accept/",
            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 waybills_cancel_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillCancel:
        """Cancelling waybill

        Marks waybill as `cancelled`.         Any waybill can be cancelled except waybills with status `accepted`.         Waybill can be cancelled by origin owner, transportation company or receiver company or its representative.\"

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_cancel_request: (required)
        :type external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_cancel_update_serialize(
            id=id,
            external_api_waybill_cancel_request=external_api_waybill_cancel_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillCancel",
            "403": "DestinationsList403Response",
        }
        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 waybills_cancel_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillCancel]:
        """Cancelling waybill

        Marks waybill as `cancelled`.         Any waybill can be cancelled except waybills with status `accepted`.         Waybill can be cancelled by origin owner, transportation company or receiver company or its representative.\"

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_cancel_request: (required)
        :type external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_cancel_update_serialize(
            id=id,
            external_api_waybill_cancel_request=external_api_waybill_cancel_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillCancel",
            "403": "DestinationsList403Response",
        }
        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 waybills_cancel_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Cancelling waybill

        Marks waybill as `cancelled`.         Any waybill can be cancelled except waybills with status `accepted`.         Waybill can be cancelled by origin owner, transportation company or receiver company or its representative.\"

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_cancel_request: (required)
        :type external_api_waybill_cancel_request: ExternalAPIWaybillCancelRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_cancel_update_serialize(
            id=id,
            external_api_waybill_cancel_request=external_api_waybill_cancel_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillCancel",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_cancel_update_serialize(
        self,
        id,
        external_api_waybill_cancel_request,
        _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
        if external_api_waybill_cancel_request is not None:
            _body_params = external_api_waybill_cancel_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/cancel/",
            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 waybills_comment_create(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Commenting waybill

        Adds a comment to the waybill.         Only companies associated with the waybill can add comments to it.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_comment_request: (required)
        :type external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_comment_create_serialize(
            id=id,
            external_api_waybill_comment_request=external_api_waybill_comment_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        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 waybills_comment_create_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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]:
        """Commenting waybill

        Adds a comment to the waybill.         Only companies associated with the waybill can add comments to it.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_comment_request: (required)
        :type external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_comment_create_serialize(
            id=id,
            external_api_waybill_comment_request=external_api_waybill_comment_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        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 waybills_comment_create_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Commenting waybill

        Adds a comment to the waybill.         Only companies associated with the waybill can add comments to it.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_comment_request: (required)
        :type external_api_waybill_comment_request: ExternalAPIWaybillCommentRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_comment_create_serialize(
            id=id,
            external_api_waybill_comment_request=external_api_waybill_comment_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_comment_create_serialize(
        self,
        id,
        external_api_waybill_comment_request,
        _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
        if external_api_waybill_comment_request is not None:
            _body_params = external_api_waybill_comment_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="POST",
            resource_path="/external-api/waybills/{id}/comment/",
            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 waybills_create(
        self,
        external_api_waybill_create_request: ExternalAPIWaybillCreateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillCreate:
        """Creation of a waybill

        Creates a new waybill.<br><br>         **NB!** IDs posted this way are IDs in your system and these are used to match objects in         your system with objects in Waybiller.         It is also possible to use the origin or destination ID in Waybiller         (if you have received those via GET Origins or GET Destinations endpoints).

        :param external_api_waybill_create_request: (required)
        :type external_api_waybill_create_request: ExternalAPIWaybillCreateRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_create_serialize(
            external_api_waybill_create_request=external_api_waybill_create_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "201": "ExternalAPIWaybillCreate",
            "403": "DestinationsList403Response",
        }
        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 waybills_create_with_http_info(
        self,
        external_api_waybill_create_request: ExternalAPIWaybillCreateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillCreate]:
        """Creation of a waybill

        Creates a new waybill.<br><br>         **NB!** IDs posted this way are IDs in your system and these are used to match objects in         your system with objects in Waybiller.         It is also possible to use the origin or destination ID in Waybiller         (if you have received those via GET Origins or GET Destinations endpoints).

        :param external_api_waybill_create_request: (required)
        :type external_api_waybill_create_request: ExternalAPIWaybillCreateRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_create_serialize(
            external_api_waybill_create_request=external_api_waybill_create_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "201": "ExternalAPIWaybillCreate",
            "403": "DestinationsList403Response",
        }
        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 waybills_create_without_preload_content(
        self,
        external_api_waybill_create_request: ExternalAPIWaybillCreateRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Creation of a waybill

        Creates a new waybill.<br><br>         **NB!** IDs posted this way are IDs in your system and these are used to match objects in         your system with objects in Waybiller.         It is also possible to use the origin or destination ID in Waybiller         (if you have received those via GET Origins or GET Destinations endpoints).

        :param external_api_waybill_create_request: (required)
        :type external_api_waybill_create_request: ExternalAPIWaybillCreateRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_create_serialize(
            external_api_waybill_create_request=external_api_waybill_create_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "201": "ExternalAPIWaybillCreate",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_create_serialize(
        self,
        external_api_waybill_create_request,
        _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
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if external_api_waybill_create_request is not None:
            _body_params = external_api_waybill_create_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="POST",
            resource_path="/external-api/waybills/",
            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 waybills_finish_drive_create(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Completing driving

        Sets the status of a waybill to `in destination`. Waybill status has to be `in progress` to use this endpoint.         Only the transportation company or receiving company of the waybill are authorized to move waybill to `in destination`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_finish_drive_request: (required)
        :type external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_finish_drive_create_serialize(
            id=id,
            external_api_waybill_finish_drive_request=external_api_waybill_finish_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        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 waybills_finish_drive_create_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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]:
        """Completing driving

        Sets the status of a waybill to `in destination`. Waybill status has to be `in progress` to use this endpoint.         Only the transportation company or receiving company of the waybill are authorized to move waybill to `in destination`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_finish_drive_request: (required)
        :type external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_finish_drive_create_serialize(
            id=id,
            external_api_waybill_finish_drive_request=external_api_waybill_finish_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        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 waybills_finish_drive_create_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Completing driving

        Sets the status of a waybill to `in destination`. Waybill status has to be `in progress` to use this endpoint.         Only the transportation company or receiving company of the waybill are authorized to move waybill to `in destination`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_finish_drive_request: (required)
        :type external_api_waybill_finish_drive_request: ExternalAPIWaybillFinishDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_finish_drive_create_serialize(
            id=id,
            external_api_waybill_finish_drive_request=external_api_waybill_finish_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": None,
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_finish_drive_create_serialize(
        self,
        id,
        external_api_waybill_finish_drive_request,
        _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
        if external_api_waybill_finish_drive_request is not None:
            _body_params = external_api_waybill_finish_drive_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="POST",
            resource_path="/external-api/waybills/{id}/finish_drive/",
            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 waybills_list(
        self,
        destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas."
            ),
        ] = None,
        limit: Annotated[
            Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]],
            Field(description="Maximum number of objects to return per page"),
        ] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(strict=True, ge=0)]],
            Field(description="The initial index from which to return the results"),
        ] = None,
        origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas."
            ),
        ] = None,
        raw_destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        raw_origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__gt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__lt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format."
            ),
        ] = 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,
    ) -> PaginatedExternalAPIWaybillListList:
        """Querying of waybills

        Returns all waybills associated with your company, according to the specified filters.<br><br>         **NB!** By default, past 30 days according to the `dispatcher_timestamp` field waybills are returned. Use         `dispatcher_timestamp__lt` and `dispatcher_timestamp__gt` for filtering. Note that the maximum range is 30 days.

        :param destination_ids: Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas.
        :type destination_ids: str
        :param limit: Maximum number of objects to return per page
        :type limit: int
        :param offset: The initial index from which to return the results
        :type offset: int
        :param origin_ids: Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas.
        :type origin_ids: str
        :param raw_destination_ids: Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas.
        :type raw_destination_ids: str
        :param raw_origin_ids: Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas.
        :type raw_origin_ids: str
        :param transportation_cost_confirmed_at_timestamp__gt: Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__gt: datetime
        :param transportation_cost_confirmed_at_timestamp__lt: Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__lt: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_list_serialize(
            destination_ids=destination_ids,
            limit=limit,
            offset=offset,
            origin_ids=origin_ids,
            raw_destination_ids=raw_destination_ids,
            raw_origin_ids=raw_origin_ids,
            transportation_cost_confirmed_at_timestamp__gt=transportation_cost_confirmed_at_timestamp__gt,
            transportation_cost_confirmed_at_timestamp__lt=transportation_cost_confirmed_at_timestamp__lt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "PaginatedExternalAPIWaybillListList",
            "403": "DestinationsList403Response",
        }
        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 waybills_list_with_http_info(
        self,
        destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas."
            ),
        ] = None,
        limit: Annotated[
            Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]],
            Field(description="Maximum number of objects to return per page"),
        ] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(strict=True, ge=0)]],
            Field(description="The initial index from which to return the results"),
        ] = None,
        origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas."
            ),
        ] = None,
        raw_destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        raw_origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__gt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__lt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format."
            ),
        ] = 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[PaginatedExternalAPIWaybillListList]:
        """Querying of waybills

        Returns all waybills associated with your company, according to the specified filters.<br><br>         **NB!** By default, past 30 days according to the `dispatcher_timestamp` field waybills are returned. Use         `dispatcher_timestamp__lt` and `dispatcher_timestamp__gt` for filtering. Note that the maximum range is 30 days.

        :param destination_ids: Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas.
        :type destination_ids: str
        :param limit: Maximum number of objects to return per page
        :type limit: int
        :param offset: The initial index from which to return the results
        :type offset: int
        :param origin_ids: Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas.
        :type origin_ids: str
        :param raw_destination_ids: Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas.
        :type raw_destination_ids: str
        :param raw_origin_ids: Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas.
        :type raw_origin_ids: str
        :param transportation_cost_confirmed_at_timestamp__gt: Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__gt: datetime
        :param transportation_cost_confirmed_at_timestamp__lt: Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__lt: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_list_serialize(
            destination_ids=destination_ids,
            limit=limit,
            offset=offset,
            origin_ids=origin_ids,
            raw_destination_ids=raw_destination_ids,
            raw_origin_ids=raw_origin_ids,
            transportation_cost_confirmed_at_timestamp__gt=transportation_cost_confirmed_at_timestamp__gt,
            transportation_cost_confirmed_at_timestamp__lt=transportation_cost_confirmed_at_timestamp__lt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "PaginatedExternalAPIWaybillListList",
            "403": "DestinationsList403Response",
        }
        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 waybills_list_without_preload_content(
        self,
        destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas."
            ),
        ] = None,
        limit: Annotated[
            Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]],
            Field(description="Maximum number of objects to return per page"),
        ] = None,
        offset: Annotated[
            Optional[Annotated[int, Field(strict=True, ge=0)]],
            Field(description="The initial index from which to return the results"),
        ] = None,
        origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas."
            ),
        ] = None,
        raw_destination_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        raw_origin_ids: Annotated[
            Optional[StrictStr],
            Field(
                description="Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__gt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format."
            ),
        ] = None,
        transportation_cost_confirmed_at_timestamp__lt: Annotated[
            Optional[datetime],
            Field(
                description="Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format."
            ),
        ] = 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:
        """Querying of waybills

        Returns all waybills associated with your company, according to the specified filters.<br><br>         **NB!** By default, past 30 days according to the `dispatcher_timestamp` field waybills are returned. Use         `dispatcher_timestamp__lt` and `dispatcher_timestamp__gt` for filtering. Note that the maximum range is 30 days.

        :param destination_ids: Filters waybills with a specified list of destination IDs from your system. Multiple values may be separated by commas.
        :type destination_ids: str
        :param limit: Maximum number of objects to return per page
        :type limit: int
        :param offset: The initial index from which to return the results
        :type offset: int
        :param origin_ids: Filters waybills with a specified list of origin IDs from your systemMultiple values may be separated by commas.
        :type origin_ids: str
        :param raw_destination_ids: Filters waybills with a specified list of raw destination IDs. Multiple values may be separated by commas.
        :type raw_destination_ids: str
        :param raw_origin_ids: Filters waybills with a specified list of raw origin IDs. Multiple values may be separated by commas.
        :type raw_origin_ids: str
        :param transportation_cost_confirmed_at_timestamp__gt: Filters waybills with a transportation cost confirmed timestamp greater than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__gt: datetime
        :param transportation_cost_confirmed_at_timestamp__lt: Filters waybills with a transportation cost confirmed timestamp less than the specified value. The value must be in ISO 8601 format.
        :type transportation_cost_confirmed_at_timestamp__lt: datetime
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_list_serialize(
            destination_ids=destination_ids,
            limit=limit,
            offset=offset,
            origin_ids=origin_ids,
            raw_destination_ids=raw_destination_ids,
            raw_origin_ids=raw_origin_ids,
            transportation_cost_confirmed_at_timestamp__gt=transportation_cost_confirmed_at_timestamp__gt,
            transportation_cost_confirmed_at_timestamp__lt=transportation_cost_confirmed_at_timestamp__lt,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "PaginatedExternalAPIWaybillListList",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_list_serialize(
        self,
        destination_ids,
        limit,
        offset,
        origin_ids,
        raw_destination_ids,
        raw_origin_ids,
        transportation_cost_confirmed_at_timestamp__gt,
        transportation_cost_confirmed_at_timestamp__lt,
        _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 destination_ids is not None:
            _query_params.append(("destination_ids", destination_ids))

        if limit is not None:
            _query_params.append(("limit", limit))

        if offset is not None:
            _query_params.append(("offset", offset))

        if origin_ids is not None:
            _query_params.append(("origin_ids", origin_ids))

        if raw_destination_ids is not None:
            _query_params.append(("raw_destination_ids", raw_destination_ids))

        if raw_origin_ids is not None:
            _query_params.append(("raw_origin_ids", raw_origin_ids))

        if transportation_cost_confirmed_at_timestamp__gt is not None:
            if isinstance(transportation_cost_confirmed_at_timestamp__gt, datetime):
                _query_params.append(
                    (
                        "transportation_cost_confirmed_at_timestamp__gt",
                        transportation_cost_confirmed_at_timestamp__gt.strftime(
                            self.api_client.configuration.datetime_format
                        ),
                    )
                )
            else:
                _query_params.append(
                    (
                        "transportation_cost_confirmed_at_timestamp__gt",
                        transportation_cost_confirmed_at_timestamp__gt,
                    )
                )

        if transportation_cost_confirmed_at_timestamp__lt is not None:
            if isinstance(transportation_cost_confirmed_at_timestamp__lt, datetime):
                _query_params.append(
                    (
                        "transportation_cost_confirmed_at_timestamp__lt",
                        transportation_cost_confirmed_at_timestamp__lt.strftime(
                            self.api_client.configuration.datetime_format
                        ),
                    )
                )
            else:
                _query_params.append(
                    (
                        "transportation_cost_confirmed_at_timestamp__lt",
                        transportation_cost_confirmed_at_timestamp__lt,
                    )
                )

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/external-api/waybills/",
            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 waybills_refuse_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillRefuse:
        """Refusing waybill

        Marks waybill as `refused` in destination and sets the status of waybill to in progress again.         If new destination is provided, then new destination is set for the waybill.         Only the transportation company or receiving company of the waybill are authorized to refuse the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_refuse_request: (required)
        :type external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_refuse_update_serialize(
            id=id,
            external_api_waybill_refuse_request=external_api_waybill_refuse_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRefuse",
            "403": "DestinationsList403Response",
        }
        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 waybills_refuse_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillRefuse]:
        """Refusing waybill

        Marks waybill as `refused` in destination and sets the status of waybill to in progress again.         If new destination is provided, then new destination is set for the waybill.         Only the transportation company or receiving company of the waybill are authorized to refuse the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_refuse_request: (required)
        :type external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_refuse_update_serialize(
            id=id,
            external_api_waybill_refuse_request=external_api_waybill_refuse_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRefuse",
            "403": "DestinationsList403Response",
        }
        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 waybills_refuse_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Refusing waybill

        Marks waybill as `refused` in destination and sets the status of waybill to in progress again.         If new destination is provided, then new destination is set for the waybill.         Only the transportation company or receiving company of the waybill are authorized to refuse the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_refuse_request: (required)
        :type external_api_waybill_refuse_request: ExternalAPIWaybillRefuseRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_refuse_update_serialize(
            id=id,
            external_api_waybill_refuse_request=external_api_waybill_refuse_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRefuse",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_refuse_update_serialize(
        self,
        id,
        external_api_waybill_refuse_request,
        _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
        if external_api_waybill_refuse_request is not None:
            _body_params = external_api_waybill_refuse_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/refuse/",
            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 waybills_retrieve(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the waybill queried.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillRetrieve:
        """Querying of a single waybill

        Returns a waybill with the specified ID. Only companies associated with the waybill can query it.

        :param id: The ID of the waybill queried. (required)
        :type 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._waybills_retrieve_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": "ExternalAPIWaybillRetrieve",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        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 waybills_retrieve_with_http_info(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the waybill queried.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillRetrieve]:
        """Querying of a single waybill

        Returns a waybill with the specified ID. Only companies associated with the waybill can query it.

        :param id: The ID of the waybill queried. (required)
        :type 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._waybills_retrieve_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": "ExternalAPIWaybillRetrieve",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        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 waybills_retrieve_without_preload_content(
        self,
        id: Annotated[StrictStr, Field(description="The ID of the waybill queried.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Querying of a single waybill

        Returns a waybill with the specified ID. Only companies associated with the waybill can query it.

        :param id: The ID of the waybill queried. (required)
        :type 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._waybills_retrieve_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": "ExternalAPIWaybillRetrieve",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_retrieve_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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/external-api/waybills/{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
    def waybills_start_drive_create(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillStartDrive:
        """Starting driving

        Sets the status of a waybill to `in progress`. Waybill status has to be `created` to use this endpoint. Only         the transportation company or receiving company of the waybill are authorized to move waybill to `in         progress`.<br><br>         **NB!** Destination needs to belong to the receiving company in case the origin’s         `feature_waybill_destination_changing_disabled_for_drivers` flag is set to `True`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_start_drive_request: (required)
        :type external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_start_drive_create_serialize(
            id=id,
            external_api_waybill_start_drive_request=external_api_waybill_start_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillStartDrive",
            "403": "DestinationsList403Response",
        }
        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 waybills_start_drive_create_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillStartDrive]:
        """Starting driving

        Sets the status of a waybill to `in progress`. Waybill status has to be `created` to use this endpoint. Only         the transportation company or receiving company of the waybill are authorized to move waybill to `in         progress`.<br><br>         **NB!** Destination needs to belong to the receiving company in case the origin’s         `feature_waybill_destination_changing_disabled_for_drivers` flag is set to `True`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_start_drive_request: (required)
        :type external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_start_drive_create_serialize(
            id=id,
            external_api_waybill_start_drive_request=external_api_waybill_start_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillStartDrive",
            "403": "DestinationsList403Response",
        }
        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 waybills_start_drive_create_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Starting driving

        Sets the status of a waybill to `in progress`. Waybill status has to be `created` to use this endpoint. Only         the transportation company or receiving company of the waybill are authorized to move waybill to `in         progress`.<br><br>         **NB!** Destination needs to belong to the receiving company in case the origin’s         `feature_waybill_destination_changing_disabled_for_drivers` flag is set to `True`.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_start_drive_request: (required)
        :type external_api_waybill_start_drive_request: ExternalAPIWaybillStartDriveRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_start_drive_create_serialize(
            id=id,
            external_api_waybill_start_drive_request=external_api_waybill_start_drive_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillStartDrive",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_start_drive_create_serialize(
        self,
        id,
        external_api_waybill_start_drive_request,
        _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
        if external_api_waybill_start_drive_request is not None:
            _body_params = external_api_waybill_start_drive_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="POST",
            resource_path="/external-api/waybills/{id}/start_drive/",
            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 waybills_update_accepted_amounts_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillAcceptedAmounts:
        """Updating of accepted amounts

        Sets the accepted amounts for the waybill.         Optional `accepted_assortment_id` can be used when the accepted assortment differs from the dispatched one.         In this case, you must still provide `assortment_id` matching the dispatched assortment.         Authorized only for the receiving company of the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accepted_amounts_request: (required)
        :type external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_accepted_amounts_update_serialize(
            id=id,
            external_api_waybill_accepted_amounts_request=external_api_waybill_accepted_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAcceptedAmounts",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_accepted_amounts_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillAcceptedAmounts]:
        """Updating of accepted amounts

        Sets the accepted amounts for the waybill.         Optional `accepted_assortment_id` can be used when the accepted assortment differs from the dispatched one.         In this case, you must still provide `assortment_id` matching the dispatched assortment.         Authorized only for the receiving company of the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accepted_amounts_request: (required)
        :type external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_accepted_amounts_update_serialize(
            id=id,
            external_api_waybill_accepted_amounts_request=external_api_waybill_accepted_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAcceptedAmounts",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_accepted_amounts_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Updating of accepted amounts

        Sets the accepted amounts for the waybill.         Optional `accepted_assortment_id` can be used when the accepted assortment differs from the dispatched one.         In this case, you must still provide `assortment_id` matching the dispatched assortment.         Authorized only for the receiving company of the waybill.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_accepted_amounts_request: (required)
        :type external_api_waybill_accepted_amounts_request: ExternalAPIWaybillAcceptedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_accepted_amounts_update_serialize(
            id=id,
            external_api_waybill_accepted_amounts_request=external_api_waybill_accepted_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillAcceptedAmounts",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_update_accepted_amounts_update_serialize(
        self,
        id,
        external_api_waybill_accepted_amounts_request,
        _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
        if external_api_waybill_accepted_amounts_request is not None:
            _body_params = external_api_waybill_accepted_amounts_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/update_accepted_amounts/",
            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 waybills_update_custom_fields_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        request_body: Optional[
            Dict[str, Optional[WaybillsUpdateCustomFieldsUpdateRequestValue]]
        ] = 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,
    ) -> ExternalAPIWaybillRetrieve:
        """Updating custom fields

        Updates custom fields defined by the customer support.<br>         The values of the fields must match the type assigned to the field. If the field is of type `timestamp`,         the value must be an integer representing the timestamp in milliseconds.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param request_body:
        :type request_body: Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_custom_fields_update_serialize(
            id=id,
            request_body=request_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRetrieve",
            "303": "Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_custom_fields_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        request_body: Optional[
            Dict[str, Optional[WaybillsUpdateCustomFieldsUpdateRequestValue]]
        ] = 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[ExternalAPIWaybillRetrieve]:
        """Updating custom fields

        Updates custom fields defined by the customer support.<br>         The values of the fields must match the type assigned to the field. If the field is of type `timestamp`,         the value must be an integer representing the timestamp in milliseconds.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param request_body:
        :type request_body: Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_custom_fields_update_serialize(
            id=id,
            request_body=request_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRetrieve",
            "303": "Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_custom_fields_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        request_body: Optional[
            Dict[str, Optional[WaybillsUpdateCustomFieldsUpdateRequestValue]]
        ] = 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:
        """Updating custom fields

        Updates custom fields defined by the customer support.<br>         The values of the fields must match the type assigned to the field. If the field is of type `timestamp`,         the value must be an integer representing the timestamp in milliseconds.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param request_body:
        :type request_body: Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_custom_fields_update_serialize(
            id=id,
            request_body=request_body,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillRetrieve",
            "303": "Dict[str, WaybillsUpdateCustomFieldsUpdateRequestValue]",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_update_custom_fields_update_serialize(
        self,
        id,
        request_body,
        _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
        if request_body is not None:
            _body_params = request_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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/update_custom_fields/",
            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 waybills_update_dispatched_amounts_update(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillDispatchedAmounts:
        """Updating of dispatched amounts

        Updates dispatched amounts for the waybill.<br>         Generally only authorized for the origin company of the waybill,         unless the Waybiller team has given the key a permission to update the dispatched weights as a receiver as well.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_dispatched_amounts_request: (required)
        :type external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_dispatched_amounts_update_serialize(
            id=id,
            external_api_waybill_dispatched_amounts_request=external_api_waybill_dispatched_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillDispatchedAmounts",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_dispatched_amounts_update_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillDispatchedAmounts]:
        """Updating of dispatched amounts

        Updates dispatched amounts for the waybill.<br>         Generally only authorized for the origin company of the waybill,         unless the Waybiller team has given the key a permission to update the dispatched weights as a receiver as well.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_dispatched_amounts_request: (required)
        :type external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_dispatched_amounts_update_serialize(
            id=id,
            external_api_waybill_dispatched_amounts_request=external_api_waybill_dispatched_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillDispatchedAmounts",
            "403": "DestinationsList403Response",
        }
        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 waybills_update_dispatched_amounts_update_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Updating of dispatched amounts

        Updates dispatched amounts for the waybill.<br>         Generally only authorized for the origin company of the waybill,         unless the Waybiller team has given the key a permission to update the dispatched weights as a receiver as well.

        :param id: A unique integer value identifying this waybill. (required)
        :type id: int
        :param external_api_waybill_dispatched_amounts_request: (required)
        :type external_api_waybill_dispatched_amounts_request: ExternalAPIWaybillDispatchedAmountsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_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._waybills_update_dispatched_amounts_update_serialize(
            id=id,
            external_api_waybill_dispatched_amounts_request=external_api_waybill_dispatched_amounts_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index,
        )

        _response_types_map: Dict[str, Optional[str]] = {
            "200": "ExternalAPIWaybillDispatchedAmounts",
            "403": "DestinationsList403Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_update_dispatched_amounts_update_serialize(
        self,
        id,
        external_api_waybill_dispatched_amounts_request,
        _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
        if external_api_waybill_dispatched_amounts_request is not None:
            _body_params = external_api_waybill_dispatched_amounts_request

        # 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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="PUT",
            resource_path="/external-api/waybills/{id}/update_dispatched_amounts/",
            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 waybills_vehicle_location_data_retrieve(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ExternalAPIWaybillVehicleLocation:
        """Querying of vehicle location data

        Returns vehicle location data.

        :param id: A unique integer value identifying this waybill. (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._waybills_vehicle_location_data_retrieve_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": "ExternalAPIWaybillVehicleLocation",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        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 waybills_vehicle_location_data_retrieve_with_http_info(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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[ExternalAPIWaybillVehicleLocation]:
        """Querying of vehicle location data

        Returns vehicle location data.

        :param id: A unique integer value identifying this waybill. (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._waybills_vehicle_location_data_retrieve_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": "ExternalAPIWaybillVehicleLocation",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        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 waybills_vehicle_location_data_retrieve_without_preload_content(
        self,
        id: Annotated[
            StrictInt,
            Field(description="A unique integer value identifying this waybill."),
        ],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
            ],
        ] = None,
        _request_auth: Optional[Dict[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:
        """Querying of vehicle location data

        Returns vehicle location data.

        :param id: A unique integer value identifying this waybill. (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._waybills_vehicle_location_data_retrieve_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": "ExternalAPIWaybillVehicleLocation",
            "403": "DestinationsList403Response",
            "404": "EmploymentsRetrieve404Response",
        }
        response_data = self.api_client.call_api(
            *_param, _request_timeout=_request_timeout
        )
        return response_data.response

    def _waybills_vehicle_location_data_retrieve_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] = ["ApiKeyAuth"]

        return self.api_client.param_serialize(
            method="GET",
            resource_path="/external-api/waybills/{id}/vehicle_location_data/",
            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,
        )
