"""
Binance Simple Earn REST API

OpenAPI Specification for the Binance Simple Earn 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.
"""

import requests
from typing import Optional, TypeVar, Union
from binance_common.configuration import ConfigurationRestAPI
from binance_common.models import ApiResponse
from binance_common.signature import Signers
from binance_common.utils import send_request
from .api.bfusd_api import BfusdApi
from .api.flexible_locked_api import FlexibleLockedApi
from .api.rwusd_api import RwusdApi

from .models import GetBfusdAccountResponse
from .models import GetBfusdQuotaDetailsResponse
from .models import GetBfusdRateHistoryResponse
from .models import GetBfusdRedemptionHistoryResponse
from .models import GetBfusdRewardsHistoryResponse
from .models import GetBfusdSubscriptionHistoryResponse
from .models import RedeemBfusdResponse
from .models import SubscribeBfusdResponse
from .models import GetCollateralRecordResponse
from .models import GetFlexiblePersonalLeftQuotaResponse
from .models import GetFlexibleProductPositionResponse
from .models import GetFlexibleRedemptionRecordResponse
from .models import GetFlexibleRewardsHistoryResponse
from .models import GetFlexibleSubscriptionPreviewResponse
from .models import GetFlexibleSubscriptionRecordResponse
from .models import GetLockedPersonalLeftQuotaResponse
from .models import GetLockedProductPositionResponse
from .models import GetLockedRedemptionRecordResponse
from .models import GetLockedRewardsHistoryResponse
from .models import GetLockedSubscriptionPreviewResponse
from .models import GetLockedSubscriptionRecordResponse
from .models import GetRateHistoryResponse
from .models import GetSimpleEarnFlexibleProductListResponse
from .models import GetSimpleEarnLockedProductListResponse
from .models import RedeemFlexibleProductResponse
from .models import RedeemLockedProductResponse
from .models import SetFlexibleAutoSubscribeResponse
from .models import SetLockedAutoSubscribeResponse
from .models import SetLockedProductRedeemOptionResponse
from .models import SimpleAccountResponse
from .models import SubscribeFlexibleProductResponse
from .models import SubscribeLockedProductResponse
from .models import GetRwusdAccountResponse
from .models import GetRwusdQuotaDetailsResponse
from .models import GetRwusdRateHistoryResponse
from .models import GetRwusdRedemptionHistoryResponse
from .models import GetRwusdRewardsHistoryResponse
from .models import GetRwusdSubscriptionHistoryResponse
from .models import RedeemRwusdResponse
from .models import SubscribeRwusdResponse


T = TypeVar("T")


class SimpleEarnRestAPI:
    def __init__(
        self,
        configuration: ConfigurationRestAPI,
    ) -> None:
        self.configuration = configuration
        self._session = requests.Session()
        self._signer = (
            Signers.get_signer(
                configuration.private_key, configuration.private_key_passphrase
            )
            if configuration.private_key is not None
            else None
        )

        self._bfusdApi = BfusdApi(self.configuration, self._session, self._signer)
        self._flexibleLockedApi = FlexibleLockedApi(
            self.configuration, self._session, self._signer
        )
        self._rwusdApi = RwusdApi(self.configuration, self._session, self._signer)

    def send_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
    ) -> ApiResponse[T]:
        """
        Sends an request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
        )

    def send_signed_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
    ) -> ApiResponse[T]:
        """
        Sends a signed request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
            is_signed=True,
            signer=self._signer,
        )

    def get_bfusd_account(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdAccountResponse]:
        """
                Get BFUSD Account (USER_DATA)

                Get BFUSD account information.

        Weight: 150

                Args:
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_account(recv_window)

    def get_bfusd_quota_details(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdQuotaDetailsResponse]:
        """
                Get BFUSD Quota Details (USER_DATA)

                Get BFUSD quota details including fast redemption quota and standard redemption quota.

        Weight: 150

                Args:
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdQuotaDetailsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_quota_details(recv_window)

    def get_bfusd_rate_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdRateHistoryResponse]:
        """
                Get BFUSD Rate History (USER_DATA)

                Get BFUSD rate history sorted by descending order.

        * The time between `startTime` and `endTime` cannot be longer than 6 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, `endTime` will default to current time, and results from `startTime` onward will be returned.
        * If `endTime` is sent but `startTime` is not sent, `startTime` defaults to the current time minus one month, and data between `startTime` and `endTime` will be returned.

        Weight: 150

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdRateHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_rate_history(
            start_time, end_time, current, size, recv_window
        )

    def get_bfusd_redemption_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdRedemptionHistoryResponse]:
        """
                Get BFUSD Redemption History (USER_DATA)

                Get BFUSD redemption history.

        * The time between `startTime` and `endTime` cannot be longer than 6 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, `endTime` will default to current time, and results from `startTime` onward will be returned.
        * If `endTime` is sent but `startTime` is not sent, `startTime` defaults to the current time minus one month, and data between `startTime` and `endTime` will be returned.

        Weight: 150

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdRedemptionHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_redemption_history(
            start_time, end_time, current, size, recv_window
        )

    def get_bfusd_rewards_history(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdRewardsHistoryResponse]:
        """
                Get BFUSD Rewards History (USER_DATA)

                Get BFUSD rewards history.

        * The time between `startTime` and `endTime` cannot be longer than 6 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, `endTime` will default to current time, and results from `startTime` onward will be returned.
        * If `endTime` is sent but `startTime` is not sent, `startTime` defaults to the current time minus one month, and data between `startTime` and `endTime` will be returned.

        Weight: 150

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdRewardsHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_rewards_history(
            start_time, end_time, current, size, recv_window
        )

    def get_bfusd_subscription_history(
        self,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBfusdSubscriptionHistoryResponse]:
        """
                Get BFUSD subscription history(USER_DATA)

                Get BFUSD subscription history

        * The time between `startTime` and `endTime` cannot be longer than 6 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, `endTime` will default to current time, and results from `startTime` onward will be returned.
        * If `endTime` is sent but `startTime` is not sent, `startTime` defaults to the current time advanced by one month, and data between `startTime` and `endTime` will be returned.

        Weight: 150

                Args:
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetBfusdSubscriptionHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.get_bfusd_subscription_history(
            asset, start_time, end_time, current, size, recv_window
        )

    def redeem_bfusd(
        self,
        amount: Union[float, None],
        type: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[RedeemBfusdResponse]:
        """
                Redeem BFUSD(TRADE)

                Redeem BFUSD to USDT

        * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.

        Weight: 150

                Args:
                    amount (Union[float, None]): Amount
                    type (Union[str, None]): FAST or STANDARD, defaults to STANDARD
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[RedeemBfusdResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.redeem_bfusd(amount, type, recv_window)

    def subscribe_bfusd(
        self,
        asset: Union[str, None],
        amount: Union[float, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[SubscribeBfusdResponse]:
        """
                Subscribe BFUSD(TRADE)

                Subscribe BFUSD

        * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint.

        Weight: 150

                Args:
                    asset (Union[str, None]): USDT or USDC (whichever is eligible)
                    amount (Union[float, None]): Amount
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[SubscribeBfusdResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._bfusdApi.subscribe_bfusd(asset, amount, recv_window)

    def get_collateral_record(
        self,
        product_id: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetCollateralRecordResponse]:
        """
                Get Collateral Record(USER_DATA)

                Get Collateral Record

        * The time between `startTime` and `endTime` cannot be longer than 30 days.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 1

                Args:
                    product_id (Optional[str] = None):
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetCollateralRecordResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_collateral_record(
            product_id, start_time, end_time, current, size, recv_window
        )

    def get_flexible_personal_left_quota(
        self,
        product_id: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexiblePersonalLeftQuotaResponse]:
        """
                Get Flexible Personal Left Quota(USER_DATA)

                Get Flexible Personal Left Quota

        Weight: 150

                Args:
                    product_id (Union[str, None]):
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexiblePersonalLeftQuotaResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_personal_left_quota(
            product_id, recv_window
        )

    def get_flexible_product_position(
        self,
        asset: Optional[str] = None,
        product_id: Optional[str] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexibleProductPositionResponse]:
        """
                Get Flexible Product Position(USER_DATA)

                Get Flexible Product Position

        Weight: 150

                Args:
                    asset (Optional[str] = None): USDC or USDT
                    product_id (Optional[str] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexibleProductPositionResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_product_position(
            asset, product_id, current, size, recv_window
        )

    def get_flexible_redemption_record(
        self,
        product_id: Optional[str] = None,
        redeem_id: Optional[str] = None,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexibleRedemptionRecordResponse]:
        """
                Get Flexible Redemption Record(USER_DATA)

                Get Flexible Redemption Record

        *	The time between `startTime` and `endTime` cannot be longer than 3 months.
        *	If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        *	If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        *	If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    product_id (Optional[str] = None):
                    redeem_id (Optional[str] = None):
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexibleRedemptionRecordResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_redemption_record(
            product_id,
            redeem_id,
            asset,
            start_time,
            end_time,
            current,
            size,
            recv_window,
        )

    def get_flexible_rewards_history(
        self,
        type: Union[str, None],
        product_id: Optional[str] = None,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexibleRewardsHistoryResponse]:
        """
                Get Flexible Rewards History(USER_DATA)

                Get Flexible Rewards History

        *	The time between `startTime` and `endTime` cannot be longer than 3 months.
        *	If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        *	If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        *	If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    type (Union[str, None]): FAST or STANDARD, defaults to STANDARD
                    product_id (Optional[str] = None):
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexibleRewardsHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_rewards_history(
            type, product_id, asset, start_time, end_time, current, size, recv_window
        )

    def get_flexible_subscription_preview(
        self,
        product_id: Union[str, None],
        amount: Union[float, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexibleSubscriptionPreviewResponse]:
        """
                Get Flexible Subscription Preview(USER_DATA)

                Get Flexible Subscription Preview

        Weight: 150

                Args:
                    product_id (Union[str, None]):
                    amount (Union[float, None]): Amount
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexibleSubscriptionPreviewResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_subscription_preview(
            product_id, amount, recv_window
        )

    def get_flexible_subscription_record(
        self,
        product_id: Optional[str] = None,
        purchase_id: Optional[str] = None,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFlexibleSubscriptionRecordResponse]:
        """
                Get Flexible Subscription Record(USER_DATA)

                Get Flexible Subscription Record

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    product_id (Optional[str] = None):
                    purchase_id (Optional[str] = None):
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetFlexibleSubscriptionRecordResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_flexible_subscription_record(
            product_id,
            purchase_id,
            asset,
            start_time,
            end_time,
            current,
            size,
            recv_window,
        )

    def get_locked_personal_left_quota(
        self,
        project_id: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetLockedPersonalLeftQuotaResponse]:
        """
                Get Locked Personal Left Quota(USER_DATA)

                Get Locked Personal Left Quota

        Weight: 150

                Args:
                    project_id (Union[str, None]):
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetLockedPersonalLeftQuotaResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_locked_personal_left_quota(
            project_id, recv_window
        )

    def get_locked_product_position(
        self,
        asset: Optional[str] = None,
        position_id: Optional[int] = None,
        project_id: Optional[str] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetLockedProductPositionResponse]:
        """
                Get Locked Product Position

                Get Locked Product Position

        Weight: 150

                Args:
                    asset (Optional[str] = None): USDC or USDT
                    position_id (Optional[int] = None):
                    project_id (Optional[str] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetLockedProductPositionResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_locked_product_position(
            asset, position_id, project_id, current, size, recv_window
        )

    def get_locked_redemption_record(
        self,
        position_id: Optional[int] = None,
        redeem_id: Optional[str] = None,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetLockedRedemptionRecordResponse]:
        """
                Get Locked Redemption Record(USER_DATA)

                Get Locked Redemption Record

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    position_id (Optional[int] = None):
                    redeem_id (Optional[str] = None):
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetLockedRedemptionRecordResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_locked_redemption_record(
            position_id,
            redeem_id,
            asset,
            start_time,
            end_time,
            current,
            size,
            recv_window,
        )

    def get_locked_rewards_history(
        self,
        position_id: Optional[int] = None,
        asset: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetLockedRewardsHistoryResponse]:
        """
                Get Locked Rewards History(USER_DATA)

                Get Locked Rewards History

        * The time between `startTime` and `endTime` cannot be longer than 3 months.
        * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned.
        * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned.
        * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned.

        Weight: 150

                Args:
                    position_id (Optional[int] = None):
                    asset (Optional[str] = None): USDC or USDT
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Starts from 1. Default: 1
                    size (Optional[int] = None): Number of results per page. Default: 10, Max: 100
                    recv_window (Optional[int] = None): The value cannot be greater than 60000 (ms)

                Returns:
                    ApiResponse[GetLockedRewardsHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._flexibleLockedApi.get_locked_rewards_history(
            position_id, asset, start_time, end_time, current, size, recv_window
        )

    def get_locked_subscription_preview(
        self,
