cesium-native 0.43.0
Loading...
Searching...
No Matches
CesiumIonClient::Response< T > Struct Template Referencefinal

A response from Cesium ion. More...

#include <CesiumIonClient/Response.h>

Public Member Functions

 Response ()
 Creates a new empty Response.
 
 Response (const std::shared_ptr< CesiumAsync::IAssetRequest > &pRequest, T &&value)
 Creates a Response from a completed request and a response value.
 
 Response (T &&value, uint16_t httpStatusCode, const std::string &errorCode, const std::string &errorMessage)
 Creates a Response from a response value, status code, and error information.
 
 Response (uint16_t httpStatusCode, const std::string &errorCode, const std::string &errorMessage)
 Creates a Response with no value, a status code, and error information.
 

Public Attributes

std::optional< T > value
 The response value, or std::nullopt if the response was unsuccessful.
 
uint16_t httpStatusCode
 The HTTP status code returned by Cesium ion.
 
std::string errorCode
 The error code, or empty string if there was no error.
 
std::string errorMessage
 The error message returned, or an empty string if there was no error.
 
std::optional< std::string > nextPageUrl
 The URL to use to obtain the next page of results, if there is a next page.
 
std::optional< std::string > previousPageUrl
 The URL to use to obtain the previous page of results, if there is one.
 

Detailed Description

template<typename T>
struct CesiumIonClient::Response< T >

A response from Cesium ion.

Template Parameters
TThe type of the response object.

Definition at line 19 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/3]

template<typename T >
CesiumIonClient::Response< T >::Response ( const std::shared_ptr< CesiumAsync::IAssetRequest > & pRequest,
T && value )

Creates a Response from a completed request and a response value.

Parameters
pRequestA completed request. The constructor will attempt to obtain the httpStatusCode, previousPageUrl, and nextPageUrl from this request.
valueThe response value.

◆ Response() [2/3]

template<typename T >
CesiumIonClient::Response< T >::Response ( T && value,
uint16_t httpStatusCode,
const std::string & errorCode,
const std::string & errorMessage )

Creates a Response from a response value, status code, and error information.

Parameters
valueThe response value.
httpStatusCodeThe HTTP status code of the response.
errorCodeThe error code. See Response::errorCode. If no error occurred, pass an empty string.
errorMessageThe error message. See Response::errorMessage. If no error occurred, pass an empty string.

◆ Response() [3/3]

template<typename T >
CesiumIonClient::Response< T >::Response ( uint16_t httpStatusCode,
const std::string & errorCode,
const std::string & errorMessage )

Creates a Response with no value, a status code, and error information.

Parameters
httpStatusCodeThe HTTP status code of the response.
errorCodeThe error code. See Response::errorCode.
errorMessageThe error message. See Response::errorMessage.

Member Data Documentation

◆ errorCode

template<typename T >
std::string CesiumIonClient::Response< T >::errorCode

The error code, or empty string if there was no error.

If no response is received at all, the code will be "NoResponse".

If Cesium ion returns an error, this will be the code reported by Cesium ion.

If Cesium ion reports success but an error occurs while attempting to parse the response, the code will be "ParseError".

Definition at line 90 of file Response.h.

◆ errorMessage

template<typename T >
std::string CesiumIonClient::Response< T >::errorMessage

The error message returned, or an empty string if there was no error.

If Cesium ion returns an error, this will be the message reported by Cesium ion. If Cesium ion reports success but another error occurs, the message will contain further details of the error.

Definition at line 100 of file Response.h.

◆ httpStatusCode

template<typename T >
uint16_t CesiumIonClient::Response< T >::httpStatusCode

The HTTP status code returned by Cesium ion.

Definition at line 76 of file Response.h.

◆ nextPageUrl

template<typename T >
std::optional<std::string> CesiumIonClient::Response< T >::nextPageUrl

The URL to use to obtain the next page of results, if there is a next page.

Call Connection::nextPage rather than using this field directly.

Definition at line 108 of file Response.h.

◆ previousPageUrl

template<typename T >
std::optional<std::string> CesiumIonClient::Response< T >::previousPageUrl

The URL to use to obtain the previous page of results, if there is one.

Call Connection::previousPage rather than using this field directly.

Definition at line 116 of file Response.h.

◆ value

template<typename T >
std::optional<T> CesiumIonClient::Response< T >::value

The response value, or std::nullopt if the response was unsuccessful.

Definition at line 71 of file Response.h.


The documentation for this struct was generated from the following file: