# coding: utf-8

"""
    PAY.JP API v2

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 2.0.0
    Contact: support@pay.jp
    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 datetime import datetime
from pydantic import Field, StrictBool, StrictStr
from typing import Optional
from typing_extensions import Annotated
from payjpv2.models.balance_list_response import BalanceListResponse
from payjpv2.models.balance_response import BalanceResponse
from payjpv2.models.balance_state import BalanceState
from payjpv2.models.balance_url_response import BalanceURLResponse

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


class BalancesApi:
    """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 create_balance_url(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> BalanceURLResponse:
        """Create Balance Url


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_balance_url_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceURLResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_balance_url_with_http_info(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[BalanceURLResponse]:
        """Create Balance Url


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_balance_url_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceURLResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def create_balance_url_without_preload_content(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Create Balance Url


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_balance_url_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceURLResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _create_balance_url_serialize(
        self,
        balance_id,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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 balance_id is not None:
            _path_params['balance_id'] = balance_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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v2/balances/{balance_id}/balance_urls',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_all_balances(
        self,
        since: Annotated[Optional[datetime], Field(description="指定した日付以降のデータを取得")] = None,
        until: Annotated[Optional[datetime], Field(description="指定した日付以前のデータを取得")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = None,
        state: Annotated[Optional[BalanceState], Field(description="state が指定した値であるオブジェクトに限定")] = None,
        closed: Annotated[Optional[StrictBool], Field(description="closed が指定した値であるオブジェクトに限定")] = None,
        since_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以降のデータのみ取得")] = None,
        until_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以前のデータのみ取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> BalanceListResponse:
        """Get All Balances


        :param since: 指定した日付以降のデータを取得
        :type since: datetime
        :param until: 指定した日付以前のデータを取得
        :type until: datetime
        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :param state: state が指定した値であるオブジェクトに限定
        :type state: BalanceState
        :param closed: closed が指定した値であるオブジェクトに限定
        :type closed: bool
        :param since_due_date: 入金予定日/振込期限日が指定した日時以降のデータのみ取得
        :type since_due_date: datetime
        :param until_due_date: 入金予定日/振込期限日が指定した日時以前のデータのみ取得
        :type until_due_date: 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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_all_balances_serialize(
            since=since,
            until=until,
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            state=state,
            closed=closed,
            since_due_date=since_due_date,
            until_due_date=until_due_date,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

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


    @validate_call
    def get_all_balances_with_http_info(
        self,
        since: Annotated[Optional[datetime], Field(description="指定した日付以降のデータを取得")] = None,
        until: Annotated[Optional[datetime], Field(description="指定した日付以前のデータを取得")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = None,
        state: Annotated[Optional[BalanceState], Field(description="state が指定した値であるオブジェクトに限定")] = None,
        closed: Annotated[Optional[StrictBool], Field(description="closed が指定した値であるオブジェクトに限定")] = None,
        since_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以降のデータのみ取得")] = None,
        until_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以前のデータのみ取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[BalanceListResponse]:
        """Get All Balances


        :param since: 指定した日付以降のデータを取得
        :type since: datetime
        :param until: 指定した日付以前のデータを取得
        :type until: datetime
        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :param state: state が指定した値であるオブジェクトに限定
        :type state: BalanceState
        :param closed: closed が指定した値であるオブジェクトに限定
        :type closed: bool
        :param since_due_date: 入金予定日/振込期限日が指定した日時以降のデータのみ取得
        :type since_due_date: datetime
        :param until_due_date: 入金予定日/振込期限日が指定した日時以前のデータのみ取得
        :type until_due_date: 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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_all_balances_serialize(
            since=since,
            until=until,
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            state=state,
            closed=closed,
            since_due_date=since_due_date,
            until_due_date=until_due_date,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

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


    @validate_call
    def get_all_balances_without_preload_content(
        self,
        since: Annotated[Optional[datetime], Field(description="指定した日付以降のデータを取得")] = None,
        until: Annotated[Optional[datetime], Field(description="指定した日付以前のデータを取得")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="取得するデータの最大件数")] = None,
        starting_after: Annotated[Optional[StrictStr], Field(description="このIDより後のデータを取得")] = None,
        ending_before: Annotated[Optional[StrictStr], Field(description="このIDより前のデータを取得")] = None,
        state: Annotated[Optional[BalanceState], Field(description="state が指定した値であるオブジェクトに限定")] = None,
        closed: Annotated[Optional[StrictBool], Field(description="closed が指定した値であるオブジェクトに限定")] = None,
        since_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以降のデータのみ取得")] = None,
        until_due_date: Annotated[Optional[datetime], Field(description="入金予定日/振込期限日が指定した日時以前のデータのみ取得")] = 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,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get All Balances


        :param since: 指定した日付以降のデータを取得
        :type since: datetime
        :param until: 指定した日付以前のデータを取得
        :type until: datetime
        :param limit: 取得するデータの最大件数
        :type limit: int
        :param starting_after: このIDより後のデータを取得
        :type starting_after: str
        :param ending_before: このIDより前のデータを取得
        :type ending_before: str
        :param state: state が指定した値であるオブジェクトに限定
        :type state: BalanceState
        :param closed: closed が指定した値であるオブジェクトに限定
        :type closed: bool
        :param since_due_date: 入金予定日/振込期限日が指定した日時以降のデータのみ取得
        :type since_due_date: datetime
        :param until_due_date: 入金予定日/振込期限日が指定した日時以前のデータのみ取得
        :type until_due_date: 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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_all_balances_serialize(
            since=since,
            until=until,
            limit=limit,
            starting_after=starting_after,
            ending_before=ending_before,
            state=state,
            closed=closed,
            since_due_date=since_due_date,
            until_due_date=until_due_date,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

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


    def _get_all_balances_serialize(
        self,
        since,
        until,
        limit,
        starting_after,
        ending_before,
        state,
        closed,
        since_due_date,
        until_due_date,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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 since is not None:
            if isinstance(since, datetime):
                _query_params.append(
                    (
                        'since',
                        since.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('since', since))
            
        if until is not None:
            if isinstance(until, datetime):
                _query_params.append(
                    (
                        'until',
                        until.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('until', until))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if starting_after is not None:
            
            _query_params.append(('starting_after', starting_after))
            
        if ending_before is not None:
            
            _query_params.append(('ending_before', ending_before))
            
        if state is not None:
            
            _query_params.append(('state', state.value))
            
        if closed is not None:
            
            _query_params.append(('closed', closed))
            
        if since_due_date is not None:
            if isinstance(since_due_date, datetime):
                _query_params.append(
                    (
                        'since_due_date',
                        since_due_date.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('since_due_date', since_due_date))
            
        if until_due_date is not None:
            if isinstance(until_due_date, datetime):
                _query_params.append(
                    (
                        'until_due_date',
                        until_due_date.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('until_due_date', until_due_date))
            
        # 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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v2/balances',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_balance(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> BalanceResponse:
        """Get Balance


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_balance_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_balance_with_http_info(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[BalanceResponse]:
        """Get Balance


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_balance_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_balance_without_preload_content(
        self,
        balance_id: StrictStr,
        *,
        request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth: Optional[Dict[StrictStr, Any]] = None,
        headers: Optional[Dict[StrictStr, Any]] = None,
        idempotency_key: Optional[StrictStr] = None,
        host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Balance


        :param balance_id: (required)
        :type balance_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 headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type headers: dict, optional
        :param idempotency_key: an idempotency key for the request.
                                 used to ensure the request is only processed once.
        :type idempotency_key: str, optional
        :param host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_balance_serialize(
            balance_id=balance_id,
            _request_auth=request_auth,
            _content_type='application/json',
            _headers=headers,
            _idempotency_key=idempotency_key,
            _host_index=host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "BalanceResponse",
            '422': "ErrorResponse",
            '404': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=request_timeout
        )
        return response_data.response


    def _get_balance_serialize(
        self,
        balance_id,
        _request_auth,
        _content_type,
        _headers,
        _idempotency_key,
        _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 {}
        if _idempotency_key is not None:
            _header_params['Idempotency-Key'] = _idempotency_key
        _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 balance_id is not None:
            _path_params['balance_id'] = balance_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', 
                    'application/problem+json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBasic', 
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v2/balances/{balance_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
        )


