# This file was auto-generated by Fern from our API Definition.

import typing
from json.decoder import JSONDecodeError

from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.http_response import AsyncHttpResponse, HttpResponse
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..core.serialization import convert_and_respect_annotation_metadata
from ..errors.bad_request_error import BadRequestError
from ..errors.internal_server_error import InternalServerError
from ..errors.service_unavailable_error import ServiceUnavailableError
from ..errors.unauthorized_error import UnauthorizedError
from ..types.annualrevenue import Annualrevenue
from ..types.application_details_record import ApplicationDetailsRecord
from ..types.application_query_record import ApplicationQueryRecord
from ..types.attachments import Attachments
from ..types.avgmonthly import Avgmonthly
from ..types.baddress_1 import Baddress1
from ..types.baddress_2 import Baddress2
from ..types.bank import Bank
from ..types.bcity import Bcity
from ..types.bcountry import Bcountry
from ..types.binperson import Binperson
from ..types.binphone import Binphone
from ..types.binweb import Binweb
from ..types.boarding_business_fax import BoardingBusinessFax
from ..types.boarding_business_phone import BoardingBusinessPhone
from ..types.boarding_link_query_record import BoardingLinkQueryRecord
from ..types.bstate import Bstate
from ..types.bsummary import Bsummary
from ..types.busstartdate import Busstartdate
from ..types.bzip import Bzip
from ..types.contacts_field import ContactsField
from ..types.dbaname import Dbaname
from ..types.ein import Ein
from ..types.email import Email
from ..types.export_format import ExportFormat
from ..types.external_paypoint_id import ExternalPaypointId
from ..types.highticketamt import Highticketamt
from ..types.legalname import Legalname
from ..types.license import License
from ..types.licensestate import Licensestate
from ..types.maddress import Maddress
from ..types.maddress_1 import Maddress1
from ..types.mcc import Mcc
from ..types.mcity import Mcity
from ..types.mcountry import Mcountry
from ..types.mstate import Mstate
from ..types.mzip import Mzip
from ..types.orgid import Orgid
from ..types.own_type import OwnType
from ..types.ownership import Ownership
from ..types.payabli_api_response import PayabliApiResponse
from ..types.payabli_api_response_00 import PayabliApiResponse00
from ..types.payabli_api_response_00_responsedatanonobject import PayabliApiResponse00Responsedatanonobject
from ..types.payout_average_monthly_volume import PayoutAverageMonthlyVolume
from ..types.payout_average_ticket_limit import PayoutAverageTicketLimit
from ..types.payout_credit_limit import PayoutCreditLimit
from ..types.payout_high_ticket_amount import PayoutHighTicketAmount
from ..types.query_boarding_apps_list_response import QueryBoardingAppsListResponse
from ..types.query_boarding_links_response import QueryBoardingLinksResponse
from ..types.recipient_email_notification import RecipientEmailNotification
from ..types.rep_code import RepCode
from ..types.rep_name import RepName
from ..types.rep_office import RepOffice
from ..types.resumable import Resumable
from ..types.services import Services
from ..types.signer_data_request import SignerDataRequest
from ..types.taxfillname import Taxfillname
from ..types.template_id import TemplateId
from ..types.ticketamt import Ticketamt
from ..types.website import Website
from ..types.whencharged import Whencharged
from ..types.whendelivered import Whendelivered
from ..types.whenprovided import Whenprovided
from ..types.whenrefunded import Whenrefunded
from .types.add_application_request import AddApplicationRequest

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class RawBoardingClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def add_application(
        self, *, request: AddApplicationRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Creates a boarding application in an organization. This endpoint requires an application API token.

        Parameters
        ----------
        request : AddApplicationRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            "Boarding/app",
            method="POST",
            json=convert_and_respect_annotation_metadata(
                object_=request, annotation=AddApplicationRequest, direction="write"
            ),
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def delete_application(
        self, app_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Deletes a boarding application by ID.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/app/{jsonable_encoder(app_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_application(
        self, app_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[ApplicationDetailsRecord]:
        """
        Retrieves the details for a boarding application by ID.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ApplicationDetailsRecord]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/read/{jsonable_encoder(app_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ApplicationDetailsRecord,
                    parse_obj_as(
                        type_=ApplicationDetailsRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_application_by_auth(
        self,
        x_id: str,
        *,
        email: typing.Optional[Email] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[ApplicationQueryRecord]:
        """
        Gets a boarding application by authentication information. This endpoint requires an `application` API token.

        Parameters
        ----------
        x_id : str
            The application ID in Hex format. Find this at the end of the boarding link URL returned in a call to api/Boarding/applink/{appId}/{mail2}. For example in:  `https://boarding-sandbox.payabli.com/boarding/externalapp/load/17E`, the xId is `17E`.

        email : typing.Optional[Email]
            The email address the applicant used to save the application.

        reference_id : typing.Optional[str]
            The referenceId is sent to the applicant via email when they save the application.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ApplicationQueryRecord]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/read/{jsonable_encoder(x_id)}",
            method="POST",
            json={
                "email": email,
                "referenceId": reference_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ApplicationQueryRecord,
                    parse_obj_as(
                        type_=ApplicationQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_by_id_link_application(
        self, boarding_link_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[BoardingLinkQueryRecord]:
        """
        Retrieves details for a boarding link, by ID.

        Parameters
        ----------
        boarding_link_id : int
            The boarding link ID. You can find this at the end of the boarding link reference name. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`. The ID is `91`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/linkbyId/{jsonable_encoder(boarding_link_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_by_template_id_link_application(
        self, template_id: float, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[BoardingLinkQueryRecord]:
        """
        Get details for a boarding link using the boarding template ID. This endpoint requires an application API token.

        Parameters
        ----------
        template_id : float
            The boarding template ID. You can find this at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/linkbyTemplate/{jsonable_encoder(template_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_external_application(
        self,
        app_id: int,
        mail_2: str,
        *,
        send_email: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[PayabliApiResponse00]:
        """
        Retrieves a link and the verification code used to log into an existing boarding application. You can also use this endpoint to send a link and referenceId for an existing boarding application to an email address. The recipient can use the referenceId and email address to access and edit the application.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        mail_2 : str
            Email address used to access the application. If `sendEmail` parameter is true, a link to the application is sent to this email address.

        send_email : typing.Optional[bool]
            If `true`, sends an email that includes the link to the application to the `mail2` address. Defaults to `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[PayabliApiResponse00]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/applink/{jsonable_encoder(app_id)}/{jsonable_encoder(mail_2)}",
            method="PUT",
            params={
                "sendEmail": send_email,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00,
                    parse_obj_as(
                        type_=PayabliApiResponse00,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get_link_application(
        self, boarding_link_reference: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[BoardingLinkQueryRecord]:
        """
        Retrieves the details for a boarding link, by reference name. This endpoint requires an application API token.

        Parameters
        ----------
        boarding_link_reference : str
            The boarding link reference name. You can find this at the end of the boarding link URL. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/link/{jsonable_encoder(boarding_link_reference)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def list_applications(
        self,
        org_id: int,
        *,
        export_format: typing.Optional[ExportFormat] = None,
        from_record: typing.Optional[int] = None,
        limit_record: typing.Optional[int] = None,
        parameters: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None,
        sort_by: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[QueryBoardingAppsListResponse]:
        """
        Returns a list of boarding applications for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.

        Parameters
        ----------
        org_id : int
            The numeric identifier for organization, assigned by Payabli.

        export_format : typing.Optional[ExportFormat]

        from_record : typing.Optional[int]
            The number of records to skip before starting to collect the result set.

        limit_record : typing.Optional[int]
            Max number of records to return for the query. Use `0` or negative value to return all records.

        parameters : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Collection of field names, conditions, and values used to filter the query

            See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help.

            List of field names accepted:
            - `createdAt` (gt, ge, lt, le, eq, ne)
            - `startDate` (gt, ge, lt, le, eq, ne)
            - `dbaname` (ct, nct)
            - `legalname` (ct, nct)
            - `ein` (ct, nct)
            - `address` (ct, nct)
            - `city` (ct, nct)
            - `state` (ct, nct)
            - `phone` (ct, nct)
            - `mcc` (ct, nct)
            - `owntype` (ct, nct)
            - `ownerName` (ct, nct)
            - `contactName` (ct, nct)
            - `status` (in, nin, eq,ne)
            - `orgParentname` (ct, nct)
            - `externalpaypointID` (ct, nct, eq, ne)
            - `repCode` (ct, nct, eq, ne)
            - `repName` (ct, nct, eq, ne)
            - `repOffice` (ct, nct, eq, ne)
            List of comparison accepted - enclosed between parentheses:
            - eq or empty => equal
            - gt => greater than
            - ge => greater or equal
            - lt => less than
            - le => less or equal
            - ne => not equal
            - ct => contains
            - nct => not contains
            - in => inside array
            - nin => not inside array

        sort_by : typing.Optional[str]
            The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[QueryBoardingAppsListResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Query/boarding/{jsonable_encoder(org_id)}",
            method="GET",
            params={
                "exportFormat": export_format,
                "fromRecord": from_record,
                "limitRecord": limit_record,
                "parameters": parameters,
                "sortBy": sort_by,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    QueryBoardingAppsListResponse,
                    parse_obj_as(
                        type_=QueryBoardingAppsListResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def list_boarding_links(
        self,
        org_id: int,
        *,
        from_record: typing.Optional[int] = None,
        limit_record: typing.Optional[int] = None,
        parameters: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None,
        sort_by: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[QueryBoardingLinksResponse]:
        """
        Return a list of boarding links for an organization. Use filters to limit results.

        Parameters
        ----------
        org_id : int
            The numeric identifier for organization, assigned by Payabli.

        from_record : typing.Optional[int]
            The number of records to skip before starting to collect the result set.

        limit_record : typing.Optional[int]
            Max number of records to return for the query. Use `0` or negative value to return all records.

        parameters : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Collection of field names, conditions, and values used to filter the query

            See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help.

            List of field names accepted:
            - `lastUpdated` (gt, ge, lt, le, eq, ne)
            - `templateName` (ct, nct)
            - `referenceName` (ct, nct)
            - `acceptRegister` (eq, ne)
            - `acceptAuth` (eq, ne)
            - `templateCode` (ct, nct)
            - `templateId` (eq, ne)
            - `orgParentname` (ct, nct)

            List of comparison accepted - enclosed between parentheses:
            - eq or empty => equal
            - gt => greater than
            - ge => greater or equal
            - lt => less than
            - le => less or equal
            - ne => not equal
            - ct => contains
            - nct => not contains
            - in => inside array
            - nin => not inside array

            List of parameters accepted:
            - limitRecord : max number of records for query (default="20", "0" or negative value for all)
            - fromRecord : initial record in query

            Example: templateName(ct)=hoa return all records with template title containing "hoa"

        sort_by : typing.Optional[str]
            The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[QueryBoardingLinksResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Query/boardinglinks/{jsonable_encoder(org_id)}",
            method="GET",
            params={
                "fromRecord": from_record,
                "limitRecord": limit_record,
                "parameters": parameters,
                "sortBy": sort_by,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    QueryBoardingLinksResponse,
                    parse_obj_as(
                        type_=QueryBoardingLinksResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def update_application(
        self,
        app_id: int,
        *,
        services: typing.Optional[Services] = OMIT,
        annual_revenue: typing.Optional[Annualrevenue] = OMIT,
        attachments: typing.Optional[Attachments] = OMIT,
        avgmonthly: typing.Optional[Avgmonthly] = OMIT,
        baddress: typing.Optional[Baddress1] = OMIT,
        baddress_1: typing.Optional[Baddress2] = OMIT,
        bank_data: typing.Optional[Bank] = OMIT,
        bcity: typing.Optional[Bcity] = OMIT,
        bcountry: typing.Optional[Bcountry] = OMIT,
        binperson: typing.Optional[Binperson] = OMIT,
        binphone: typing.Optional[Binphone] = OMIT,
        binweb: typing.Optional[Binweb] = OMIT,
        bstate: typing.Optional[Bstate] = OMIT,
        bsummary: typing.Optional[Bsummary] = OMIT,
        btype: typing.Optional[OwnType] = OMIT,
        bzip: typing.Optional[Bzip] = OMIT,
        contacts: typing.Optional[ContactsField] = OMIT,
        dbaname: typing.Optional[Dbaname] = OMIT,
        ein: typing.Optional[Ein] = OMIT,
        external_paypoint_id: typing.Optional[ExternalPaypointId] = OMIT,
        faxnumber: typing.Optional[BoardingBusinessFax] = OMIT,
        highticketamt: typing.Optional[Highticketamt] = OMIT,
        legalname: typing.Optional[Legalname] = OMIT,
        license: typing.Optional[License] = OMIT,
        licstate: typing.Optional[Licensestate] = OMIT,
        maddress: typing.Optional[Maddress] = OMIT,
        maddress_1: typing.Optional[Maddress1] = OMIT,
        mcc: typing.Optional[Mcc] = OMIT,
        mcity: typing.Optional[Mcity] = OMIT,
        mcountry: typing.Optional[Mcountry] = OMIT,
        mstate: typing.Optional[Mstate] = OMIT,
        mzip: typing.Optional[Mzip] = OMIT,
        org_id: typing.Optional[Orgid] = OMIT,
        ownership: typing.Optional[Ownership] = OMIT,
        payout_average_monthly_volume: typing.Optional[PayoutAverageMonthlyVolume] = OMIT,
        payout_average_ticket_limit: typing.Optional[PayoutAverageTicketLimit] = OMIT,
        payout_credit_limit: typing.Optional[PayoutCreditLimit] = OMIT,
        payout_high_ticket_amount: typing.Optional[PayoutHighTicketAmount] = OMIT,
        phonenumber: typing.Optional[BoardingBusinessPhone] = OMIT,
        recipient_email: typing.Optional[Email] = OMIT,
        recipient_email_notification: typing.Optional[RecipientEmailNotification] = OMIT,
        resumable: typing.Optional[Resumable] = OMIT,
        signer: typing.Optional[SignerDataRequest] = OMIT,
        startdate: typing.Optional[Busstartdate] = OMIT,
        taxfillname: typing.Optional[Taxfillname] = OMIT,
        template_id: typing.Optional[TemplateId] = OMIT,
        ticketamt: typing.Optional[Ticketamt] = OMIT,
        website: typing.Optional[Website] = OMIT,
        when_charged: typing.Optional[Whencharged] = OMIT,
        when_delivered: typing.Optional[Whendelivered] = OMIT,
        when_provided: typing.Optional[Whenprovided] = OMIT,
        when_refunded: typing.Optional[Whenrefunded] = OMIT,
        rep_code: typing.Optional[RepCode] = OMIT,
        rep_name: typing.Optional[RepName] = OMIT,
        rep_office: typing.Optional[RepOffice] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Updates a boarding application by ID. This endpoint requires an application API token.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        services : typing.Optional[Services]

        annual_revenue : typing.Optional[Annualrevenue]

        attachments : typing.Optional[Attachments]

        avgmonthly : typing.Optional[Avgmonthly]

        baddress : typing.Optional[Baddress1]

        baddress_1 : typing.Optional[Baddress2]

        bank_data : typing.Optional[Bank]

        bcity : typing.Optional[Bcity]

        bcountry : typing.Optional[Bcountry]

        binperson : typing.Optional[Binperson]

        binphone : typing.Optional[Binphone]

        binweb : typing.Optional[Binweb]

        bstate : typing.Optional[Bstate]

        bsummary : typing.Optional[Bsummary]

        btype : typing.Optional[OwnType]

        bzip : typing.Optional[Bzip]

        contacts : typing.Optional[ContactsField]

        dbaname : typing.Optional[Dbaname]

        ein : typing.Optional[Ein]

        external_paypoint_id : typing.Optional[ExternalPaypointId]

        faxnumber : typing.Optional[BoardingBusinessFax]

        highticketamt : typing.Optional[Highticketamt]

        legalname : typing.Optional[Legalname]

        license : typing.Optional[License]

        licstate : typing.Optional[Licensestate]

        maddress : typing.Optional[Maddress]

        maddress_1 : typing.Optional[Maddress1]

        mcc : typing.Optional[Mcc]

        mcity : typing.Optional[Mcity]

        mcountry : typing.Optional[Mcountry]

        mstate : typing.Optional[Mstate]

        mzip : typing.Optional[Mzip]

        org_id : typing.Optional[Orgid]

        ownership : typing.Optional[Ownership]

        payout_average_monthly_volume : typing.Optional[PayoutAverageMonthlyVolume]

        payout_average_ticket_limit : typing.Optional[PayoutAverageTicketLimit]

        payout_credit_limit : typing.Optional[PayoutCreditLimit]

        payout_high_ticket_amount : typing.Optional[PayoutHighTicketAmount]

        phonenumber : typing.Optional[BoardingBusinessPhone]

        recipient_email : typing.Optional[Email]
            Email address for the applicant. This is used to send the applicant a boarding link.

        recipient_email_notification : typing.Optional[RecipientEmailNotification]

        resumable : typing.Optional[Resumable]

        signer : typing.Optional[SignerDataRequest]

        startdate : typing.Optional[Busstartdate]

        taxfillname : typing.Optional[Taxfillname]

        template_id : typing.Optional[TemplateId]

        ticketamt : typing.Optional[Ticketamt]

        website : typing.Optional[Website]

        when_charged : typing.Optional[Whencharged]

        when_delivered : typing.Optional[Whendelivered]

        when_provided : typing.Optional[Whenprovided]

        when_refunded : typing.Optional[Whenrefunded]

        rep_code : typing.Optional[RepCode]

        rep_name : typing.Optional[RepName]

        rep_office : typing.Optional[RepOffice]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"Boarding/app/{jsonable_encoder(app_id)}",
            method="PUT",
            json={
                "services": convert_and_respect_annotation_metadata(
                    object_=services, annotation=Services, direction="write"
                ),
                "annualRevenue": annual_revenue,
                "attachments": convert_and_respect_annotation_metadata(
                    object_=attachments, annotation=Attachments, direction="write"
                ),
                "avgmonthly": avgmonthly,
                "baddress": baddress,
                "baddress1": baddress_1,
                "bankData": convert_and_respect_annotation_metadata(
                    object_=bank_data, annotation=Bank, direction="write"
                ),
                "bcity": bcity,
                "bcountry": bcountry,
                "binperson": binperson,
                "binphone": binphone,
                "binweb": binweb,
                "bstate": bstate,
                "bsummary": bsummary,
                "btype": btype,
                "bzip": bzip,
                "contacts": convert_and_respect_annotation_metadata(
                    object_=contacts, annotation=ContactsField, direction="write"
                ),
                "dbaname": dbaname,
                "ein": ein,
                "externalPaypointId": external_paypoint_id,
                "faxnumber": faxnumber,
                "highticketamt": highticketamt,
                "legalname": legalname,
                "license": license,
                "licstate": licstate,
                "maddress": maddress,
                "maddress1": maddress_1,
                "mcc": mcc,
                "mcity": mcity,
                "mcountry": mcountry,
                "mstate": mstate,
                "mzip": mzip,
                "orgId": org_id,
                "ownership": convert_and_respect_annotation_metadata(
                    object_=ownership, annotation=Ownership, direction="write"
                ),
                "payoutAverageMonthlyVolume": payout_average_monthly_volume,
                "payoutAverageTicketLimit": payout_average_ticket_limit,
                "payoutCreditLimit": payout_credit_limit,
                "payoutHighTicketAmount": payout_high_ticket_amount,
                "phonenumber": phonenumber,
                "recipientEmail": recipient_email,
                "recipientEmailNotification": recipient_email_notification,
                "resumable": resumable,
                "signer": convert_and_respect_annotation_metadata(
                    object_=signer, annotation=SignerDataRequest, direction="write"
                ),
                "startdate": startdate,
                "taxfillname": taxfillname,
                "templateId": template_id,
                "ticketamt": ticketamt,
                "website": website,
                "whenCharged": when_charged,
                "whenDelivered": when_delivered,
                "whenProvided": when_provided,
                "whenRefunded": when_refunded,
                "RepCode": rep_code,
                "RepName": rep_name,
                "RepOffice": rep_office,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)


class AsyncRawBoardingClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def add_application(
        self, *, request: AddApplicationRequest, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Creates a boarding application in an organization. This endpoint requires an application API token.

        Parameters
        ----------
        request : AddApplicationRequest

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            "Boarding/app",
            method="POST",
            json=convert_and_respect_annotation_metadata(
                object_=request, annotation=AddApplicationRequest, direction="write"
            ),
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def delete_application(
        self, app_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Deletes a boarding application by ID.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/app/{jsonable_encoder(app_id)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_application(
        self, app_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[ApplicationDetailsRecord]:
        """
        Retrieves the details for a boarding application by ID.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ApplicationDetailsRecord]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/read/{jsonable_encoder(app_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ApplicationDetailsRecord,
                    parse_obj_as(
                        type_=ApplicationDetailsRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_application_by_auth(
        self,
        x_id: str,
        *,
        email: typing.Optional[Email] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[ApplicationQueryRecord]:
        """
        Gets a boarding application by authentication information. This endpoint requires an `application` API token.

        Parameters
        ----------
        x_id : str
            The application ID in Hex format. Find this at the end of the boarding link URL returned in a call to api/Boarding/applink/{appId}/{mail2}. For example in:  `https://boarding-sandbox.payabli.com/boarding/externalapp/load/17E`, the xId is `17E`.

        email : typing.Optional[Email]
            The email address the applicant used to save the application.

        reference_id : typing.Optional[str]
            The referenceId is sent to the applicant via email when they save the application.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ApplicationQueryRecord]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/read/{jsonable_encoder(x_id)}",
            method="POST",
            json={
                "email": email,
                "referenceId": reference_id,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    ApplicationQueryRecord,
                    parse_obj_as(
                        type_=ApplicationQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_by_id_link_application(
        self, boarding_link_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[BoardingLinkQueryRecord]:
        """
        Retrieves details for a boarding link, by ID.

        Parameters
        ----------
        boarding_link_id : int
            The boarding link ID. You can find this at the end of the boarding link reference name. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`. The ID is `91`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/linkbyId/{jsonable_encoder(boarding_link_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_by_template_id_link_application(
        self, template_id: float, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[BoardingLinkQueryRecord]:
        """
        Get details for a boarding link using the boarding template ID. This endpoint requires an application API token.

        Parameters
        ----------
        template_id : float
            The boarding template ID. You can find this at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/linkbyTemplate/{jsonable_encoder(template_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_external_application(
        self,
        app_id: int,
        mail_2: str,
        *,
        send_email: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[PayabliApiResponse00]:
        """
        Retrieves a link and the verification code used to log into an existing boarding application. You can also use this endpoint to send a link and referenceId for an existing boarding application to an email address. The recipient can use the referenceId and email address to access and edit the application.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        mail_2 : str
            Email address used to access the application. If `sendEmail` parameter is true, a link to the application is sent to this email address.

        send_email : typing.Optional[bool]
            If `true`, sends an email that includes the link to the application to the `mail2` address. Defaults to `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[PayabliApiResponse00]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/applink/{jsonable_encoder(app_id)}/{jsonable_encoder(mail_2)}",
            method="PUT",
            params={
                "sendEmail": send_email,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00,
                    parse_obj_as(
                        type_=PayabliApiResponse00,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get_link_application(
        self, boarding_link_reference: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[BoardingLinkQueryRecord]:
        """
        Retrieves the details for a boarding link, by reference name. This endpoint requires an application API token.

        Parameters
        ----------
        boarding_link_reference : str
            The boarding link reference name. You can find this at the end of the boarding link URL. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BoardingLinkQueryRecord]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/link/{jsonable_encoder(boarding_link_reference)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BoardingLinkQueryRecord,
                    parse_obj_as(
                        type_=BoardingLinkQueryRecord,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def list_applications(
        self,
        org_id: int,
        *,
        export_format: typing.Optional[ExportFormat] = None,
        from_record: typing.Optional[int] = None,
        limit_record: typing.Optional[int] = None,
        parameters: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None,
        sort_by: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[QueryBoardingAppsListResponse]:
        """
        Returns a list of boarding applications for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.

        Parameters
        ----------
        org_id : int
            The numeric identifier for organization, assigned by Payabli.

        export_format : typing.Optional[ExportFormat]

        from_record : typing.Optional[int]
            The number of records to skip before starting to collect the result set.

        limit_record : typing.Optional[int]
            Max number of records to return for the query. Use `0` or negative value to return all records.

        parameters : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Collection of field names, conditions, and values used to filter the query

            See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help.

            List of field names accepted:
            - `createdAt` (gt, ge, lt, le, eq, ne)
            - `startDate` (gt, ge, lt, le, eq, ne)
            - `dbaname` (ct, nct)
            - `legalname` (ct, nct)
            - `ein` (ct, nct)
            - `address` (ct, nct)
            - `city` (ct, nct)
            - `state` (ct, nct)
            - `phone` (ct, nct)
            - `mcc` (ct, nct)
            - `owntype` (ct, nct)
            - `ownerName` (ct, nct)
            - `contactName` (ct, nct)
            - `status` (in, nin, eq,ne)
            - `orgParentname` (ct, nct)
            - `externalpaypointID` (ct, nct, eq, ne)
            - `repCode` (ct, nct, eq, ne)
            - `repName` (ct, nct, eq, ne)
            - `repOffice` (ct, nct, eq, ne)
            List of comparison accepted - enclosed between parentheses:
            - eq or empty => equal
            - gt => greater than
            - ge => greater or equal
            - lt => less than
            - le => less or equal
            - ne => not equal
            - ct => contains
            - nct => not contains
            - in => inside array
            - nin => not inside array

        sort_by : typing.Optional[str]
            The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[QueryBoardingAppsListResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Query/boarding/{jsonable_encoder(org_id)}",
            method="GET",
            params={
                "exportFormat": export_format,
                "fromRecord": from_record,
                "limitRecord": limit_record,
                "parameters": parameters,
                "sortBy": sort_by,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    QueryBoardingAppsListResponse,
                    parse_obj_as(
                        type_=QueryBoardingAppsListResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def list_boarding_links(
        self,
        org_id: int,
        *,
        from_record: typing.Optional[int] = None,
        limit_record: typing.Optional[int] = None,
        parameters: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None,
        sort_by: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[QueryBoardingLinksResponse]:
        """
        Return a list of boarding links for an organization. Use filters to limit results.

        Parameters
        ----------
        org_id : int
            The numeric identifier for organization, assigned by Payabli.

        from_record : typing.Optional[int]
            The number of records to skip before starting to collect the result set.

        limit_record : typing.Optional[int]
            Max number of records to return for the query. Use `0` or negative value to return all records.

        parameters : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Collection of field names, conditions, and values used to filter the query

            See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for help.

            List of field names accepted:
            - `lastUpdated` (gt, ge, lt, le, eq, ne)
            - `templateName` (ct, nct)
            - `referenceName` (ct, nct)
            - `acceptRegister` (eq, ne)
            - `acceptAuth` (eq, ne)
            - `templateCode` (ct, nct)
            - `templateId` (eq, ne)
            - `orgParentname` (ct, nct)

            List of comparison accepted - enclosed between parentheses:
            - eq or empty => equal
            - gt => greater than
            - ge => greater or equal
            - lt => less than
            - le => less or equal
            - ne => not equal
            - ct => contains
            - nct => not contains
            - in => inside array
            - nin => not inside array

            List of parameters accepted:
            - limitRecord : max number of records for query (default="20", "0" or negative value for all)
            - fromRecord : initial record in query

            Example: templateName(ct)=hoa return all records with template title containing "hoa"

        sort_by : typing.Optional[str]
            The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[QueryBoardingLinksResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Query/boardinglinks/{jsonable_encoder(org_id)}",
            method="GET",
            params={
                "fromRecord": from_record,
                "limitRecord": limit_record,
                "parameters": parameters,
                "sortBy": sort_by,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    QueryBoardingLinksResponse,
                    parse_obj_as(
                        type_=QueryBoardingLinksResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def update_application(
        self,
        app_id: int,
        *,
        services: typing.Optional[Services] = OMIT,
        annual_revenue: typing.Optional[Annualrevenue] = OMIT,
        attachments: typing.Optional[Attachments] = OMIT,
        avgmonthly: typing.Optional[Avgmonthly] = OMIT,
        baddress: typing.Optional[Baddress1] = OMIT,
        baddress_1: typing.Optional[Baddress2] = OMIT,
        bank_data: typing.Optional[Bank] = OMIT,
        bcity: typing.Optional[Bcity] = OMIT,
        bcountry: typing.Optional[Bcountry] = OMIT,
        binperson: typing.Optional[Binperson] = OMIT,
        binphone: typing.Optional[Binphone] = OMIT,
        binweb: typing.Optional[Binweb] = OMIT,
        bstate: typing.Optional[Bstate] = OMIT,
        bsummary: typing.Optional[Bsummary] = OMIT,
        btype: typing.Optional[OwnType] = OMIT,
        bzip: typing.Optional[Bzip] = OMIT,
        contacts: typing.Optional[ContactsField] = OMIT,
        dbaname: typing.Optional[Dbaname] = OMIT,
        ein: typing.Optional[Ein] = OMIT,
        external_paypoint_id: typing.Optional[ExternalPaypointId] = OMIT,
        faxnumber: typing.Optional[BoardingBusinessFax] = OMIT,
        highticketamt: typing.Optional[Highticketamt] = OMIT,
        legalname: typing.Optional[Legalname] = OMIT,
        license: typing.Optional[License] = OMIT,
        licstate: typing.Optional[Licensestate] = OMIT,
        maddress: typing.Optional[Maddress] = OMIT,
        maddress_1: typing.Optional[Maddress1] = OMIT,
        mcc: typing.Optional[Mcc] = OMIT,
        mcity: typing.Optional[Mcity] = OMIT,
        mcountry: typing.Optional[Mcountry] = OMIT,
        mstate: typing.Optional[Mstate] = OMIT,
        mzip: typing.Optional[Mzip] = OMIT,
        org_id: typing.Optional[Orgid] = OMIT,
        ownership: typing.Optional[Ownership] = OMIT,
        payout_average_monthly_volume: typing.Optional[PayoutAverageMonthlyVolume] = OMIT,
        payout_average_ticket_limit: typing.Optional[PayoutAverageTicketLimit] = OMIT,
        payout_credit_limit: typing.Optional[PayoutCreditLimit] = OMIT,
        payout_high_ticket_amount: typing.Optional[PayoutHighTicketAmount] = OMIT,
        phonenumber: typing.Optional[BoardingBusinessPhone] = OMIT,
        recipient_email: typing.Optional[Email] = OMIT,
        recipient_email_notification: typing.Optional[RecipientEmailNotification] = OMIT,
        resumable: typing.Optional[Resumable] = OMIT,
        signer: typing.Optional[SignerDataRequest] = OMIT,
        startdate: typing.Optional[Busstartdate] = OMIT,
        taxfillname: typing.Optional[Taxfillname] = OMIT,
        template_id: typing.Optional[TemplateId] = OMIT,
        ticketamt: typing.Optional[Ticketamt] = OMIT,
        website: typing.Optional[Website] = OMIT,
        when_charged: typing.Optional[Whencharged] = OMIT,
        when_delivered: typing.Optional[Whendelivered] = OMIT,
        when_provided: typing.Optional[Whenprovided] = OMIT,
        when_refunded: typing.Optional[Whenrefunded] = OMIT,
        rep_code: typing.Optional[RepCode] = OMIT,
        rep_name: typing.Optional[RepName] = OMIT,
        rep_office: typing.Optional[RepOffice] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]:
        """
        Updates a boarding application by ID. This endpoint requires an application API token.

        Parameters
        ----------
        app_id : int
            Boarding application ID.

        services : typing.Optional[Services]

        annual_revenue : typing.Optional[Annualrevenue]

        attachments : typing.Optional[Attachments]

        avgmonthly : typing.Optional[Avgmonthly]

        baddress : typing.Optional[Baddress1]

        baddress_1 : typing.Optional[Baddress2]

        bank_data : typing.Optional[Bank]

        bcity : typing.Optional[Bcity]

        bcountry : typing.Optional[Bcountry]

        binperson : typing.Optional[Binperson]

        binphone : typing.Optional[Binphone]

        binweb : typing.Optional[Binweb]

        bstate : typing.Optional[Bstate]

        bsummary : typing.Optional[Bsummary]

        btype : typing.Optional[OwnType]

        bzip : typing.Optional[Bzip]

        contacts : typing.Optional[ContactsField]

        dbaname : typing.Optional[Dbaname]

        ein : typing.Optional[Ein]

        external_paypoint_id : typing.Optional[ExternalPaypointId]

        faxnumber : typing.Optional[BoardingBusinessFax]

        highticketamt : typing.Optional[Highticketamt]

        legalname : typing.Optional[Legalname]

        license : typing.Optional[License]

        licstate : typing.Optional[Licensestate]

        maddress : typing.Optional[Maddress]

        maddress_1 : typing.Optional[Maddress1]

        mcc : typing.Optional[Mcc]

        mcity : typing.Optional[Mcity]

        mcountry : typing.Optional[Mcountry]

        mstate : typing.Optional[Mstate]

        mzip : typing.Optional[Mzip]

        org_id : typing.Optional[Orgid]

        ownership : typing.Optional[Ownership]

        payout_average_monthly_volume : typing.Optional[PayoutAverageMonthlyVolume]

        payout_average_ticket_limit : typing.Optional[PayoutAverageTicketLimit]

        payout_credit_limit : typing.Optional[PayoutCreditLimit]

        payout_high_ticket_amount : typing.Optional[PayoutHighTicketAmount]

        phonenumber : typing.Optional[BoardingBusinessPhone]

        recipient_email : typing.Optional[Email]
            Email address for the applicant. This is used to send the applicant a boarding link.

        recipient_email_notification : typing.Optional[RecipientEmailNotification]

        resumable : typing.Optional[Resumable]

        signer : typing.Optional[SignerDataRequest]

        startdate : typing.Optional[Busstartdate]

        taxfillname : typing.Optional[Taxfillname]

        template_id : typing.Optional[TemplateId]

        ticketamt : typing.Optional[Ticketamt]

        website : typing.Optional[Website]

        when_charged : typing.Optional[Whencharged]

        when_delivered : typing.Optional[Whendelivered]

        when_provided : typing.Optional[Whenprovided]

        when_refunded : typing.Optional[Whenrefunded]

        rep_code : typing.Optional[RepCode]

        rep_name : typing.Optional[RepName]

        rep_office : typing.Optional[RepOffice]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[PayabliApiResponse00Responsedatanonobject]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"Boarding/app/{jsonable_encoder(app_id)}",
            method="PUT",
            json={
                "services": convert_and_respect_annotation_metadata(
                    object_=services, annotation=Services, direction="write"
                ),
                "annualRevenue": annual_revenue,
                "attachments": convert_and_respect_annotation_metadata(
                    object_=attachments, annotation=Attachments, direction="write"
                ),
                "avgmonthly": avgmonthly,
                "baddress": baddress,
                "baddress1": baddress_1,
                "bankData": convert_and_respect_annotation_metadata(
                    object_=bank_data, annotation=Bank, direction="write"
                ),
                "bcity": bcity,
                "bcountry": bcountry,
                "binperson": binperson,
                "binphone": binphone,
                "binweb": binweb,
                "bstate": bstate,
                "bsummary": bsummary,
                "btype": btype,
                "bzip": bzip,
                "contacts": convert_and_respect_annotation_metadata(
                    object_=contacts, annotation=ContactsField, direction="write"
                ),
                "dbaname": dbaname,
                "ein": ein,
                "externalPaypointId": external_paypoint_id,
                "faxnumber": faxnumber,
                "highticketamt": highticketamt,
                "legalname": legalname,
                "license": license,
                "licstate": licstate,
                "maddress": maddress,
                "maddress1": maddress_1,
                "mcc": mcc,
                "mcity": mcity,
                "mcountry": mcountry,
                "mstate": mstate,
                "mzip": mzip,
                "orgId": org_id,
                "ownership": convert_and_respect_annotation_metadata(
                    object_=ownership, annotation=Ownership, direction="write"
                ),
                "payoutAverageMonthlyVolume": payout_average_monthly_volume,
                "payoutAverageTicketLimit": payout_average_ticket_limit,
                "payoutCreditLimit": payout_credit_limit,
                "payoutHighTicketAmount": payout_high_ticket_amount,
                "phonenumber": phonenumber,
                "recipientEmail": recipient_email,
                "recipientEmailNotification": recipient_email_notification,
                "resumable": resumable,
                "signer": convert_and_respect_annotation_metadata(
                    object_=signer, annotation=SignerDataRequest, direction="write"
                ),
                "startdate": startdate,
                "taxfillname": taxfillname,
                "templateId": template_id,
                "ticketamt": ticketamt,
                "website": website,
                "whenCharged": when_charged,
                "whenDelivered": when_delivered,
                "whenProvided": when_provided,
                "whenRefunded": when_refunded,
                "RepCode": rep_code,
                "RepName": rep_name,
                "RepOffice": rep_office,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    PayabliApiResponse00Responsedatanonobject,
                    parse_obj_as(
                        type_=PayabliApiResponse00Responsedatanonobject,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 400:
                raise BadRequestError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 401:
                raise UnauthorizedError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 500:
                raise InternalServerError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Optional[typing.Any],
                        parse_obj_as(
                            type_=typing.Optional[typing.Any],  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 503:
                raise ServiceUnavailableError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        PayabliApiResponse,
                        parse_obj_as(
                            type_=PayabliApiResponse,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
