LootLocker Unreal SDK 10.6.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 legacy items, while the "inventory_item" source is for item instances
33 inventory_item = 9, // This is the source for item instances (player inventory items)
34 item_template = 10, // This is the source for item templates
35};
37
40UENUM(BlueprintType, Category = "LootLocker")
44enum class ELootLockerMetadataTypes : uint8
45{
46 String = 0,
47 Number = 1,
48 Bool = 2,
49 Json = 3,
50 Base64 = 4,
51};
53
56UENUM(BlueprintType, Category = "LootLocker")
61{
62 Create = 0,
63 Update = 1,
64 Delete = 2,
65 Create_or_Update = 3, // Alias for Upsert (same thing)
66 Upsert = 4
67};
69
72UENUM(BlueprintType, Category = "LootLocker")
77{
78 OnString = 0 UMETA(ToolTip="Triggered when the parsed entry is of type String. The String Value field will be populated"),
79 OnInteger = 1 UMETA(ToolTip = "Triggered when the parsed entry is of type Integer (non decimal number). The Integer Value field will be populated"),
80 OnFloat = 2 UMETA(ToolTip = "Triggered when the parsed entry is of type Float (decimal number). The Float Value field will be populated"),
81 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"),
82 OnBool = 4 UMETA(ToolTip = "Triggered when the parsed entry is of type Bool. The Bool Value field will be populated"),
83 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"),
84 OnBase64 = 6 UMETA(ToolTip = "Triggered when the parsed entry is of type Base64. The Base64 Value field will be populated"),
85 OnError = 7 UMETA(ToolTip = "Triggered when the entry could not be parsed. The ErrorMessage Value field will be populated"),
86};
88
89
90//==================================================
91// Data Type Definitions
92//==================================================
93
97USTRUCT(BlueprintType, Category = "LootLocker")
99{
100 GENERATED_BODY()
104 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
105 FString Content_type = "";
109 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
110 FString Content = "";
111};
112
116USTRUCT(BlueprintType, Category = "LootLocker")
118{
119 GENERATED_BODY()
123 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
124 FString Key = "";
128 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
133 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
134 TArray<FString> Tags;
139 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
140 TArray<FString> Access;
144 LOOTLOCKERSDK_API bool TryGetValueAsString(FString& Output) const;
148 LOOTLOCKERSDK_API bool TryGetValueAsFloat(float& Output) const;
152 LOOTLOCKERSDK_API bool TryGetValueAsInteger(int& Output) const;
156 LOOTLOCKERSDK_API bool TryGetValueAsBool(bool& Output) const;
160 LOOTLOCKERSDK_API bool TryGetRawValue(TSharedPtr<FJsonValue>& Output) const;
164 LOOTLOCKERSDK_API bool TryGetSerializedValue(FString& Output) const;
168 LOOTLOCKERSDK_API bool TryGetValueAsJsonObject(TSharedPtr<FJsonObject>& Output) const;
172 LOOTLOCKERSDK_API bool TryGetValueAsJsonArray(TArray<TSharedPtr<FJsonValue>>& Output) const;
176 LOOTLOCKERSDK_API bool TryGetValueAsBase64(FLootLockerMetadataBase64Value& Output) const;
177
181 LOOTLOCKERSDK_API void SetValueAsString(const FString& Value);
185 LOOTLOCKERSDK_API void SetValueAsFloat(const float& Value);
189 LOOTLOCKERSDK_API void SetValueAsInteger(const int& Value);
193 LOOTLOCKERSDK_API void SetValueAsBool(const bool& Value);
197 LOOTLOCKERSDK_API void SetRawValue(const TSharedPtr<FJsonValue>& Value);
201 template<typename T>
202 LOOTLOCKERSDK_API bool SetValueAsUStruct(const T& Value);
206 LOOTLOCKERSDK_API void SetValueAsJsonObject(const FJsonObject& Value);
210 LOOTLOCKERSDK_API void SetValueAsJsonArray(const TArray<TSharedPtr<FJsonValue>>& Value);
214 LOOTLOCKERSDK_API void SetValueAsBase64(const FLootLockerMetadataBase64Value& Value);
215
219 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeStringEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FString& Value);
223 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeFloatEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const float& Value);
227 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeIntegerEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const int Value);
231 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeBoolEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const bool Value);
235 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonValueEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const ELootLockerMetadataTypes Type, const TSharedPtr<FJsonValue> Value);
239 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonObjectEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FJsonObject& Value);
243 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeJsonArrayEntry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const TArray<TSharedPtr<FJsonValue>>& Value);
247 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeBase64Entry(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const FLootLockerMetadataBase64Value& Value);
248
251 void LOOTLOCKERSDK_API _INTERNAL_SetJsonRepresentation(const FJsonObject& obj);
252 static LOOTLOCKERSDK_API FLootLockerMetadataEntry MakeEntryExceptValue(const FString& Key, const TArray<FString>& Tags, const TArray<FString>& Access, const ELootLockerMetadataTypes Type);
253private:
254
255 FJsonObject EntryAsJson;
256};
257
261USTRUCT(BlueprintType, Category = "LootLocker")
263{
264 GENERATED_BODY()
268 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
269 FString Key = "";
273 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
275};
276
280USTRUCT(BlueprintType, Category = "LootLocker")
282{
283 GENERATED_BODY()
287 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
292 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
297 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
298 FString Error = "";
299};
300
304USTRUCT(BlueprintType, Category = "LootLocker")
306{
307 GENERATED_BODY()
311 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
316 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
317 FString Id = "";
321 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
322 TArray<FString> Keys;
323};
324
328USTRUCT(BlueprintType, Category = "LootLocker")
330{
331 GENERATED_BODY()
335 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
340 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
341 FString Source_id = "";
345 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
350 int LOOTLOCKERSDK_API __INTERNAL_GetEntryIndexByKey(const FString& Key) const;
354 void LOOTLOCKERSDK_API __INTERNAL_GenerateKeyMap();
355private:
356 TMap<FString, int> KeyToEntryIndex = TMap<FString, int>();
357};
358
359//==================================================
360// Request Definitions
361//==================================================
365USTRUCT(BlueprintType, Category = "LootLocker")
367{
368 GENERATED_BODY()
372 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
374};
375
379USTRUCT(BlueprintType, Category = "LootLocker")
381{
382 GENERATED_BODY()
386 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
391 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
393};
394
395//==================================================
396// Response Definitions
397//==================================================
398
402USTRUCT(BlueprintType, Category = "LootLocker")
404{
405 GENERATED_BODY()
409 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
414 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
419 int LOOTLOCKERSDK_API __INTERNAL_GetEntryIndexByKey(const FString& Key) const;
423 void LOOTLOCKERSDK_API __INTERNAL_GenerateKeyMap();
424private:
425 TMap<FString, int> KeyToEntryIndex = TMap<FString, int>();
426};
427
431USTRUCT(BlueprintType, Category = "LootLocker")
433{
434 GENERATED_BODY()
438 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
440};
441
445USTRUCT(BlueprintType, Category = "LootLocker")
447{
448 GENERATED_BODY()
452 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
457 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
462 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
463 FString Source_id = "";
464};
465
469USTRUCT(BlueprintType, Category = "LootLocker")
471{
472 GENERATED_BODY()
476 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
478};
479
480//==================================================
481// Delegate Definitions
482//==================================================
483
486
502
503//==================================================
504// API Class Definition
505//==================================================
506
508UCLASS()
509class LOOTLOCKERSDK_API ULootLockerMetadataRequestHandler : public UObject
510{
511 GENERATED_BODY()
512public:
514
515 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);
516 static FString GetMetadata(const FLootLockerPlayerData& PlayerData, const ELootLockerMetadataSources Source, const FString& SourceID, const FString& Key, const bool IgnoreFiles, const FLootLockerGetMetadataResponseDelegate& OnComplete);
517 static FString GetMultisourceMetadata(const FLootLockerPlayerData& PlayerData, const TArray<FLootLockerMetadataSourceAndKeys>& SourcesAndKeysToGet, const bool IgnoreFiles, const FLootLockerGetMultisourceMetadataResponseDelegate& OnComplete);
518 static FString SetMetadata(const FLootLockerPlayerData& PlayerData, const ELootLockerMetadataSources Source, const FString& SourceID, const TArray<FLootLockerSetMetadataAction>& MetadataToActionsToPerform, const FLootLockerSetMetadataResponseDelegate& OnComplete);
519};
Definition LootLockerMetadataRequestHandler.h:510
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:513
static FString SetMetadata(const FLootLockerPlayerData &PlayerData, const ELootLockerMetadataSources Source, const FString &SourceID, const TArray< FLootLockerSetMetadataAction > &MetadataToActionsToPerform, const FLootLockerSetMetadataResponseDelegate &OnComplete)
@ Source
Order by the source that granted the item.
ELootLockerMetadataActions
Possible metadata actions.
Definition LootLockerMetadataRequestHandler.h:61
void(* FLootLockerGetMultisourceMetadataResponseDelegate)(FLootLockerGetMultisourceMetadataResponse)
Blueprint response delegate for getting multi source metadata.
Definition LootLockerMetadataRequestHandler.h:497
ELootLockerMetadataSources
Possible metadata sources.
Definition LootLockerMetadataRequestHandler.h:23
ELootLockerMetadataTypes
Possible metadata types.
Definition LootLockerMetadataRequestHandler.h:45
ELootLockerMetadataParserOutputTypes
Possible metadata parser output types.
Definition LootLockerMetadataRequestHandler.h:77
void(* FLootLockerSetMetadataResponseDelegate)(FLootLockerSetMetadataResponse)
Blueprint response delegate for setting metadata.
Definition LootLockerMetadataRequestHandler.h:501
void(* FLootLockerListMetadataResponseDelegate)(FLootLockerListMetadataResponse)
C++ response delegate for listing metadata.
Definition LootLockerMetadataRequestHandler.h:489
void(* FLootLockerGetMetadataResponseDelegate)(FLootLockerGetMetadataResponse)
C++ response delegate for getting a single metadata entry.
Definition LootLockerMetadataRequestHandler.h:493
Definition LootLockerResponse.h:101
Response containing the single requested metadata entry.
Definition LootLockerMetadataRequestHandler.h:433
Request to retrieve metadata entries from multiple sources and key combinations in a single call.
Definition LootLockerMetadataRequestHandler.h:367
Response containing the requested metadata entries grouped by their source from a multisource get ope...
Definition LootLockerMetadataRequestHandler.h:471
Response containing a paginated page of metadata entries for a given source.
Definition LootLockerMetadataRequestHandler.h:404
Holds a Base64-encoded metadata value together with its MIME content type.
Definition LootLockerMetadataRequestHandler.h:99
Represents a single typed metadata entry with a key, value type, tags, and access level,...
Definition LootLockerMetadataRequestHandler.h:118
Pairs a metadata source and its identifier with the resolved metadata entries retrieved for that sour...
Definition LootLockerMetadataRequestHandler.h:330
Pairs a metadata source and its identifier with a list of keys to fetch from that source.
Definition LootLockerMetadataRequestHandler.h:306
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:381
Identifies a metadata entry that caused an error during a set operation, by key and value type.
Definition LootLockerMetadataRequestHandler.h:263
Describes a failure that occurred while applying a metadata action, including the action type,...
Definition LootLockerMetadataRequestHandler.h:282
Response from a set-metadata operation, containing any per-entry errors alongside the source identifi...
Definition LootLockerMetadataRequestHandler.h:447