# 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 ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.commodity_types_list import CommodityTypesList
from ..types.cursor_page_t_customized_historical_raw_tick import CursorPageTCustomizedHistoricalRawTick
from ..types.cursor_page_t_customized_news_out import CursorPageTCustomizedNewsOut
from ..types.cursor_page_t_customized_symbols_out_full import CursorPageTCustomizedSymbolsOutFull
from ..types.historical_data_resolution import HistoricalDataResolution
from ..types.historical_ohlc_response import HistoricalOhlcResponse
from ..types.last_quote import LastQuote
from ..types.last_quotes import LastQuotes


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

    def get_quotes(
        self,
        *,
        symbols: str,
        precision: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[LastQuotes]:
        """
        Get the last quote tick for the provided symbols.

        Parameters
        ----------
        symbols : str
            Comma separated list of symbols.

        precision : typing.Optional[int]
            The decimal precision of the result.

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

        Returns
        -------
        HttpResponse[LastQuotes]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            "commodities/quotes",
            method="GET",
            params={
                "symbols": symbols,
                "precision": precision,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    LastQuotes,
                    parse_obj_as(
                        type_=LastQuotes,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_quote(
        self,
        *,
        symbol: str,
        precision: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[LastQuote]:
        """
        Get the last quote tick for the provided symbol.

        Parameters
        ----------
        symbol : str
            The symbol to get the quote for.

        precision : typing.Optional[int]
            The decimal precision of the result.

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

        Returns
        -------
        HttpResponse[LastQuote]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            "commodities/quote",
            method="GET",
            params={
                "symbol": symbol,
                "precision": precision,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    LastQuote,
                    parse_obj_as(
                        type_=LastQuote,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_symbols(
        self,
        *,
        size: typing.Optional[int] = None,
        mode: typing.Optional[str] = None,
        type: typing.Optional[str] = None,
        country: typing.Optional[str] = None,
        cursor: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CursorPageTCustomizedSymbolsOutFull]:
        """
        Get list of available symbols

        Parameters
        ----------
        size : typing.Optional[int]
            The number of items per page.

        mode : typing.Optional[str]
            The mode of the response.

        type : typing.Optional[str]
            Type of the instrument.

        country : typing.Optional[str]
            Country of the instrument.

        cursor : typing.Optional[str]
            Cursor for the next page

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

        Returns
        -------
        HttpResponse[CursorPageTCustomizedSymbolsOutFull]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            "commodities/symbols",
            method="GET",
            params={
                "size": size,
                "mode": mode,
                "type": type,
                "country": country,
                "cursor": cursor,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedSymbolsOutFull,
                    parse_obj_as(
                        type_=CursorPageTCustomizedSymbolsOutFull,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_insights(
        self,
        *,
        cursor: typing.Optional[str] = None,
        size: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CursorPageTCustomizedNewsOut]:
        """
        Get recent commodities insights.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Cursor for the next page

        size : typing.Optional[int]
            The number of items per page.

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

        Returns
        -------
        HttpResponse[CursorPageTCustomizedNewsOut]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            "commodities/insights",
            method="GET",
            params={
                "cursor": cursor,
                "size": size,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedNewsOut,
                    parse_obj_as(
                        type_=CursorPageTCustomizedNewsOut,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_types(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[CommodityTypesList]:
        """
        Get list of available commodity types

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

        Returns
        -------
        HttpResponse[CommodityTypesList]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            "commodities/types",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CommodityTypesList,
                    parse_obj_as(
                        type_=CommodityTypesList,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _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_historical_ohlc(
        self,
        symbol: str,
        *,
        resolution: HistoricalDataResolution,
        start: int,
        end: int,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[HistoricalOhlcResponse]:
        """
        Get historical OHLC candles for a symbol in a selected resolution and time range.

        Parameters
        ----------
        symbol : str

        resolution : HistoricalDataResolution
            Resolution in seconds.

        start : int
            Unix timestamp (inclusive).

        end : int
            Unix timestamp (exclusive).

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

        Returns
        -------
        HttpResponse[HistoricalOhlcResponse]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"commodities/{jsonable_encoder(symbol)}/ohlc",
            method="GET",
            params={
                "resolution": resolution,
                "start": start,
                "end": end,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    HistoricalOhlcResponse,
                    parse_obj_as(
                        type_=HistoricalOhlcResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_historical_ticks(
        self,
        symbol: str,
        *,
        start: int,
        end: int,
        cursor: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[CursorPageTCustomizedHistoricalRawTick]:
        """
        Get raw historical ticks for a symbol in a selected time range using cursor pagination.

        Parameters
        ----------
        symbol : str

        start : int
            Unix timestamp (inclusive).

        end : int
            Unix timestamp (exclusive).

        cursor : typing.Optional[str]
            Cursor for the next page

        limit : typing.Optional[int]
            The number of ticks per page.

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

        Returns
        -------
        HttpResponse[CursorPageTCustomizedHistoricalRawTick]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"commodities/{jsonable_encoder(symbol)}/ticks",
            method="GET",
            params={
                "start": start,
                "end": end,
                "cursor": cursor,
                "limit": limit,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedHistoricalRawTick,
                    parse_obj_as(
                        type_=CursorPageTCustomizedHistoricalRawTick,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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 AsyncRawCommoditiesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def get_quotes(
        self,
        *,
        symbols: str,
        precision: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[LastQuotes]:
        """
        Get the last quote tick for the provided symbols.

        Parameters
        ----------
        symbols : str
            Comma separated list of symbols.

        precision : typing.Optional[int]
            The decimal precision of the result.

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

        Returns
        -------
        AsyncHttpResponse[LastQuotes]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            "commodities/quotes",
            method="GET",
            params={
                "symbols": symbols,
                "precision": precision,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    LastQuotes,
                    parse_obj_as(
                        type_=LastQuotes,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_quote(
        self,
        *,
        symbol: str,
        precision: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[LastQuote]:
        """
        Get the last quote tick for the provided symbol.

        Parameters
        ----------
        symbol : str
            The symbol to get the quote for.

        precision : typing.Optional[int]
            The decimal precision of the result.

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

        Returns
        -------
        AsyncHttpResponse[LastQuote]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            "commodities/quote",
            method="GET",
            params={
                "symbol": symbol,
                "precision": precision,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    LastQuote,
                    parse_obj_as(
                        type_=LastQuote,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_symbols(
        self,
        *,
        size: typing.Optional[int] = None,
        mode: typing.Optional[str] = None,
        type: typing.Optional[str] = None,
        country: typing.Optional[str] = None,
        cursor: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CursorPageTCustomizedSymbolsOutFull]:
        """
        Get list of available symbols

        Parameters
        ----------
        size : typing.Optional[int]
            The number of items per page.

        mode : typing.Optional[str]
            The mode of the response.

        type : typing.Optional[str]
            Type of the instrument.

        country : typing.Optional[str]
            Country of the instrument.

        cursor : typing.Optional[str]
            Cursor for the next page

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

        Returns
        -------
        AsyncHttpResponse[CursorPageTCustomizedSymbolsOutFull]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            "commodities/symbols",
            method="GET",
            params={
                "size": size,
                "mode": mode,
                "type": type,
                "country": country,
                "cursor": cursor,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedSymbolsOutFull,
                    parse_obj_as(
                        type_=CursorPageTCustomizedSymbolsOutFull,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_insights(
        self,
        *,
        cursor: typing.Optional[str] = None,
        size: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CursorPageTCustomizedNewsOut]:
        """
        Get recent commodities insights.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Cursor for the next page

        size : typing.Optional[int]
            The number of items per page.

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

        Returns
        -------
        AsyncHttpResponse[CursorPageTCustomizedNewsOut]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            "commodities/insights",
            method="GET",
            params={
                "cursor": cursor,
                "size": size,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedNewsOut,
                    parse_obj_as(
                        type_=CursorPageTCustomizedNewsOut,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_types(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[CommodityTypesList]:
        """
        Get list of available commodity types

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

        Returns
        -------
        AsyncHttpResponse[CommodityTypesList]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            "commodities/types",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CommodityTypesList,
                    parse_obj_as(
                        type_=CommodityTypesList,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _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_historical_ohlc(
        self,
        symbol: str,
        *,
        resolution: HistoricalDataResolution,
        start: int,
        end: int,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[HistoricalOhlcResponse]:
        """
        Get historical OHLC candles for a symbol in a selected resolution and time range.

        Parameters
        ----------
        symbol : str

        resolution : HistoricalDataResolution
            Resolution in seconds.

        start : int
            Unix timestamp (inclusive).

        end : int
            Unix timestamp (exclusive).

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

        Returns
        -------
        AsyncHttpResponse[HistoricalOhlcResponse]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"commodities/{jsonable_encoder(symbol)}/ohlc",
            method="GET",
            params={
                "resolution": resolution,
                "start": start,
                "end": end,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    HistoricalOhlcResponse,
                    parse_obj_as(
                        type_=HistoricalOhlcResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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_historical_ticks(
        self,
        symbol: str,
        *,
        start: int,
        end: int,
        cursor: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[CursorPageTCustomizedHistoricalRawTick]:
        """
        Get raw historical ticks for a symbol in a selected time range using cursor pagination.

        Parameters
        ----------
        symbol : str

        start : int
            Unix timestamp (inclusive).

        end : int
            Unix timestamp (exclusive).

        cursor : typing.Optional[str]
            Cursor for the next page

        limit : typing.Optional[int]
            The number of ticks per page.

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

        Returns
        -------
        AsyncHttpResponse[CursorPageTCustomizedHistoricalRawTick]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"commodities/{jsonable_encoder(symbol)}/ticks",
            method="GET",
            params={
                "start": start,
                "end": end,
                "cursor": cursor,
                "limit": limit,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    CursorPageTCustomizedHistoricalRawTick,
                    parse_obj_as(
                        type_=CursorPageTCustomizedHistoricalRawTick,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        parse_obj_as(
                            type_=typing.Any,  # 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)
