5#include "CoreMinimal.h"
6#include "Kismet/BlueprintFunctionLibrary.h"
8#include "Dom/JsonValue.h"
12#include "ApexLibrary.generated.h"
23 UFUNCTION(BlueprintCallable, Category = "
Apex|API")
27 static TArray<TSharedPtr<FJsonValue>> ConvertToJsonValueStringArray(const TArray<FString>&
Array)
29 TArray<TSharedPtr<FJsonValue>> ConvertedArray;
30 for (
const FString& Item :
Array)
33 ConvertedArray.Add(ItemPtr);
36 return ConvertedArray;
39 static TArray<TSharedPtr<FJsonValue>> ConvertToJsonValueObjectArray(
const TArray<FJsonable>&
Array)
41 TArray<TSharedPtr<FJsonValue>> ConvertedArray;
44 TSharedPtr<FJsonValueObject> ItemPtr(
new FJsonValueObject(Item.ToJsonObject()));
45 ConvertedArray.Add(ItemPtr);
48 return ConvertedArray;
51 static bool TryFillFromStringField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, FString& ValueToFill)
53 if (JObject->HasField(Field))
55 ValueToFill = JObject->GetStringField(Field);
62 static bool TryFillFromBoolField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field,
bool& ValueToFill)
64 if (JObject->HasField(Field))
66 ValueToFill = JObject->GetBoolField(Field);
73 static bool TryFillFromNumberField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field,
float& ValueToFill)
75 if (JObject->HasField(Field))
77 ValueToFill = JObject->GetNumberField(Field);
84 static bool TryFillFromIntegerField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field,
int& ValueToFill)
86 if (JObject->HasField(Field))
88 ValueToFill = JObject->GetIntegerField(Field);
95 static bool TryFillFromObjectField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field,
FJsonable& ValueToFill)
97 if (JObject->HasField(Field))
106 static bool TryFillFromObjectArrayField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, TArray<FJsonable>& ArrayToFill)
108 if (JObject->HasField(Field))
110 TArray<TSharedPtr<FJsonValue>>
Array = JObject->GetArrayField(Field);
112 for (TSharedPtr<FJsonValue> Value :
Array)
115 ArrayToFill.Add(Jsonable);
123 static bool TryFillFromStringArrayField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, TArray<FString>& ArrayToFill)
125 if (JObject->HasField(Field))
127 TArray<TSharedPtr<FJsonValue>>
Array = JObject->GetArrayField(Field);
128 for (TSharedPtr<FJsonValue> Value :
Array)
130 ArrayToFill.Add(Value->AsString());
138 static bool TryFillFromNumberArrayField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, TArray<float>& ArrayToFill)
140 if (JObject->HasField(Field))
142 TArray<TSharedPtr<FJsonValue>>
Array = JObject->GetArrayField(Field);
143 for (TSharedPtr<FJsonValue> Value :
Array)
145 ArrayToFill.Add(Value->AsNumber());
153 static bool TryFillFromIntegerArrayField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, TArray<int>& ArrayToFill)
155 if (JObject->HasField(Field))
157 TArray<TSharedPtr<FJsonValue>>
Array = JObject->GetArrayField(Field);
158 for (TSharedPtr<FJsonValue> Value :
Array)
160 ArrayToFill.Add(Value->AsNumber());
168 static bool TryFillFromBoolArrayField(
const TSharedPtr<FJsonObject>& JObject,
const FString Field, TArray<bool>& ArrayToFill)
170 if (JObject->HasField(Field))
172 TArray<TSharedPtr<FJsonValue>>
Array = JObject->GetArrayField(Field);
173 for (TSharedPtr<FJsonValue> Value :
Array)
175 ArrayToFill.Add(Value->AsBool());
186 return VaRestSubsystem;
189 static FString GetApexSDKVersion();
static bool TryFillFromObjectArrayField(const TSharedPtr< FJsonObject > &JObject, const FString Field, TArray< FJsonable > &ArrayToFill)
static TArray< TSharedPtr< FJsonValue > > ConvertToJsonValueObjectArray(const TArray< FJsonable > &Array)
static bool TryFillFromIntegerArrayField(const TSharedPtr< FJsonObject > &JObject, const FString Field, TArray< int > &ArrayToFill)
static bool TryFillFromNumberArrayField(const TSharedPtr< FJsonObject > &JObject, const FString Field, TArray< float > &ArrayToFill)
static bool TryFillFromIntegerField(const TSharedPtr< FJsonObject > &JObject, const FString Field, int &ValueToFill)
static bool TryFillFromObjectField(const TSharedPtr< FJsonObject > &JObject, const FString Field, FJsonable &ValueToFill)
static TArray< TSharedPtr< FJsonValue > > ConvertToJsonValueStringArray(const TArray< FString > &Array)
static bool TryFillFromBoolField(const TSharedPtr< FJsonObject > &JObject, const FString Field, bool &ValueToFill)
static bool TryFillFromNumberField(const TSharedPtr< FJsonObject > &JObject, const FString Field, float &ValueToFill)
static bool TryFillFromStringField(const TSharedPtr< FJsonObject > &JObject, const FString Field, FString &ValueToFill)
static bool TryFillFromBoolArrayField(const TSharedPtr< FJsonObject > &JObject, const FString Field, TArray< bool > &ArrayToFill)
static UVaRestSubsystem * GetRestSubsystem()
static bool TryFillFromStringArrayField(const TSharedPtr< FJsonObject > &JObject, const FString Field, TArray< FString > &ArrayToFill)
UCLASS(BlueprintType, Blueprintable)
virtual void FromJsonObject(const TSharedPtr< FJsonObject > &JObject)