"""
Binance Rebate REST API

OpenAPI Specification for the Binance Rebate 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
from requests import Session
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 ..models import GetSpotRebateHistoryRecordsResponse


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

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

    def get_spot_rebate_history_records(
        self,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        page: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetSpotRebateHistoryRecordsResponse]:
        """
                Get Spot Rebate History Records (USER_DATA)
                GET /sapi/v1/rebate/taxQuery
                https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records

                Get Spot Rebate History Records

        * The max interval between startTime and endTime is 30 days.
        * If startTime and endTime are not sent, the recent 7 days' data will be returned.
        * The earliest startTime is supported on June 10, 2020
        * Return up to 200 records per request.

        Weight: 12000

                Args:
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    page (Optional[int] = None): Default 1
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetSpotRebateHistoryRecordsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        body = {}
        payload = {
            "start_time": start_time,
            "end_time": end_time,
            "page": page,
            "recv_window": recv_window,
        }

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