cesium-native  0.41.0
Response.h
1 #pragma once
2 
3 #include <cstdint>
4 #include <memory>
5 #include <optional>
6 #include <string>
7 
8 namespace CesiumAsync {
9 class IAssetRequest;
10 }
11 
12 namespace CesiumIonClient {
13 
19 template <typename T> struct Response final {
20  Response();
21 
22  Response(
23  const std::shared_ptr<CesiumAsync::IAssetRequest>& pRequest,
24  T&& value);
25 
26  Response(
27  T&& value,
28  uint16_t httpStatusCode,
29  const std::string& errorCode,
30  const std::string& errorMessage);
31 
32  Response(
33  uint16_t httpStatusCode,
34  const std::string& errorCode,
35  const std::string& errorMessage);
36 
41  std::optional<T> value;
42 
46  uint16_t httpStatusCode;
47 
60  std::string errorCode;
61 
70  std::string errorMessage;
71 
78  std::optional<std::string> nextPageUrl;
79 
86  std::optional<std::string> previousPageUrl;
87 };
88 
92 struct NoValue {};
93 
94 } // 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:92
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:41
std::string errorCode
The error code, or empty string if there was no error.
Definition: Response.h:60
uint16_t httpStatusCode
The HTTP status code returned by Cesium ion.
Definition: Response.h:46
std::optional< std::string > previousPageUrl
The URL to use to obtain the previous page of results, if there is one.
Definition: Response.h:86
std::string errorMessage
The error message returned, or an empty string if there was no error.
Definition: Response.h:70
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:78