"""
Binance Wallet REST API

OpenAPI Specification for the Binance Wallet REST API
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from typing import Optional, Union
from requests import Session
from binance_common.configuration import ConfigurationRestAPI
from binance_common.errors import RequiredError
from binance_common.models import ApiResponse
from binance_common.signature import Signers
from binance_common.utils import send_request

from ..models import BrokerWithdrawResponse
from ..models import CheckQuestionnaireRequirementsResponse
from ..models import DepositHistoryTravelRuleResponse
from ..models import DepositHistoryV2Response
from ..models import FetchAddressVerificationListResponse
from ..models import SubmitDepositQuestionnaireResponse
from ..models import SubmitDepositQuestionnaireTravelRuleResponse
from ..models import VaspListResponse
from ..models import WithdrawHistoryV1Response
from ..models import WithdrawHistoryV2Response
from ..models import WithdrawTravelRuleResponse


class TravelRuleApi:
    """API Client for TravelRuleApi endpoints."""

    def __init__(
        self,
        configuration: ConfigurationRestAPI = None,
        session: Session = None,
        signer: Signers = None,
    ) -> None:
        self._configuration = configuration
        self._session = session
        self._signer = signer

    def broker_withdraw(
        self,
        address: Union[str, None],
        coin: Union[str, None],
        amount: Union[float, None],
        withdraw_order_id: Union[str, None],
        questionnaire: Union[str, None],
        originator_pii: Union[str, None],
        signature: Union[str, None],
        address_tag: Optional[str] = None,
        network: Optional[str] = None,
        address_name: Optional[str] = None,
        transaction_fee_flag: Optional[bool] = None,
        wallet_type: Optional[int] = None,
    ) -> ApiResponse[BrokerWithdrawResponse]:
        """
                Broker Withdraw (for brokers of local entities that require travel rule) (USER_DATA)
                POST /sapi/v1/localentity/broker/withdraw/apply
                https://developers.binance.com/docs/wallet/travel-rule/Broker-Withdraw

                Submit a withdrawal request for brokers of local entities that required travel rule.

        * If `network` not send, return with default network of the coin, but if the address could not match default network, the withdraw will be rejected.
        * You can get `network` in `networkList` of a coin in the response
        * Questionnaire is different for each local entity, please refer to
        * If getting error like `Questionnaire format not valid.` or `Questionnaire must not be blank`,

        Weight: 600

                Args:
                    address (Union[str, None]):
                    coin (Union[str, None]):
                    amount (Union[float, None]):
                    withdraw_order_id (Union[str, None]): withdrawID defined by the client (i.e. client's internal withdrawID)
                    questionnaire (Union[str, None]): JSON format questionnaire answers.
                    originator_pii (Union[str, None]): JSON format originator Pii, see StandardPii section below
                    signature (Union[str, None]): Must be the last parameter.
                    address_tag (Optional[str] = None): Secondary address identifier for coins like XRP,XMR etc.
                    network (Optional[str] = None):
                    address_name (Optional[str] = None): Description of the address. Address book cap is 200, space in name should be encoded into `%20`
                    transaction_fee_flag (Optional[bool] = None): When making internal transfer, `true` for returning the fee to the destination account; `false` for returning the fee back to the departure account. Default `false`.
                    wallet_type (Optional[int] = None): The wallet type for withdraw，0-spot wallet ，1-funding wallet. Default walletType is the current "selected wallet" under wallet->Fiat and Spot/Funding->Deposit

                Returns:
                    ApiResponse[BrokerWithdrawResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        if address is None:
            raise RequiredError(
                field="address", error_message="Missing required parameter 'address'"
            )
        if coin is None:
            raise RequiredError(
                field="coin", error_message="Missing required parameter 'coin'"
            )
        if amount is None:
            raise RequiredError(
                field="amount", error_message="Missing required parameter 'amount'"
            )
        if withdraw_order_id is None:
            raise RequiredError(
                field="withdraw_order_id",
                error_message="Missing required parameter 'withdraw_order_id'",
            )
        if questionnaire is None:
            raise RequiredError(
                field="questionnaire",
                error_message="Missing required parameter 'questionnaire'",
            )
        if originator_pii is None:
            raise RequiredError(
                field="originator_pii",
                error_message="Missing required parameter 'originator_pii'",
            )
        if signature is None:
            raise RequiredError(
                field="signature",
                error_message="Missing required parameter 'signature'",
            )

        body = {}
        payload = {
            "address": address,
            "coin": coin,
            "amount": amount,
            "withdraw_order_id": withdraw_order_id,
            "questionnaire": questionnaire,
            "originator_pii": originator_pii,
            "signature": signature,
            "address_tag": address_tag,
            "network": network,
            "address_name": address_name,
            "transaction_fee_flag": transaction_fee_flag,
            "wallet_type": wallet_type,
        }

        return send_request(
            self._session,
            self._configuration,
            method="POST",
            path="/sapi/v1/localentity/broker/withdraw/apply",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=BrokerWithdrawResponse,
            is_signed=True,
            signer=self._signer,
        )

    def check_questionnaire_requirements(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[CheckQuestionnaireRequirementsResponse]:
        """
                Check Questionnaire Requirements (for local entities that require travel rule) (supporting network) (USER_DATA)
                GET /sapi/v1/localentity/questionnaire-requirements
                https://developers.binance.com/docs/wallet/travel-rule/questionnaire-requirements

                This API will return user-specific Travel Rule questionnaire requirement information in reference to the current API key.

        Weight: 1

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[CheckQuestionnaireRequirementsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/localentity/questionnaire-requirements",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=CheckQuestionnaireRequirementsResponse,
            is_signed=True,
            signer=self._signer,
        )

    def deposit_history_travel_rule(
        self,
        tr_id: Optional[str] = None,
        tx_id: Optional[str] = None,
        tran_id: Optional[str] = None,
        network: Optional[str] = None,
        coin: Optional[str] = None,
        travel_rule_status: Optional[int] = None,
        pending_questionnaire: Optional[bool] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[DepositHistoryTravelRuleResponse]:
        """
                Deposit History (for local entities that required travel rule) (supporting network) (USER_DATA)
                GET /sapi/v1/localentity/deposit/history
                https://developers.binance.com/docs/wallet/travel-rule/Deposit-History

                Fetch deposit history for local entities that required travel rule.

        * Please notice the default `startTime` and `endTime` to make sure that time interval is within
        * If both ``startTime`` and ``endTime`` are sent, time between ``startTime`` and ``endTime`` must

        Weight: 1

                Args:
                    tr_id (Optional[str] = None): Comma(,) separated list of travel rule record Ids.
                    tx_id (Optional[str] = None):
                    tran_id (Optional[str] = None): Comma(,) separated list of wallet tran Ids.
                    network (Optional[str] = None):
                    coin (Optional[str] = None):
                    travel_rule_status (Optional[int] = None): 0:Completed,1:Pending,2:Failed
                    pending_questionnaire (Optional[bool] = None): true: Only return records that pending deposit questionnaire. false/not provided: return all records.
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    offset (Optional[int] = None): Default: 0
                    limit (Optional[int] = None): min 7, max 30, default 7

                Returns:
                    ApiResponse[DepositHistoryTravelRuleResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "tr_id": tr_id,
            "tx_id": tx_id,
            "tran_id": tran_id,
            "network": network,
            "coin": coin,
            "travel_rule_status": travel_rule_status,
            "pending_questionnaire": pending_questionnaire,
            "start_time": start_time,
            "end_time": end_time,
            "offset": offset,
            "limit": limit,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/localentity/deposit/history",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=DepositHistoryTravelRuleResponse,
            is_signed=True,
            signer=self._signer,
        )

    def deposit_history_v2(
        self,
        deposit_id: Optional[str] = None,
        tx_id: Optional[str] = None,
        network: Optional[str] = None,
        coin: Optional[str] = None,
        retrieve_questionnaire: Optional[bool] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[DepositHistoryV2Response]:
        """
                Deposit History V2 (for local entities that required travel rule) (supporting network) (USER_DATA)
                GET /sapi/v2/localentity/deposit/history
                https://developers.binance.com/docs/wallet/travel-rule/Deposit-History-V2

                Fetch deposit history for local entities that with required travel rule information.

        * Please notice the default `startTime` and `endTime` to make sure that time interval is within
        * If both ``startTime`` and ``endTime`` are sent, time between ``startTime`` and ``endTime`` must

        Weight: 1

                Args:
                    deposit_id (Optional[str] = None): Comma(,) separated list of wallet tran Ids.
                    tx_id (Optional[str] = None):
                    network (Optional[str] = None):
                    coin (Optional[str] = None):
                    retrieve_questionnaire (Optional[bool] = None): true: return `questionnaire` within response.
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    offset (Optional[int] = None): Default: 0
                    limit (Optional[int] = None): min 7, max 30, default 7

                Returns:
                    ApiResponse[DepositHistoryV2Response]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "deposit_id": deposit_id,
            "tx_id": tx_id,
            "network": network,
            "coin": coin,
            "retrieve_questionnaire": retrieve_questionnaire,
            "start_time": start_time,
            "end_time": end_time,
            "offset": offset,
            "limit": limit,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v2/localentity/deposit/history",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=DepositHistoryV2Response,
            is_signed=True,
            signer=self._signer,
        )

    def fetch_address_verification_list(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[FetchAddressVerificationListResponse]:
        """
                Fetch address verification list (USER_DATA)
                GET /sapi/v1/addressVerify/list
                https://developers.binance.com/docs/wallet/travel-rule/address-verification-list

                Fetch address verification list for user to check on status and other details for the addresses stored in Address Book.

        Weight: 1

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[FetchAddressVerificationListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/addressVerify/list",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=FetchAddressVerificationListResponse,
            is_signed=True,
            signer=self._signer,
        )

    def submit_deposit_questionnaire(
        self,
        sub_account_id: Union[str, None],
        deposit_id: Union[str, None],
        questionnaire: Union[str, None],
        beneficiary_pii: Union[str, None],
        signature: Union[str, None],
        network: Optional[str] = None,
        coin: Optional[str] = None,
        amount: Optional[float] = None,
        address: Optional[str] = None,
        address_tag: Optional[str] = None,
    ) -> ApiResponse[SubmitDepositQuestionnaireResponse]:
        """
                Submit Deposit Questionnaire (For local entities that require travel rule) (supporting network) (USER_DATA)
                PUT /sapi/v1/localentity/broker/deposit/provide-info
                https://developers.binance.com/docs/wallet/travel-rule/deposit-provide-info

                Submit questionnaire for brokers of local entities that require travel rule.
        The questionnaire is only applies to transactions from un-hosted wallets or VASPs that are not
        yet onboarded with GTR.

        * Questionnaire is different for each local entity, please refer
        * If getting error like `Questionnaire format not valid.` or `Questionnaire must not be blank`,

        Weight: 600

                Args:
                    sub_account_id (Union[str, None]): External user ID.
                    deposit_id (Union[str, None]): Wallet deposit ID.
                    questionnaire (Union[str, None]): JSON format questionnaire answers.
                    beneficiary_pii (Union[str, None]): JSON format beneficiary Pii.
                    signature (Union[str, None]): Must be the last parameter.
                    network (Optional[str] = None):
                    coin (Optional[str] = None):
                    amount (Optional[float] = None):
                    address (Optional[str] = None):
                    address_tag (Optional[str] = None): Secondary address identifier for coins like XRP,XMR etc.

                Returns:
                    ApiResponse[SubmitDepositQuestionnaireResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        if sub_account_id is None:
            raise RequiredError(
                field="sub_account_id",
                error_message="Missing required parameter 'sub_account_id'",
            )
        if deposit_id is None:
            raise RequiredError(
                field="deposit_id",
                error_message="Missing required parameter 'deposit_id'",
            )
        if questionnaire is None:
            raise RequiredError(
                field="questionnaire",
                error_message="Missing required parameter 'questionnaire'",
            )
        if beneficiary_pii is None:
            raise RequiredError(
                field="beneficiary_pii",
                error_message="Missing required parameter 'beneficiary_pii'",
            )
        if signature is None:
            raise RequiredError(
                field="signature",
                error_message="Missing required parameter 'signature'",
            )

        body = {}
        payload = {
            "sub_account_id": sub_account_id,
            "deposit_id": deposit_id,
            "questionnaire": questionnaire,
            "beneficiary_pii": beneficiary_pii,
            "signature": signature,
            "network": network,
            "coin": coin,
            "amount": amount,
            "address": address,
            "address_tag": address_tag,
        }

        return send_request(
            self._session,
            self._configuration,
            method="PUT",
            path="/sapi/v1/localentity/broker/deposit/provide-info",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=SubmitDepositQuestionnaireResponse,
            is_signed=True,
            signer=self._signer,
        )

    def submit_deposit_questionnaire_travel_rule(
        self,
        tran_id: Union[int, None],
        questionnaire: Union[str, None],
    ) -> ApiResponse[SubmitDepositQuestionnaireTravelRuleResponse]:
        """
                Submit Deposit Questionnaire (For local entities that require travel rule) (supporting network) (USER_DATA)
                PUT /sapi/v1/localentity/deposit/provide-info
                https://developers.binance.com/docs/wallet/travel-rule/deposit-provide-info

                Submit questionnaire for local entities that require travel rule.
        The questionnaire is only applies to transactions from unhosted wallets or VASPs that are not
        yet onboarded with GTR.

        * Questionnaire is different for each local entity, please refer
        * If getting error like `Questionnaire format not valid.` or `Questionnaire must not be blank`,

        Weight: 600

                Args:
                    tran_id (Union[int, None]): Wallet tran ID
                    questionnaire (Union[str, None]): JSON format questionnaire answers.

                Returns:
                    ApiResponse[SubmitDepositQuestionnaireTravelRuleResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        if tran_id is None:
            raise RequiredError(
                field="tran_id", error_message="Missing required parameter 'tran_id'"
            )
        if questionnaire is None:
            raise RequiredError(
                field="questionnaire",
                error_message="Missing required parameter 'questionnaire'",
            )

        body = {}
        payload = {"tran_id": tran_id, "questionnaire": questionnaire}

        return send_request(
            self._session,
            self._configuration,
            method="PUT",
            path="/sapi/v1/localentity/deposit/provide-info",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=SubmitDepositQuestionnaireTravelRuleResponse,
            is_signed=True,
            signer=self._signer,
        )

    def vasp_list(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[VaspListResponse]:
        """
                VASP list (for local entities that require travel rule) (supporting network) (USER_DATA)
                GET /sapi/v1/localentity/vasp
                https://developers.binance.com/docs/wallet/travel-rule/onboarded-vasp-list

                Fetch the VASP list for local entities.

        Weight: 1

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[VaspListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {"recv_window": recv_window}

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/localentity/vasp",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=VaspListResponse,
            is_signed=True,
            signer=self._signer,
        )

    def withdraw_history_v1(
        self,
        tr_id: Optional[str] = None,
        tx_id: Optional[str] = None,
        withdraw_order_id: Optional[str] = None,
        network: Optional[str] = None,
        coin: Optional[str] = None,
        travel_rule_status: Optional[int] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[WithdrawHistoryV1Response]:
        """
                Withdraw History (for local entities that require travel rule) (supporting network) (USER_DATA)
                GET /sapi/v1/localentity/withdraw/history
                https://developers.binance.com/docs/wallet/travel-rule/Withdraw-History

                Fetch withdraw history for local entities that required travel rule.

        * `network` may not be in the response for old withdraw.
        * Please notice the default `startTime` and `endTime` to make sure that time interval is within
        * If both `startTime` and `endTime`are sent, time between `startTime`and `endTime`must be less

        Weight: 1

                Args:
                    tr_id (Optional[str] = None): Comma(,) separated list of travel rule record Ids.
                    tx_id (Optional[str] = None):
                    withdraw_order_id (Optional[str] = None): client side id for withdrawal, if provided in POST `/sapi/v1/capital/withdraw/apply`, can be used here for query.
                    network (Optional[str] = None):
                    coin (Optional[str] = None):
                    travel_rule_status (Optional[int] = None): 0:Completed,1:Pending,2:Failed
                    offset (Optional[int] = None): Default: 0
                    limit (Optional[int] = None): min 7, max 30, default 7
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[WithdrawHistoryV1Response]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "tr_id": tr_id,
            "tx_id": tx_id,
            "withdraw_order_id": withdraw_order_id,
            "network": network,
            "coin": coin,
            "travel_rule_status": travel_rule_status,
            "offset": offset,
            "limit": limit,
            "start_time": start_time,
            "end_time": end_time,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v1/localentity/withdraw/history",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=WithdrawHistoryV1Response,
            is_signed=True,
            signer=self._signer,
        )

    def withdraw_history_v2(
        self,
        tr_id: Optional[str] = None,
        tx_id: Optional[str] = None,
        withdraw_order_id: Optional[str] = None,
        network: Optional[str] = None,
        coin: Optional[str] = None,
        travel_rule_status: Optional[int] = None,
        offset: Optional[int] = None,
        limit: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[WithdrawHistoryV2Response]:
        """
                Withdraw History V2 (for local entities that require travel rule) (supporting network) (USER_DATA)
                GET /sapi/v2/localentity/withdraw/history
                https://developers.binance.com/docs/wallet/travel-rule/Withdraw-History-V2

                Fetch withdraw history for local entities that required travel rule.

        * `network` may not be in the response for old withdraw.
        * Withdrawal made through /sapi/v1/capital/withdraw/apply may not be in the response.
        * Please notice the default `startTime` and `endTime` to make sure that time interval is within
        * If both `startTime` and `endTime`are sent, time between `startTime`and `endTime`must be less
        * If withdrawOrderId is sent, time between startTime and endTime must be less than 7 days.
        * If withdrawOrderId is sent, startTime and endTime are not sent, will return last 7 days records by default.
        * Maximum support trId,txId number is 45.
        * WithdrawOrderId only support 1.
        * If responsible does not include withdrawalStatus, please input trId or txId retrieve the data.

        Weight: 1

                Args:
                    tr_id (Optional[str] = None): Comma(,) separated list of travel rule record Ids.
                    tx_id (Optional[str] = None):
                    withdraw_order_id (Optional[str] = None): client side id for withdrawal, if provided in POST `/sapi/v1/capital/withdraw/apply`, can be used here for query.
                    network (Optional[str] = None):
                    coin (Optional[str] = None):
                    travel_rule_status (Optional[int] = None): 0:Completed,1:Pending,2:Failed
                    offset (Optional[int] = None): Default: 0
                    limit (Optional[int] = None): min 7, max 30, default 7
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[WithdrawHistoryV2Response]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "tr_id": tr_id,
            "tx_id": tx_id,
            "withdraw_order_id": withdraw_order_id,
            "network": network,
            "coin": coin,
            "travel_rule_status": travel_rule_status,
            "offset": offset,
            "limit": limit,
            "start_time": start_time,
            "end_time": end_time,
            "recv_window": recv_window,
        }

        return send_request(
            self._session,
            self._configuration,
            method="GET",
            path="/sapi/v2/localentity/withdraw/history",
            payload=payload,
            body=body,
            time_unit=self._configuration.time_unit,
            response_model=WithdrawHistoryV2Response,
            is_signed=True,
            signer=self._signer,
        )

    def withdraw_travel_rule(
        self,
        coin: Union[str, None],
        address: Union[str, None],
        amount: Union[float, None],
        questionnaire: Union[str, None],
        withdraw_order_id: Optional[str] = None,
        network: Optional[str] = None,
        address_tag: Optional[str] = None,
        transaction_fee_flag: Optional[bool] = None,
        name: Optional[str] = None,
        wallet_type: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[WithdrawTravelRuleResponse]:
        """
                Withdraw (for local entities that require travel rule) (USER_DATA)
                POST /sapi/v1/localentity/withdraw/apply
                https://developers.binance.com/docs/wallet/travel-rule/Withdraw

                Submit a withdrawal request for local entities that required travel rule.

        * If `network` not send, return with default network of the coin, but if the address could not match default network, the withdraw will be rejected.
        * You can get `network` and `isDefault` in `networkList` of a coin in the response
        * Questionnaire is different for each local entity, please refer to
        * If getting error like `Questionnaire format not valid.` or `Questionnaire must not be blank`,

        Weight: 600

                Args:
                    coin (Union[str, None]):
                    address (Union[str, None]):
                    amount (Union[float, None]):
                    questionnaire (Union[str, None]): JSON format questionnaire answers.
                    withdraw_order_id (Optional[str] = None): client side id for withdrawal, if provided in POST `/sapi/v1/capital/withdraw/apply`, can be used here for query.
                    network (Optional[str] = None):
                    address_tag (Optional[str] = None): Secondary address identifier for coins like XRP,XMR etc.
                    transaction_fee_flag (Optional[bool] = None): When making internal transfer, `true` for returning the fee to the destination account; `false` for returning the fee back to the departure account. Default `false`.
                    name (Optional[str] = None): Description of the address. Address book cap is 200, space in name should be encoded into `%20`
                    wallet_type (Optional[int] = None): The wallet type for withdraw，0-spot wallet ，1-funding wallet. Default walletType is the current "selected wallet" under wallet->Fiat and Spot/Funding->Deposit
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[WithdrawTravelRuleResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        if coin is None:
            raise RequiredError(
                field="coin", error_message="Missing required parameter 'coin'"
            )
        if address is None:
            raise RequiredError(
                field="address", error_message="Missing required parameter 'address'"
            )
        if amount is None:
            raise RequiredError(
                field="amount", error_message="Missing required parameter 'amount'"
            )
        if questionnaire is None:
            raise RequiredError(
                field="questionnaire",
                error_message="Missing required parameter 'questionnaire'",
            )

        body = {}
        payload = {
            "coin": coin,
            "address": address,
            "amount": amount,
            "questionnaire": questionnaire,
            "withdraw_order_id": withdraw_order_id,
            "network": network,
            "address_tag": address_tag,
            "transaction_fee_flag": transaction_fee_flag,
            "name": name,
