LootLocker Unreal SDK 10.4.0
Game backend SDK for Unreal Engine
Loading...
Searching...
No Matches
LootLockerMetadataRequestHandler.h
Go to the documentation of this file.
1// Copyright (c) 2021 LootLocker
2
3#pragma once
4
5
6#include "CoreMinimal.h"
7#include "Dom/JsonObject.h"
10#include "LootLockerMetadataRequestHandler.generated.h"
11
12//==================================================
13// Enum Definitions
14//==================================================
15
18UENUM(BlueprintType, Category = "LootLocker")
23{
24 reward = 0,
25 leaderboard = 1,
26 catalog_item = 2,
27 progression = 3,
28 currency = 4,
29 player = 5,
30 self = 6,
31 asset = 7,
32 item = 8, // This is the source for asset instances (player inventory items), while the "asset" source is for the asset in general
33};
35
38UENUM(BlueprintType, Category = "LootLocker")
42enum class ELootLockerMetadataTypes : uint8
43{
44 String = 0,
45 Number = 1,
46 Bool = 2,
47 Json = 3,
48 Base64 = 4,
49};
51
54UENUM(BlueprintType, Category = "LootLocker")
59{
60 Create = 0,
61 Update = 1,
62 Delete = 2,
63 Create_or_Update = 3, // Alias for Upsert (same thing)
64 Upsert = 4
65};
67
70UENUM(BlueprintType, Category = "LootLocker")
75{
76 OnString = 0 UMETA(ToolTip="Triggered when the parsed entry is of type String. The String Value field will be populated"),
77 OnInteger = 1 UMETA(ToolTip = "Triggered when the parsed entry is of type Integer (non decimal number). The Integer Value field will be populated"),
78 OnFloat = 2 UMETA(ToolTip = "Triggered when the parsed entry is of type Float (decimal number). The Float Value field will be populated"),
79 OnNumber = 3 UMETA(ToolTip = "Triggered when the parsed entry is a number but not a regular integer or float (could for example be too big to fit in either of those types, or the decimal precision is higher than can be solved with either of the types). The NumberString value field will be populated"),
80 OnBool = 4 UMETA(ToolTip = "Triggered when the parsed entry is of type Bool. The Bool Value field will be populated"),
81 OnJson = 5 UMETA(ToolTip = "Triggered when the parsed entry is of type Json. The JsonString Value field will be populated with the string representation of the json, convert to a JSON object or straight to a USTRUCT of your design"),
82 OnBase64 = 6 UMETA(ToolTip = "Triggered when the parsed entry is of type Base64. The Base64 Value field will be populated"),
83 OnError = 7 UMETA(ToolTip = "Triggered when the entry could not be parsed. The ErrorMessage Value field will be populated"),
84};
86
87
88//==================================================
89// Data Type Definitions
90//==================================================
91
95USTRUCT(BlueprintType, Category = "LootLocker")
97{
98 GENERATED_BODY()
102 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
103 FString Content_type = "";
107 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
108 FString Content = "";
109};
110
114USTRUCT(BlueprintType, Category = "LootLocker")
116{
117 GENERATED_BODY()
121 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
122 FString Key = "";
126 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
131 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
132 TArray<FString> Tags;
137 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
138 TArray<FString> Access;
142 LOOTLOCKERSDK_API bool TryGetValueAsString(FString& Output) const;
146 LOOTLOCKERSDK_API bool TryGetValueAsFloat(float& Output) const;
150 LOOTLOCKERSDK_API bool TryGetValueAsInteger(int& Output) const;
154 LOOTLOCKERSDK_API bool TryGetValueAsBool(bool& Output) const;
158 LOOTLOCKERSDK_API bool TryGetRawValue(TSharedPtr<FJsonValue>& Output) const;
162 LOOTLOCKERSDK_API bool TryGetSerializedValue(FString& Output) const;
166 LOOTLOCKERSDK_API bool TryGetValueAsJsonObject(TSharedPtr<FJsonObject>& Output) const;
170 LOOTLOCKERSDK_API bool TryGetValueAsJsonArray(TArray<TSharedPtr<FJsonValue>>& Output) const;
174 LOOTLOCKERSDK_API bool TryGetValueAsBase64(FLootLockerMetadataBase64Value& Output) const;
175
179 LOOTLOCKERSDK_API void SetValueAsString(const FString& Value);
183 LOOTLOCKERSDK_API void SetValueAsFloat(const float& Value);
187 LOOTLOCKERSDK_API void SetValueAsInteger(const int& Value);
191 LOOTLOCKERSDK_API void SetValueAsBool(const bool& Value);
195 LOOTLOCKERSDK_API void SetRawValue(const TSharedPtr<FJsonValue>& Value);
199 template<typename T>
200 LOOTLOCKERSDK_API bool SetValueAsUStruct(const T& Value);
204 LOOTLOCKERSDK_API void SetValueAsJsonObject(const FJsonObject& Value);
208 LOOTLOCKERSDK_API void SetValueAsJsonArray(const TArray<TSharedPtr<FJsonValue>>& Value);
212 LOOTLOCKERSDK_API void SetValueAsBase64(const FLootLockerMetadataBase64Value& Value);
213
217 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeStringEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FString& Value);
221 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeFloatEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const float& Value);
225 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeIntegerEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const int Value);
229 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeBoolEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const bool Value);
233 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonValueEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const ELootLockerMetadataTypes Type, const TSharedPtr<FJsonValue> Value);
237 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonObjectEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FJsonObject& Value);
241 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonArrayEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const TArray<TSharedPtr<FJsonValue>>& Value);
245 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeBase64Entry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FLootLockerMetadataBase64Value& Value);
246
249 void LOOTLOCKERSDK_API _INTERNAL_SetJsonRepresentation(const FJsonObject& obj);
250 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeEntryExceptValue(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const ELootLockerMetadataTypes Type);
251private:
252
253 FJsonObject EntryAsJson;
254};
255
259USTRUCT(BlueprintType, Category = "LootLocker")
261{
262 GENERATED_BODY()
266 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
267 FString Key = "";
271 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
273};
274
278USTRUCT(BlueprintType, Category = "LootLocker")
280{
281 GENERATED_BODY()
285 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
290 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
295 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
296 FString Error = "";
297};
298
302USTRUCT(BlueprintType, Category = "LootLocker")
304{
305 GENERATED_BODY()
309 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
314 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
315 FString Id = "";
319 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
320 TArray<FString> Keys;
321};
322
326USTRUCT(BlueprintType, Category = "LootLocker")
328{
329 GENERATED_BODY()
333 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
338 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
339 FString Source_id = "";
343 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
348 int LOOTLOCKERSDK_API __INTERNAL_GetEntryIndexByKey(const FString& Key) const;
352 void LOOTLOCKERSDK_API __INTERNAL_GenerateKeyMap();
353private:
354 TMap<FString, int> KeyToEntryIndex = TMap<FString, int>();
355};
356
357//==================================================
358// Request Definitions
359//==================================================
363USTRUCT(BlueprintType, Category = "LootLocker")
365{
366 GENERATED_BODY()
370 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
372};
373
377USTRUCT(BlueprintType, Category = "LootLocker")
379{
380 GENERATED_BODY()
384 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
389 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
391};
392
393//==================================================
394// Response Definitions
395//==================================================
396
400USTRUCT(BlueprintType, Category = "LootLocker")
402{
403 GENERATED_BODY()
407 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
412 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
417 int LOOTLOCKERSDK_API __INTERNAL_GetEntryIndexByKey(const FString& Key) const;
421 void LOOTLOCKERSDK_API __INTERNAL_GenerateKeyMap();
422private:
423 TMap<FString, int> KeyToEntryIndex = TMap<FString, int>();
424};
425
429USTRUCT(BlueprintType, Category = "LootLocker")
431{
432 GENERATED_BODY()
436 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
438};
439
443USTRUCT(BlueprintType, Category = "LootLocker")
445{
446 GENERATED_BODY()
450 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
455 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
460 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
461 FString Source_id = "";
462};
463
467USTRUCT(BlueprintType, Category = "LootLocker")
469{
470 GENERATED_BODY()
474 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
476};
477
478//==================================================
479// Delegate Definitions
480//==================================================
481
484
500
501//==================================================
502// API Class Definition
503//==================================================
504
506UCLASS()
507class LOOTLOCKERSDK_API ULootLockerMetadataRequestHandler : public UObject
508{
509 GENERATED_BODY()
510public:
512
513 static FString ListMetadata(const FLootLockerPlayerData& PlayerData, const ELootLockerMetadataSources Source, const FString& SourceID, const int Page, const int PerPage, const FString& Key, const TArray<FString>& Tags, const bool IgnoreFiles, const FLootLockerListMetadataResponseDelegate& OnComplete);
514 static FString GetMetadata(const FLootLockerPlayerData& PlayerData, const ELootLockerMetadataSources Source, const FString& SourceID, const FString& Key, const bool IgnoreFiles, const FLootLockerGetMetadataResponseDelegate& OnComplete);
515 static FString GetMultisourceMetadata(const FLootLockerPlayerData& PlayerData, const TArray<FLootLockerMetadataSourceAndKeys>& SourcesAndKeysToGet, const bool IgnoreFiles, const FLootLockerGetMultisourceMetadataResponseDelegate& OnComplete);
516 static FString SetMetadata(const FLootLockerPlayerData& PlayerData, const ELootLockerMetadataSources Source, const FString& SourceID, const TArray<FLootLockerSetMetadataAction>& MetadataToActionsToPerform, const FLootLockerSetMetadataResponseDelegate& OnComplete);
517};
Definition LootLockerMetadataRequestHandler.h:508
static FString ListMetadata(const FLootLockerPlayerData &PlayerData, const ELootLockerMetadataSources Source, const FString &SourceID, const int Page, const int PerPage, const FString &Key, const TArray< FString > &Tags, const bool IgnoreFiles, const FLootLockerListMetadataResponseDelegate &OnComplete)
static FString GetMetadata(const FLootLockerPlayerData &PlayerData, const ELootLockerMetadataSources Source, const FString &SourceID, const FString &Key, const bool IgnoreFiles, const FLootLockerGetMetadataResponseDelegate &OnComplete)
static FString GetMultisourceMetadata(const FLootLockerPlayerData &PlayerData, const TArray< FLootLockerMetadataSourceAndKeys > &SourcesAndKeysToGet, const bool IgnoreFiles, const FLootLockerGetMultisourceMetadataResponseDelegate &OnComplete)
ULootLockerMetadataRequestHandler()
Definition LootLockerMetadataRequestHandler.h:511
static FString SetMetadata(const FLootLockerPlayerData &PlayerData, const ELootLockerMetadataSources Source, const FString &SourceID, const TArray< FLootLockerSetMetadataAction > &MetadataToActionsToPerform, const FLootLockerSetMetadataResponseDelegate &OnComplete)
ELootLockerMetadataActions
Possible metadata actions.
Definition LootLockerMetadataRequestHandler.h:59
void(* FLootLockerGetMultisourceMetadataResponseDelegate)(FLootLockerGetMultisourceMetadataResponse)
Blueprint response delegate for getting multi source metadata.
Definition LootLockerMetadataRequestHandler.h:495
ELootLockerMetadataSources
Possible metadata sources.
Definition LootLockerMetadataRequestHandler.h:23
ELootLockerMetadataTypes
Possible metadata types.
Definition LootLockerMetadataRequestHandler.h:43
ELootLockerMetadataParserOutputTypes
Possible metadata parser output types.
Definition LootLockerMetadataRequestHandler.h:75
void(* FLootLockerSetMetadataResponseDelegate)(FLootLockerSetMetadataResponse)
Blueprint response delegate for setting metadata.
Definition LootLockerMetadataRequestHandler.h:499
void(* FLootLockerListMetadataResponseDelegate)(FLootLockerListMetadataResponse)
C++ response delegate for listing metadata.
Definition LootLockerMetadataRequestHandler.h:487
void(* FLootLockerGetMetadataResponseDelegate)(FLootLockerGetMetadataResponse)
C++ response delegate for getting a single metadata entry.
Definition LootLockerMetadataRequestHandler.h:491
Definition LootLockerResponse.h:101
Response containing the single requested metadata entry.
Definition LootLockerMetadataRequestHandler.h:431
Request to retrieve metadata entries from multiple sources and key combinations in a single call.
Definition LootLockerMetadataRequestHandler.h:365
Response containing the requested metadata entries grouped by their source from a multisource get ope...
Definition LootLockerMetadataRequestHandler.h:469
Response containing a paginated page of metadata entries for a given source.
Definition LootLockerMetadataRequestHandler.h:402
Holds a Base64-encoded metadata value together with its MIME content type.
Definition LootLockerMetadataRequestHandler.h:97
Represents a single typed metadata entry with a key, value type, tags, and access level,...
Definition LootLockerMetadataRequestHandler.h:116
Pairs a metadata source and its identifier with the resolved metadata entries retrieved for that sour...
Definition LootLockerMetadataRequestHandler.h:328
Pairs a metadata source and its identifier with a list of keys to fetch from that source.
Definition LootLockerMetadataRequestHandler.h:304
Definition LootLockerPlayerData.h:12
Base response struct — every SDK callback receives a struct that derives from this.
Definition LootLockerResponse.h:19
Describes a single metadata mutation operation (create, update, delete, or upsert) together with the ...
Definition LootLockerMetadataRequestHandler.h:379
Identifies a metadata entry that caused an error during a set operation, by key and value type.
Definition LootLockerMetadataRequestHandler.h:261
Describes a failure that occurred while applying a metadata action, including the action type,...
Definition LootLockerMetadataRequestHandler.h:280
Response from a set-metadata operation, containing any per-entry errors alongside the source identifi...
Definition LootLockerMetadataRequestHandler.h:445