# coding: utf-8

"""
    Marqeta Core API

    Simplified management of your payment programs  # noqa: E501

    The version of the OpenAPI document: 3.0.0
    Contact: dev@swadesh.co
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


import re  # noqa: F401

from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated

from pydantic import Field, StrictBool, StrictInt, StrictStr

from typing import Optional

from marqeta_client.models.transaction_model import TransactionModel
from marqeta_client.models.transaction_model_list_response import TransactionModelListResponse

from marqeta_client.api_client import ApiClient
from marqeta_client.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class TransactionsApi(object):
    """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):
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client

    @validate_arguments
    def get_transactions(self, count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, user_token : Annotated[Optional[StrictStr], Field(description="User token")] = None, business_token : Annotated[Optional[StrictStr], Field(description="Business token")] = None, acting_user_token : Annotated[Optional[StrictStr], Field(description="Acting user token")] = None, card_token : Annotated[Optional[StrictStr], Field(description="Card token")] = None, merchant_token : Annotated[Optional[StrictStr], Field(description="Merchant token")] = None, campaign_token : Annotated[Optional[StrictStr], Field(description="Campaign token")] = None, state : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | DECLINED | ERROR | ALL")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, start_identifier : Annotated[Optional[StrictInt], Field(description="Start identifier")] = None, **kwargs) -> TransactionModelListResponse:  # noqa: E501
        """Returns transactions  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions(count, start_index, fields, sort_by, start_date, end_date, type, user_token, business_token, acting_user_token, card_token, merchant_token, campaign_token, state, version, verbose, start_identifier, async_req=True)
        >>> result = thread.get()

        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param user_token: User token
        :type user_token: str
        :param business_token: Business token
        :type business_token: str
        :param acting_user_token: Acting user token
        :type acting_user_token: str
        :param card_token: Card token
        :type card_token: str
        :param merchant_token: Merchant token
        :type merchant_token: str
        :param campaign_token: Campaign token
        :type campaign_token: str
        :param state: Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | DECLINED | ERROR | ALL
        :type state: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param start_identifier: Start identifier
        :type start_identifier: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: TransactionModelListResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transactions_with_http_info(count, start_index, fields, sort_by, start_date, end_date, type, user_token, business_token, acting_user_token, card_token, merchant_token, campaign_token, state, version, verbose, start_identifier, **kwargs)  # noqa: E501

    @validate_arguments
    def get_transactions_with_http_info(self, count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, user_token : Annotated[Optional[StrictStr], Field(description="User token")] = None, business_token : Annotated[Optional[StrictStr], Field(description="Business token")] = None, acting_user_token : Annotated[Optional[StrictStr], Field(description="Acting user token")] = None, card_token : Annotated[Optional[StrictStr], Field(description="Card token")] = None, merchant_token : Annotated[Optional[StrictStr], Field(description="Merchant token")] = None, campaign_token : Annotated[Optional[StrictStr], Field(description="Campaign token")] = None, state : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | DECLINED | ERROR | ALL")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, start_identifier : Annotated[Optional[StrictInt], Field(description="Start identifier")] = None, **kwargs):  # noqa: E501
        """Returns transactions  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_with_http_info(count, start_index, fields, sort_by, start_date, end_date, type, user_token, business_token, acting_user_token, card_token, merchant_token, campaign_token, state, version, verbose, start_identifier, async_req=True)
        >>> result = thread.get()

        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param user_token: User token
        :type user_token: str
        :param business_token: Business token
        :type business_token: str
        :param acting_user_token: Acting user token
        :type acting_user_token: str
        :param card_token: Card token
        :type card_token: str
        :param merchant_token: Merchant token
        :type merchant_token: str
        :param campaign_token: Campaign token
        :type campaign_token: str
        :param state: Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | DECLINED | ERROR | ALL
        :type state: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param start_identifier: Start identifier
        :type start_identifier: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(TransactionModelListResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'count',
            'start_index',
            'fields',
            'sort_by',
            'start_date',
            'end_date',
            'type',
            'user_token',
            'business_token',
            'acting_user_token',
            'card_token',
            'merchant_token',
            'campaign_token',
            'state',
            'version',
            'verbose',
            'start_identifier'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transactions" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('count') is not None:  # noqa: E501
            _query_params.append(('count', _params['count']))

        if _params.get('start_index') is not None:  # noqa: E501
            _query_params.append(('start_index', _params['start_index']))

        if _params.get('fields') is not None:  # noqa: E501
            _query_params.append(('fields', _params['fields']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sort_by', _params['sort_by'].value))

        if _params.get('start_date') is not None:  # noqa: E501
            _query_params.append(('start_date', _params['start_date']))

        if _params.get('end_date') is not None:  # noqa: E501
            _query_params.append(('end_date', _params['end_date']))

        if _params.get('type') is not None:  # noqa: E501
            _query_params.append(('type', _params['type']))

        if _params.get('user_token') is not None:  # noqa: E501
            _query_params.append(('user_token', _params['user_token']))

        if _params.get('business_token') is not None:  # noqa: E501
            _query_params.append(('business_token', _params['business_token']))

        if _params.get('acting_user_token') is not None:  # noqa: E501
            _query_params.append(('acting_user_token', _params['acting_user_token']))

        if _params.get('card_token') is not None:  # noqa: E501
            _query_params.append(('card_token', _params['card_token']))

        if _params.get('merchant_token') is not None:  # noqa: E501
            _query_params.append(('merchant_token', _params['merchant_token']))

        if _params.get('campaign_token') is not None:  # noqa: E501
            _query_params.append(('campaign_token', _params['campaign_token']))

        if _params.get('state') is not None:  # noqa: E501
            _query_params.append(('state', _params['state']))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        if _params.get('verbose') is not None:  # noqa: E501
            _query_params.append(('verbose', _params['verbose']))

        if _params.get('start_identifier') is not None:  # noqa: E501
            _query_params.append(('start_identifier', _params['start_identifier']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "TransactionModelListResponse",
            '400': None,
            '500': None,
        }

        return self.api_client.call_api(
            '/transactions', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def get_transactions_fundingsource_fundingsourcetoken(self, funding_source_token : Annotated[StrictStr, Field(..., description="Funding account token")], count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, polarity : Annotated[Optional[StrictStr], Field(description="Type of transactions to retrieve: CREDIT or DEBIT")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs) -> TransactionModelListResponse:  # noqa: E501
        """Returns transactions for a specific funding account  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_fundingsource_fundingsourcetoken(funding_source_token, count, start_index, fields, sort_by, start_date, end_date, type, polarity, version, verbose, async_req=True)
        >>> result = thread.get()

        :param funding_source_token: Funding account token (required)
        :type funding_source_token: str
        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param polarity: Type of transactions to retrieve: CREDIT or DEBIT
        :type polarity: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: TransactionModelListResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transactions_fundingsource_fundingsourcetoken_with_http_info(funding_source_token, count, start_index, fields, sort_by, start_date, end_date, type, polarity, version, verbose, **kwargs)  # noqa: E501

    @validate_arguments
    def get_transactions_fundingsource_fundingsourcetoken_with_http_info(self, funding_source_token : Annotated[StrictStr, Field(..., description="Funding account token")], count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, polarity : Annotated[Optional[StrictStr], Field(description="Type of transactions to retrieve: CREDIT or DEBIT")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs):  # noqa: E501
        """Returns transactions for a specific funding account  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_fundingsource_fundingsourcetoken_with_http_info(funding_source_token, count, start_index, fields, sort_by, start_date, end_date, type, polarity, version, verbose, async_req=True)
        >>> result = thread.get()

        :param funding_source_token: Funding account token (required)
        :type funding_source_token: str
        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param polarity: Type of transactions to retrieve: CREDIT or DEBIT
        :type polarity: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(TransactionModelListResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'funding_source_token',
            'count',
            'start_index',
            'fields',
            'sort_by',
            'start_date',
            'end_date',
            'type',
            'polarity',
            'version',
            'verbose'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transactions_fundingsource_fundingsourcetoken" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['funding_source_token']:
            _path_params['funding_source_token'] = _params['funding_source_token']


        # process the query parameters
        _query_params = []
        if _params.get('count') is not None:  # noqa: E501
            _query_params.append(('count', _params['count']))

        if _params.get('start_index') is not None:  # noqa: E501
            _query_params.append(('start_index', _params['start_index']))

        if _params.get('fields') is not None:  # noqa: E501
            _query_params.append(('fields', _params['fields']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sort_by', _params['sort_by'].value))

        if _params.get('start_date') is not None:  # noqa: E501
            _query_params.append(('start_date', _params['start_date']))

        if _params.get('end_date') is not None:  # noqa: E501
            _query_params.append(('end_date', _params['end_date']))

        if _params.get('type') is not None:  # noqa: E501
            _query_params.append(('type', _params['type']))

        if _params.get('polarity') is not None:  # noqa: E501
            _query_params.append(('polarity', _params['polarity'].value))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        if _params.get('verbose') is not None:  # noqa: E501
            _query_params.append(('verbose', _params['verbose']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "TransactionModelListResponse",
            '400': None,
            '500': None,
        }

        return self.api_client.call_api(
            '/transactions/fundingsource/{funding_source_token}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def get_transactions_token(self, token : Annotated[StrictStr, Field(..., description="Transaction token")], fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs) -> TransactionModel:  # noqa: E501
        """Returns a transaction  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_token(token, fields, version, verbose, async_req=True)
        >>> result = thread.get()

        :param token: Transaction token (required)
        :type token: str
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: TransactionModel
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transactions_token_with_http_info(token, fields, version, verbose, **kwargs)  # noqa: E501

    @validate_arguments
    def get_transactions_token_with_http_info(self, token : Annotated[StrictStr, Field(..., description="Transaction token")], fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs):  # noqa: E501
        """Returns a transaction  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_token_with_http_info(token, fields, version, verbose, async_req=True)
        >>> result = thread.get()

        :param token: Transaction token (required)
        :type token: str
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(TransactionModel, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'fields',
            'version',
            'verbose'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transactions_token" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['token']:
            _path_params['token'] = _params['token']


        # process the query parameters
        _query_params = []
        if _params.get('fields') is not None:  # noqa: E501
            _query_params.append(('fields', _params['fields']))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        if _params.get('verbose') is not None:  # noqa: E501
            _query_params.append(('verbose', _params['verbose']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "TransactionModel",
            '400': None,
            '404': None,
            '500': None,
        }

        return self.api_client.call_api(
            '/transactions/{token}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def get_transactions_token_related(self, token : Annotated[StrictStr, Field(..., description="Transaction token")], count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, state : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | ALL")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs) -> TransactionModelListResponse:  # noqa: E501
        """Returns related transactions  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_token_related(token, count, start_index, fields, sort_by, start_date, end_date, type, state, version, verbose, async_req=True)
        >>> result = thread.get()

        :param token: Transaction token (required)
        :type token: str
        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param state: Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | ALL
        :type state: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: TransactionModelListResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transactions_token_related_with_http_info(token, count, start_index, fields, sort_by, start_date, end_date, type, state, version, verbose, **kwargs)  # noqa: E501

    @validate_arguments
    def get_transactions_token_related_with_http_info(self, token : Annotated[StrictStr, Field(..., description="Transaction token")], count : Annotated[Optional[StrictInt], Field(description="Number of transactions to retrieve")] = None, start_index : Annotated[Optional[StrictInt], Field(description="Start index")] = None, fields : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.")] = None, sort_by : Annotated[Optional[StrictStr], Field(description="Sort order")] = None, start_date : Annotated[Optional[StrictStr], Field(description="Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, end_date : Annotated[Optional[StrictStr], Field(description="End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)")] = None, type : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction types to include")] = None, state : Annotated[Optional[StrictStr], Field(description="Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | ALL")] = None, version : Optional[StrictStr] = None, verbose : Optional[StrictBool] = None, **kwargs):  # noqa: E501
        """Returns related transactions  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transactions_token_related_with_http_info(token, count, start_index, fields, sort_by, start_date, end_date, type, state, version, verbose, async_req=True)
        >>> result = thread.get()

        :param token: Transaction token (required)
        :type token: str
        :param count: Number of transactions to retrieve
        :type count: int
        :param start_index: Start index
        :type start_index: int
        :param fields: Comma-delimited list of fields to return (e.g. field_1,field_2,..). Leave blank to return all fields.
        :type fields: str
        :param sort_by: Sort order
        :type sort_by: str
        :param start_date: Start date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type start_date: str
        :param end_date: End date (yyyy-MM-dd | yyyy-MM-ddTHH:mm:ss.SS)
        :type end_date: str
        :param type: Comma-delimited list of transaction types to include
        :type type: str
        :param state: Comma-delimited list of transaction states to display e.g. PENDING | CLEARED | COMPLETION | ALL
        :type state: str
        :param version:
        :type version: str
        :param verbose:
        :type verbose: bool
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(TransactionModelListResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'token',
            'count',
            'start_index',
            'fields',
            'sort_by',
            'start_date',
            'end_date',
            'type',
            'state',
            'version',
            'verbose'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transactions_token_related" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['token']:
            _path_params['token'] = _params['token']


        # process the query parameters
        _query_params = []
        if _params.get('count') is not None:  # noqa: E501
            _query_params.append(('count', _params['count']))

        if _params.get('start_index') is not None:  # noqa: E501
            _query_params.append(('start_index', _params['start_index']))

        if _params.get('fields') is not None:  # noqa: E501
            _query_params.append(('fields', _params['fields']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sort_by', _params['sort_by'].value))

        if _params.get('start_date') is not None:  # noqa: E501
            _query_params.append(('start_date', _params['start_date']))

        if _params.get('end_date') is not None:  # noqa: E501
            _query_params.append(('end_date', _params['end_date']))

        if _params.get('type') is not None:  # noqa: E501
            _query_params.append(('type', _params['type']))

        if _params.get('state') is not None:  # noqa: E501
            _query_params.append(('state', _params['state']))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        if _params.get('verbose') is not None:  # noqa: E501
            _query_params.append(('verbose', _params['verbose']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = []  # noqa: E501

        _response_types_map = {
            '200': "TransactionModelListResponse",
            '400': None,
            '500': None,
        }

        return self.api_client.call_api(
            '/transactions/{token}/related', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
