Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::common::RestApiResponse< T > Class Template Reference

A successful REST response whose body is decoded into T on first use. More...

#include <models.hpp>

Public Member Functions

 RestApiResponse ()=default
 RestApiResponse (RawResponse raw)
const T & data () const
 The decoded body, decoded on the first call.
std::uint16_t status () const noexcept
const Headers & headers () const noexcept
const std::optional< std::vector< RestApiRateLimit > > & rate_limits () const noexcept
const std::string & body () const noexcept
 The undecoded response body.
const RawResponse & raw () const noexcept

Detailed Description

template<class T>
class binance::common::RestApiResponse< T >

A successful REST response whose body is decoded into T on first use.

T must be convertible with boost::json::value_to<T>, through a tag_invoke overload that the product models provide.

Constructor & Destructor Documentation

◆ RestApiResponse() [1/2]

template<class T>
binance::common::RestApiResponse< T >::RestApiResponse ( )
default

◆ RestApiResponse() [2/2]

template<class T>
binance::common::RestApiResponse< T >::RestApiResponse ( RawResponse raw)
inlineexplicit

Member Function Documentation

◆ data()

template<class T>
const T & binance::common::RestApiResponse< T >::data ( ) const
inlinenodiscard

The decoded body, decoded on the first call.

Throws ConnectorClientError if it is not valid JSON or does not match T.

◆ status()

template<class T>
std::uint16_t binance::common::RestApiResponse< T >::status ( ) const
inlinenodiscardnoexcept

◆ headers()

template<class T>
const Headers & binance::common::RestApiResponse< T >::headers ( ) const
inlinenodiscardnoexcept

◆ rate_limits()

template<class T>
const std::optional< std::vector< RestApiRateLimit > > & binance::common::RestApiResponse< T >::rate_limits ( ) const
inlinenodiscardnoexcept

◆ body()

template<class T>
const std::string & binance::common::RestApiResponse< T >::body ( ) const
inlinenodiscardnoexcept

The undecoded response body.

◆ raw()

template<class T>
const RawResponse & binance::common::RestApiResponse< T >::raw ( ) const
inlinenodiscardnoexcept