"""
    Cloudbeds Accounting Service API

    The Cloudbeds Accounting Service API provides programmatic access to financial data and operations for hospitality properties. Use this API to manage transactions, folios, deposits, accounts receivable ledgers, trial balances, and related accounting configuration.  **Key concepts:** - **Transactions** represent individual financial entries (charges, payments,   taxes, fees) associated with a source such as a reservation, group profile,   or house account.  - **Folios** organize transactions into logical groups within a source. You   can create custom folios and move or route transactions between them.  - **Source Balances** provide a real-time financial summary (charges, payments,   balance due, tax/fee breakdowns) for a reservation, group profile, house   account, or accounts receivable ledger.  - **Accounts Receivable (AR) Ledgers** track outstanding balances that have   been transferred from reservations or group profiles for later collection.  - **Trial Balance** is a daily financial reconciliation report that summarizes   ledger activity across guest, deposit, and AR ledgers.  - **Custom Codes** let you map Cloudbeds internal transaction codes to your   own chart-of-accounts codes and general ledger codes.   **Authentication:** All endpoints require a valid OAuth2 bearer token. Endpoints are protected by scopes: `read:payment` for read operations and `write:payment` for mutating operations. A few search endpoints use POST with a request body to support complex filter criteria; these require the `read:payment` scope.  **Base URL:** Use `https://api.cloudbeds.com` for production and `https://api.cloudbeds-stage.com` for staging. All endpoint paths are prefixed with `/accounting/v1.0`.  **Property context:** Every request must include the `X-Property-ID` header to identify which property the request applies to.  **Monetary amounts:** Unless otherwise noted, monetary amounts are expressed in the smallest currency unit (e.g., cents for USD). Use the `currencyScale` field to determine the number of decimal places.  **Pagination:** Paginated endpoints return a `nextPageToken` value. Pass this token in subsequent requests to retrieve the next page of results. When `nextPageToken` is null or absent, you have reached the last page. 

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

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


import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictInt
from typing_extensions import Annotated
from cloudbeds_accounting.models.list_pending_transactions_paginated import ListPendingTransactionsPaginated
from cloudbeds_accounting.models.list_pending_transactions_request import ListPendingTransactionsRequest
from cloudbeds_accounting.models.list_transactions_paginated import ListTransactionsPaginated
from cloudbeds_accounting.models.list_transactions_request import ListTransactionsRequest

from cloudbeds_accounting.api_client import ApiClient, RequestSerialized
from cloudbeds_accounting.api_response import ApiResponse
from cloudbeds_accounting.rest import RESTResponseType


class TransactionsApi:
    """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 list_pending_transactions(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_pending_transactions_request: ListPendingTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ListPendingTransactionsPaginated:
        """Search pending transactions

        Search and retrieve pending (not yet posted) transactions for a property. Pending transactions represent charges, payments, or adjustments that have been created but not yet finalized. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. The filter and sort options are the same as for posted transactions.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_pending_transactions_request: (required)
        :type list_pending_transactions_request: ListPendingTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_pending_transactions_serialize(
            x_property_id=x_property_id,
            list_pending_transactions_request=list_pending_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListPendingTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_pending_transactions_with_http_info(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_pending_transactions_request: ListPendingTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[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[ListPendingTransactionsPaginated]:
        """Search pending transactions

        Search and retrieve pending (not yet posted) transactions for a property. Pending transactions represent charges, payments, or adjustments that have been created but not yet finalized. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. The filter and sort options are the same as for posted transactions.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_pending_transactions_request: (required)
        :type list_pending_transactions_request: ListPendingTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_pending_transactions_serialize(
            x_property_id=x_property_id,
            list_pending_transactions_request=list_pending_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListPendingTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def list_pending_transactions_without_preload_content(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_pending_transactions_request: ListPendingTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[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:
        """Search pending transactions

        Search and retrieve pending (not yet posted) transactions for a property. Pending transactions represent charges, payments, or adjustments that have been created but not yet finalized. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. The filter and sort options are the same as for posted transactions.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_pending_transactions_request: (required)
        :type list_pending_transactions_request: ListPendingTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_pending_transactions_serialize(
            x_property_id=x_property_id,
            list_pending_transactions_request=list_pending_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListPendingTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _list_pending_transactions_serialize(
        self,
        x_property_id,
        list_pending_transactions_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
        if x_property_id is not None:
            _header_params['X-Property-ID'] = x_property_id
        # process the form parameters
        # process the body parameter
        if list_pending_transactions_request is not None:
            _body_params = list_pending_transactions_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] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/accounting/v1.0/pending-transactions',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def list_transactions(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_transactions_request: ListTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ListTransactionsPaginated:
        """Search posted transactions

        Search and retrieve posted transactions for a property. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. You can combine multiple filters with AND/OR logic, paginate results, and sort by various fields.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_transactions_request: (required)
        :type list_transactions_request: ListTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_transactions_serialize(
            x_property_id=x_property_id,
            list_transactions_request=list_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def list_transactions_with_http_info(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_transactions_request: ListTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[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[ListTransactionsPaginated]:
        """Search posted transactions

        Search and retrieve posted transactions for a property. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. You can combine multiple filters with AND/OR logic, paginate results, and sort by various fields.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_transactions_request: (required)
        :type list_transactions_request: ListTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_transactions_serialize(
            x_property_id=x_property_id,
            list_transactions_request=list_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def list_transactions_without_preload_content(
        self,
        x_property_id: Annotated[StrictInt, Field(description="Unique identifier of the property. Required for all requests to scope data to a specific property. ")],
        list_transactions_request: ListTransactionsRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[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:
        """Search posted transactions

        Search and retrieve posted transactions for a property. This endpoint uses POST (instead of GET) to support complex filter criteria in the request body. You can combine multiple filters with AND/OR logic, paginate results, and sort by various fields.  Supported fields for filtering:   - account_category   - chart_of_account_type   - created_at - Same as `transaction_datetime`   - customer_id   - custom_code   - external_relation_id   - external_relation_kind   - folio_id   - id   - internal_code   - origin_id   - parent_id   - routed_from   - source_id   - source_identifier   - source_kind   - transaction_datetime   - trial_balance_id   - service_date  Supported fields for sorting:   - created_at - Same as `transaction_datetime`   - id   - internal_code   - source_id   - transaction_datetime   - service_date  Example request: ```   {     \"filters\": {       \"and\": [         {           \"operator\": \"greater_than_or_equal\",           \"value\": \"2019-01-11t08:59:00Z\",           \"field\": \"transaction_datetime\"         },         {           \"operator\": \"equals\",           \"value\": \"123\",           \"field\": \"source_id\"         },         {           \"operator\": \"equals\",           \"value\": \"RESERVATION\",           \"field\": \"source_kind\"         },         {           \"or\": [             {               \"operator\": \"in\",               \"value\": [\"1\", \"2\", \"3\"],               \"field\": \"customer_id\"             },             {               \"operator\": \"equals\",               \"value\": \"9000\",               \"field\": \"internal_code\"             }           ]         }       ]     },     \"pageToken\": null,     \"limit\": 10,     \"sort\": [       {         \"field\": \"transaction_datetime\",         \"direction\": \"asc\"       }     ]   }  The API has certain constraints for filters so that the system is able to efficiently query the data. Filters must include on of the following:   - filter by 'id' with condition 'equals' or 'in'   - filter by both 'source_id' and 'source_kind'   - filter by both 'external_relation_id' and 'external_relation_kind'   - filter by transaction_datetime ``` 

        :param x_property_id: Unique identifier of the property. Required for all requests to scope data to a specific property.  (required)
        :type x_property_id: int
        :param list_transactions_request: (required)
        :type list_transactions_request: ListTransactionsRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._list_transactions_serialize(
            x_property_id=x_property_id,
            list_transactions_request=list_transactions_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ListTransactionsPaginated",
            '400': "ApiAccountingError",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _list_transactions_serialize(
        self,
        x_property_id,
        list_transactions_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
        if x_property_id is not None:
            _header_params['X-Property-ID'] = x_property_id
        # process the form parameters
        # process the body parameter
        if list_transactions_request is not None:
            _body_params = list_transactions_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] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/accounting/v1.0/transactions',
            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
        )


