cesium-native 0.43.0
Loading...
Searching...
No Matches
Response.h
1#pragma once
2
3#include <cstdint>
4#include <memory>
5#include <optional>
6#include <string>
7
8namespace CesiumAsync {
9class IAssetRequest;
10}
11
12namespace CesiumIonClient {
13
19template <typename T> struct Response final {
24
34 const std::shared_ptr<CesiumAsync::IAssetRequest>& pRequest,
35 T&& value);
36
49 T&& value,
50 uint16_t httpStatusCode,
51 const std::string& errorCode,
52 const std::string& errorMessage);
53
63 uint16_t httpStatusCode,
64 const std::string& errorCode,
65 const std::string& errorMessage);
66
71 std::optional<T> value;
72
77
90 std::string errorCode;
91
100 std::string errorMessage;
101
108 std::optional<std::string> nextPageUrl;
109
116 std::optional<std::string> previousPageUrl;
117};
118
122struct NoValue {};
123
124} // namespace CesiumIonClient
Classes that support asynchronous operations.
Classes for working with Cesium ion clients.
A non-value, for use with a valueless Response.
Definition Response.h:122
A response from Cesium ion.
Definition Response.h:19
std::optional< T > value
The response value, or std::nullopt if the response was unsuccessful.
Definition Response.h:71
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.
std::string errorCode
The error code, or empty string if there was no error.
Definition Response.h:90
Response(const std::shared_ptr< CesiumAsync::IAssetRequest > &pRequest, T &&value)
Creates a Response from a completed request and a response value.
uint16_t httpStatusCode
The HTTP status code returned by Cesium ion.
Definition Response.h:76
Response(uint16_t httpStatusCode, const std::string &errorCode, const std::string &errorMessage)
Creates a Response with no value, a status code, and error information.
std::optional< std::string > previousPageUrl
The URL to use to obtain the previous page of results, if there is one.
Definition Response.h:116
std::string errorMessage
The error message returned, or an empty string if there was no error.
Definition Response.h:100
std::optional< std::string > nextPageUrl
The URL to use to obtain the next page of results, if there is a next page.
Definition Response.h:108
Response()
Creates a new empty Response.