mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
[C++][Ue4] various bus fixes (#6539)
* Fixed compilation on linux and UE4.23 * Added string and enum type definition support * Better handling or variable names, should avoid conflicts with reserved keywords or empty variable names in edge cases * Updated samples
This commit is contained in:
parent
83a0f7d65b
commit
0f627e70fb
@ -497,13 +497,20 @@ public class CppUE4ClientCodegen extends AbstractCppCodegen {
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
//Unreal variable names are CamelCase
|
||||
String camelCaseName = camelize(name, false);
|
||||
|
||||
//Avoid empty variable name at all costs
|
||||
if(!camelCaseName.isEmpty()) {
|
||||
name = camelCaseName;
|
||||
}
|
||||
|
||||
// for reserved word or word starting with number, append _
|
||||
if (isReservedWord(name) || name.matches("^\\d.*")) {
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
//Unreal variable names are CamelCase
|
||||
return camelize(name, false);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,5 +15,6 @@ public class {{unrealModuleName}} : ModuleRules
|
||||
"Json",
|
||||
}
|
||||
);
|
||||
PCHUsage = PCHUsageMode.NoPCHs;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public:
|
||||
{{#responses.0}}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
{{/responses.0}}
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
{{#returnType}}{{{returnType}}} Content;{{/returnType}}
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Serialization/JsonSerializer.h"
|
||||
#include "Dom/JsonObject.h"
|
||||
#include "Misc/Base64.h"
|
||||
#include "PlatformHttp.h"
|
||||
|
||||
class IHttpRequest;
|
||||
|
||||
@ -196,10 +197,22 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||
{
|
||||
Writer->WriteValue(Value);
|
||||
if (Value.IsValid())
|
||||
{
|
||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Writer->WriteObjectStart();
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||
{
|
||||
Writer->WriteValue(ToString(Value));
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
||||
@ -212,6 +225,12 @@ inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
|
||||
Value.WriteJson(Writer);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||
{
|
||||
Writer->WriteValue(Value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
||||
{
|
||||
@ -235,54 +254,8 @@ inline void WriteJsonValue(JsonWriter& Writer, const TMap<FString, T>& Value)
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||
{
|
||||
if (Value.IsValid())
|
||||
{
|
||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Writer->WriteObjectStart();
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||
{
|
||||
Writer->WriteValue(ToString(Value));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||
{
|
||||
return TryGetJsonValue(JsonValue, Value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||
{
|
||||
if(JsonObject->HasField(Key))
|
||||
{
|
||||
T Value;
|
||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||
{
|
||||
OptionalValue = Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true; // Absence of optional value is not a parsing error
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
||||
{
|
||||
FString TmpValue;
|
||||
@ -316,6 +289,34 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, bool& Value
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
{
|
||||
JsonObjectValue = *Object;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||
{
|
||||
FString TmpValue;
|
||||
if (JsonValue->TryGetString(TmpValue))
|
||||
{
|
||||
Base64UrlDecode(TmpValue, Value);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||
{
|
||||
return Value.FromJson(JsonValue);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||
{
|
||||
@ -329,15 +330,6 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
return Value.FromJson(*Object);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
||||
{
|
||||
@ -377,27 +369,32 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TMap<FStrin
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||
{
|
||||
JsonObjectValue = *Object;
|
||||
return true;
|
||||
return TryGetJsonValue(JsonValue, Value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||
{
|
||||
FString TmpValue;
|
||||
if (JsonValue->TryGetString(TmpValue))
|
||||
if(JsonObject->HasField(Key))
|
||||
{
|
||||
Base64UrlDecode(TmpValue, Value);
|
||||
return true;
|
||||
T Value;
|
||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||
{
|
||||
OptionalValue = Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true; // Absence of optional value is not a parsing error
|
||||
}
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Interfaces/IHttpRequest.h"
|
||||
#include "PlatformHttp.h"
|
||||
#include "Misc/FileHelper.h"
|
||||
#include "Misc/Paths.h"
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
namespace {{this}}
|
||||
|
@ -18,7 +18,7 @@ class {{dllapi}} Model
|
||||
public:
|
||||
virtual ~Model() {}
|
||||
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||
};
|
||||
|
||||
class {{dllapi}} Request
|
||||
@ -33,7 +33,7 @@ class {{dllapi}} Response
|
||||
{
|
||||
public:
|
||||
virtual ~Response() {}
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||
|
||||
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
||||
bool IsSuccessful() const { return Successful; }
|
||||
|
@ -21,9 +21,26 @@ class {{dllapi}} {{classname}} : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~{{classname}}() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
{{#isString}}
|
||||
{{#isEnum}}
|
||||
{{#allowableValues}}
|
||||
enum class Values
|
||||
{
|
||||
{{#enumVars}}
|
||||
{{name}},
|
||||
{{/enumVars}}
|
||||
};
|
||||
|
||||
Values Value{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||
{{/allowableValues}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
FString Value{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||
{{/isEnum}}
|
||||
{{/isString}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
{{#allowableValues}}
|
||||
|
@ -11,6 +11,54 @@ namespace {{this}}
|
||||
{
|
||||
{{/cppNamespaceDeclarations}}
|
||||
{{#models}}{{#model}}
|
||||
{{#isEnum}}
|
||||
inline FString ToString(const {{classname}}::Values& Value)
|
||||
{
|
||||
{{#allowableValues}}
|
||||
switch (Value)
|
||||
{
|
||||
{{#enumVars}}
|
||||
case {{classname}}::Values::{{name}}:
|
||||
return TEXT({{{value}}});
|
||||
{{/enumVars}}
|
||||
}
|
||||
{{/allowableValues}}
|
||||
|
||||
UE_LOG(Log{{unrealModuleName}}, Error, TEXT("Invalid {{classname}}::Values Value (%d)"), (int)Value);
|
||||
return TEXT("");
|
||||
}
|
||||
|
||||
inline FStringFormatArg ToStringFormatArg(const {{classname}}::Values& Value)
|
||||
{
|
||||
return FStringFormatArg(ToString(Value));
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const {{classname}}::Values& Value)
|
||||
{
|
||||
WriteJsonValue(Writer, ToString(Value));
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, {{classname}}::Values& Value)
|
||||
{
|
||||
{{#allowableValues}}
|
||||
FString TmpValue;
|
||||
if (JsonValue->TryGetString(TmpValue))
|
||||
{
|
||||
static TMap<FString, {{classname}}::Values> StringToEnum = { {{#enumVars}}
|
||||
{ TEXT({{{value}}}), {{classname}}::Values::{{name}} },{{/enumVars}} };
|
||||
|
||||
const auto Found = StringToEnum.Find(TmpValue);
|
||||
if(Found)
|
||||
{
|
||||
Value = *Found;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{{/allowableValues}}
|
||||
return false;
|
||||
}
|
||||
|
||||
{{/isEnum}}
|
||||
{{#hasEnums}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
@ -65,9 +113,10 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, {{classname
|
||||
{{/hasEnums}}
|
||||
void {{classname}}::WriteJson(JsonWriter& Writer) const
|
||||
{
|
||||
{{#parent}}
|
||||
#error inheritance not handled right now
|
||||
{{/parent}}
|
||||
{{#isString}}
|
||||
WriteJsonValue(Writer, Value);
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
Writer->WriteObjectStart();
|
||||
{{#vars}}
|
||||
{{#required}}
|
||||
@ -81,18 +130,29 @@ void {{classname}}::WriteJson(JsonWriter& Writer) const
|
||||
{{/required}}
|
||||
{{/vars}}
|
||||
Writer->WriteObjectEnd();
|
||||
{{/isString}}
|
||||
}
|
||||
|
||||
bool {{classname}}::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool {{classname}}::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
{{#isString}}
|
||||
return TryGetJsonValue(JsonValue, Value);
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
{{#vars}}
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("{{baseName}}"), {{name}});
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("{{baseName}}"), {{name}});
|
||||
{{/vars}}
|
||||
|
||||
return ParseSuccess;
|
||||
{{/isString}}
|
||||
}
|
||||
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
{{#cppNamespaceDeclarations}}
|
||||
|
@ -26,5 +26,6 @@ public class OpenAPI : ModuleRules
|
||||
"Json",
|
||||
}
|
||||
);
|
||||
PCHUsage = PCHUsageMode.NoPCHs;
|
||||
}
|
||||
}
|
@ -38,14 +38,19 @@ void OpenAPIApiResponse::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPIApiResponse::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPIApiResponse::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("code"), Code);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("type"), Type);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("message"), Message);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("code"), Code);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("type"), Type);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("message"), Message);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,13 +34,18 @@ void OpenAPICategory::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPICategory::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPICategory::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Interfaces/IHttpRequest.h"
|
||||
#include "PlatformHttp.h"
|
||||
#include "Misc/FileHelper.h"
|
||||
#include "Misc/Paths.h"
|
||||
|
||||
namespace OpenAPI
|
||||
{
|
||||
|
@ -96,17 +96,22 @@ void OpenAPIOrder::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPIOrder::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPIOrder::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("petId"), PetId);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("quantity"), Quantity);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("shipDate"), ShipDate);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("status"), Status);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("complete"), Complete);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("petId"), PetId);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("quantity"), Quantity);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("shipDate"), ShipDate);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("status"), Status);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("complete"), Complete);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,17 +90,22 @@ void OpenAPIPet::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPIPet::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPIPet::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("category"), Category);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("photoUrls"), PhotoUrls);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("tags"), Tags);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("status"), Status);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("category"), Category);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("photoUrls"), PhotoUrls);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("tags"), Tags);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("status"), Status);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,13 +34,18 @@ void OpenAPITag::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPITag::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPITag::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("name"), Name);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("name"), Name);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,19 +58,24 @@ void OpenAPIUser::WriteJson(JsonWriter& Writer) const
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
bool OpenAPIUser::FromJson(const TSharedPtr<FJsonObject>& JsonObject)
|
||||
bool OpenAPIUser::FromJson(const TSharedPtr<FJsonValue>& JsonValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (!JsonValue->TryGetObject(Object))
|
||||
return false;
|
||||
|
||||
bool ParseSuccess = true;
|
||||
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("username"), Username);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("firstName"), FirstName);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("lastName"), LastName);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("email"), Email);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("password"), Password);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("phone"), Phone);
|
||||
ParseSuccess &= TryGetJsonValue(JsonObject, TEXT("userStatus"), UserStatus);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("id"), Id);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("username"), Username);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("firstName"), FirstName);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("lastName"), LastName);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("email"), Email);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("password"), Password);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("phone"), Phone);
|
||||
ParseSuccess &= TryGetJsonValue(*Object, TEXT("userStatus"), UserStatus);
|
||||
|
||||
return ParseSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIApiResponse : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPIApiResponse() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int32> Code;
|
||||
|
@ -27,7 +27,7 @@ class OPENAPI_API Model
|
||||
public:
|
||||
virtual ~Model() {}
|
||||
virtual void WriteJson(JsonWriter& Writer) const = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||
};
|
||||
|
||||
class OPENAPI_API Request
|
||||
@ -42,7 +42,7 @@ class OPENAPI_API Response
|
||||
{
|
||||
public:
|
||||
virtual ~Response() {}
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) = 0;
|
||||
virtual bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) = 0;
|
||||
|
||||
void SetSuccessful(bool InSuccessful) { Successful = InSuccessful; }
|
||||
bool IsSuccessful() const { return Successful; }
|
||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPICategory : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPICategory() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int64> Id;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Serialization/JsonSerializer.h"
|
||||
#include "Dom/JsonObject.h"
|
||||
#include "Misc/Base64.h"
|
||||
#include "PlatformHttp.h"
|
||||
|
||||
class IHttpRequest;
|
||||
|
||||
@ -205,10 +206,22 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||
{
|
||||
Writer->WriteValue(Value);
|
||||
if (Value.IsValid())
|
||||
{
|
||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Writer->WriteObjectStart();
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||
{
|
||||
Writer->WriteValue(ToString(Value));
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
|
||||
@ -221,6 +234,12 @@ inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
|
||||
Value.WriteJson(Writer);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const T& Value)
|
||||
{
|
||||
Writer->WriteValue(Value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<T>& Value)
|
||||
{
|
||||
@ -244,54 +263,8 @@ inline void WriteJsonValue(JsonWriter& Writer, const TMap<FString, T>& Value)
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonObject>& Value)
|
||||
{
|
||||
if (Value.IsValid())
|
||||
{
|
||||
FJsonSerializer::Serialize(Value.ToSharedRef(), Writer, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Writer->WriteObjectStart();
|
||||
Writer->WriteObjectEnd();
|
||||
}
|
||||
}
|
||||
|
||||
inline void WriteJsonValue(JsonWriter& Writer, const TArray<uint8>& Value)
|
||||
{
|
||||
Writer->WriteValue(ToString(Value));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||
{
|
||||
return TryGetJsonValue(JsonValue, Value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||
{
|
||||
if(JsonObject->HasField(Key))
|
||||
{
|
||||
T Value;
|
||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||
{
|
||||
OptionalValue = Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true; // Absence of optional value is not a parsing error
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FString& Value)
|
||||
{
|
||||
FString TmpValue;
|
||||
@ -325,6 +298,34 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, bool& Value
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
{
|
||||
JsonObjectValue = *Object;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||
{
|
||||
FString TmpValue;
|
||||
if (JsonValue->TryGetString(TmpValue))
|
||||
{
|
||||
Base64UrlDecode(TmpValue, Value);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||
{
|
||||
return Value.FromJson(JsonValue);
|
||||
}
|
||||
|
||||
template<typename T, typename std::enable_if<!std::is_base_of<Model, T>::value, int>::type = 0>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||
{
|
||||
@ -338,15 +339,6 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, T& Value)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, Model& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
return Value.FromJson(*Object);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<T>& ArrayValue)
|
||||
{
|
||||
@ -386,27 +378,32 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TMap<FStrin
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TSharedPtr<FJsonObject>& JsonObjectValue)
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, T& Value)
|
||||
{
|
||||
const TSharedPtr<FJsonObject>* Object;
|
||||
if (JsonValue->TryGetObject(Object))
|
||||
const TSharedPtr<FJsonValue> JsonValue = JsonObject->TryGetField(Key);
|
||||
if (JsonValue.IsValid() && !JsonValue->IsNull())
|
||||
{
|
||||
JsonObjectValue = *Object;
|
||||
return true;
|
||||
return TryGetJsonValue(JsonValue, Value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, TArray<uint8>& Value)
|
||||
template<typename T>
|
||||
inline bool TryGetJsonValue(const TSharedPtr<FJsonObject>& JsonObject, const FString& Key, TOptional<T>& OptionalValue)
|
||||
{
|
||||
FString TmpValue;
|
||||
if (JsonValue->TryGetString(TmpValue))
|
||||
if(JsonObject->HasField(Key))
|
||||
{
|
||||
Base64UrlDecode(TmpValue, Value);
|
||||
return true;
|
||||
T Value;
|
||||
if (TryGetJsonValue(JsonObject, Key, Value))
|
||||
{
|
||||
OptionalValue = Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true; // Absence of optional value is not a parsing error
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIOrder : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPIOrder() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int64> Id;
|
||||
|
@ -28,7 +28,7 @@ class OPENAPI_API OpenAPIPet : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPIPet() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int64> Id;
|
||||
|
@ -41,7 +41,7 @@ class OPENAPI_API OpenAPIPetApi::AddPetResponse : public Response
|
||||
public:
|
||||
virtual ~AddPetResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -66,7 +66,7 @@ class OPENAPI_API OpenAPIPetApi::DeletePetResponse : public Response
|
||||
public:
|
||||
virtual ~DeletePetResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -97,7 +97,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByStatusResponse : public Response
|
||||
public:
|
||||
virtual ~FindPetsByStatusResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
TArray<OpenAPIPet> Content;
|
||||
};
|
||||
@ -122,7 +122,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByTagsResponse : public Response
|
||||
public:
|
||||
virtual ~FindPetsByTagsResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
TArray<OpenAPIPet> Content;
|
||||
};
|
||||
@ -147,7 +147,7 @@ class OPENAPI_API OpenAPIPetApi::GetPetByIdResponse : public Response
|
||||
public:
|
||||
virtual ~GetPetByIdResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
OpenAPIPet Content;
|
||||
};
|
||||
@ -171,7 +171,7 @@ class OPENAPI_API OpenAPIPetApi::UpdatePetResponse : public Response
|
||||
public:
|
||||
virtual ~UpdatePetResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -199,7 +199,7 @@ class OPENAPI_API OpenAPIPetApi::UpdatePetWithFormResponse : public Response
|
||||
public:
|
||||
virtual ~UpdatePetWithFormResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -227,7 +227,7 @@ class OPENAPI_API OpenAPIPetApi::UploadFileResponse : public Response
|
||||
public:
|
||||
virtual ~UploadFileResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
OpenAPIApiResponse Content;
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ class OPENAPI_API OpenAPIStoreApi::DeleteOrderResponse : public Response
|
||||
public:
|
||||
virtual ~DeleteOrderResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -63,7 +63,7 @@ class OPENAPI_API OpenAPIStoreApi::GetInventoryResponse : public Response
|
||||
public:
|
||||
virtual ~GetInventoryResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
TMap<FString, int32> Content;
|
||||
};
|
||||
@ -88,7 +88,7 @@ class OPENAPI_API OpenAPIStoreApi::GetOrderByIdResponse : public Response
|
||||
public:
|
||||
virtual ~GetOrderByIdResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
OpenAPIOrder Content;
|
||||
};
|
||||
@ -112,7 +112,7 @@ class OPENAPI_API OpenAPIStoreApi::PlaceOrderResponse : public Response
|
||||
public:
|
||||
virtual ~PlaceOrderResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
OpenAPIOrder Content;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPITag : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPITag() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int64> Id;
|
||||
|
@ -26,7 +26,7 @@ class OPENAPI_API OpenAPIUser : public Model
|
||||
{
|
||||
public:
|
||||
virtual ~OpenAPIUser() {}
|
||||
bool FromJson(const TSharedPtr<FJsonObject>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
void WriteJson(JsonWriter& Writer) const final;
|
||||
|
||||
TOptional<int64> Id;
|
||||
|
@ -40,7 +40,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUserResponse : public Response
|
||||
public:
|
||||
virtual ~CreateUserResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -64,7 +64,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithArrayInputResponse : public Res
|
||||
public:
|
||||
virtual ~CreateUsersWithArrayInputResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -88,7 +88,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithListInputResponse : public Resp
|
||||
public:
|
||||
virtual ~CreateUsersWithListInputResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -113,7 +113,7 @@ class OPENAPI_API OpenAPIUserApi::DeleteUserResponse : public Response
|
||||
public:
|
||||
virtual ~DeleteUserResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -137,7 +137,7 @@ class OPENAPI_API OpenAPIUserApi::GetUserByNameResponse : public Response
|
||||
public:
|
||||
virtual ~GetUserByNameResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
OpenAPIUser Content;
|
||||
};
|
||||
@ -163,7 +163,7 @@ class OPENAPI_API OpenAPIUserApi::LoginUserResponse : public Response
|
||||
public:
|
||||
virtual ~LoginUserResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
FString Content;
|
||||
};
|
||||
@ -185,7 +185,7 @@ class OPENAPI_API OpenAPIUserApi::LogoutUserResponse : public Response
|
||||
public:
|
||||
virtual ~LogoutUserResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
@ -212,7 +212,7 @@ class OPENAPI_API OpenAPIUserApi::UpdateUserResponse : public Response
|
||||
public:
|
||||
virtual ~UpdateUserResponse() {}
|
||||
void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonObject) final;
|
||||
bool FromJson(const TSharedPtr<FJsonValue>& JsonValue) final;
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user