3#include "../Utils/MonoPtr.hpp"
4#include "../Utils/Json.hpp"
6#include <UnityEngine/Networking/UnityWebRequest.hpp>
7#include <System/Net/HttpStatusCode.hpp>
8#include <System/String.hpp>
17 using namespace System::Net;
18 using namespace UnityEngine::Networking;
33 _u::HttpStatusCode m_StatusCode;
35 std::u16string m_ReasonPhrase;
37 bool m_IsSuccessStatusCode;
43 std::optional<std::u16string> m_BodyString;
60 using Ptr = std::shared_ptr<WebResponse>;
70 bool TryAsJObject(std::shared_ptr<_v::Json::U16Document>& p_Object)
74 auto l_New = std::make_shared<_v::Json::U16Document>();
77 if (!_v::Json::TryFromU16String(
BodyString(), *l_New.get()))
82 catch (
const std::exception& l_Exception)
88 return p_Object !=
nullptr;
95 template<
typename t_Type>
101 _v::Json::U16Document l_Document;
102 _v::Json::TryFromU16String(
BodyString(), l_Document);
104 p_Object = std::make_shared<t_Type>();
105 p_Object->Unserialize(l_Document);
107 catch (
const std::exception& l_Exception)
113 return p_Object !=
nullptr;
std::u16string_view ReasonPhrase()
Reason phrase.
bool IsSuccessStatusCode()
Is success.
bool ShouldRetry()
Should retry.
WebResponse(_u::UnityWebRequest *p_Request)
bool TryGetObject(std::shared_ptr< t_Type > &p_Object)
Get Object from serialized JSON.
std::u16string_view BodyString()
Response bytes.
_v::MonoPtr<::Array< uint8_t > > & BodyBytes()
Response bytes.
bool TryAsJObject(std::shared_ptr< _v::Json::U16Document > &p_Object)
Get JObject from serialized JSON.
_u::HttpStatusCode StatusCode()
Result code.
Network and HTTP utilities.
Various platform utils like Delegate/Action/Function/Event system.