LootLocker Unreal SDK 10.7.0
Game backend SDK for Unreal Engine
Loading...
Searching...
No Matches
LootLockerResponse.h
Go to the documentation of this file.
1// Copyright (c) 2021 LootLocker
2
3#pragma once
4
5#include "CoreMinimal.h"
6
9#include "LootLockerResponse.generated.h"
10
11USTRUCT(BlueprintType)
19{
20 GENERATED_BODY()
22 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
23 bool success = false;
25 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
26 int StatusCode = 0;
28 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
29 FString FullTextFromServer = "";
31 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
34 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
36};
37
39DECLARE_DELEGATE_OneParam(FResponseCallback, FLootLockerResponse);
40
41USTRUCT(BlueprintType)
43{
44 GENERATED_BODY()
48 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
49 int Total = 0;
53 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
54 FString Next_Cursor = "";
58 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
59 FString Previous_Cursor = "";
60};
61
62USTRUCT(BlueprintType)
64{
65 GENERATED_BODY()
69 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
70 int32 Total = 0;
74 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
75 int32 Next_Cursor = 0;
79 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
80 int32 Previous_Cursor = 0;
81};
82
83USTRUCT(BlueprintType)
85{
86 GENERATED_BODY()
90 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
91 FString Field = "";
95 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
96 FString Message = "";
97};
98
99USTRUCT(BlueprintType)
101{
102 GENERATED_BODY()
106 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
107 int32 Total = 0;
111 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
112 int32 Offset = 0;
116 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
117 int32 Per_page = 0;
121 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
122 int32 Last_page = 0;
126 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
127 int32 Current_page = 0;
131 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
132 FString Next_page = "";
136 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
137 FString Prev_page = "";
141 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "LootLocker")
143};
144
149{
150 static const int LL_ERROR_UNDOCUMENTED = 0;
151 static const int LL_ERROR_INVALID_HTTP = -1;
152 static const int LL_ERROR_INVALID_INPUT = -2;
153 static const int LL_ERROR_PARSE_ERROR = -3;
154 static const int LL_UNDEFINED_BEHAVIOUR_ERROR = -4;
155 static const int LL_ERROR_REQUEST_TIMED_OUT = -5;
156 static const int LL_ERROR_SESSION_REFRESH_FAILED = -6;
157};
158
160{
161public:
162 // Construct a standardized error response
163 template<typename T>
164 static T Error(FString ErrorMessage, int StatusCode = 0, const FString& PlayerUlid = "")
165 {
166 T ErrorResponse;
167 ErrorResponse.success = false;
168 ErrorResponse.StatusCode = StatusCode;
169 ErrorResponse.FullTextFromServer = "{ \"message\": \"" + ErrorMessage + "\"}";
170 ErrorResponse.ErrorData.Message = ErrorMessage;
171 ErrorResponse.Context.PlayerUlid = PlayerUlid;
172
173 return ErrorResponse;
174 }
175
176 // Construct an error response based on an existing error response, but of a different type
177 template<typename T>
178 static T ErrorFromError(FLootLockerResponse ExistingError)
179 {
180 T ErrorResponse;
181 ErrorResponse.success = ExistingError.success;
182 ErrorResponse.StatusCode = ExistingError.StatusCode;
183 ErrorResponse.FullTextFromServer = ExistingError.FullTextFromServer;
184 ErrorResponse.ErrorData.Message = ExistingError.ErrorData.Message;
185 ErrorResponse.ErrorData.Code = ExistingError.ErrorData.Code;
186 ErrorResponse.ErrorData.Doc_url = ExistingError.ErrorData.Doc_url;
187 ErrorResponse.ErrorData.Request_id = ExistingError.ErrorData.Request_id;
188 ErrorResponse.ErrorData.Trace_id = ExistingError.ErrorData.Trace_id;
189 ErrorResponse.ErrorData.Retry_after_seconds = ExistingError.ErrorData.Retry_after_seconds;
190 ErrorResponse.Context.PlayerUlid = ExistingError.Context.PlayerUlid;
191 ErrorResponse.Context.RequestTime = ExistingError.Context.RequestTime;
192 ErrorResponse.Context.RequestId = ExistingError.Context.RequestId;
193 ErrorResponse.Context.RequestURL = ExistingError.Context.RequestURL;
194 ErrorResponse.Context.RequestMethod = ExistingError.Context.RequestMethod;
195 ErrorResponse.Context.RequestParametersJsonString = ExistingError.Context.RequestParametersJsonString;
196
197 return ErrorResponse;
198 }
199};
void(* FLootLockerDefaultDelegate)(FLootLockerResponse)
Definition LootLockerResponse.h:38
void(* FResponseCallback)(FLootLockerResponse)
Definition LootLockerResponse.h:39
Definition LootLockerResponse.h:160
static T ErrorFromError(FLootLockerResponse ExistingError)
Definition LootLockerResponse.h:178
static T Error(FString ErrorMessage, int StatusCode=0, const FString &PlayerUlid="")
Definition LootLockerResponse.h:164
Definition LootLockerErrorData.h:33
FString Code
A descriptive code identifying the error.
Definition LootLockerErrorData.h:37
FString Message
A free text description of the problem and potential suggestions for fixing it.
Definition LootLockerErrorData.h:54
FString Trace_id
A unique identifier for tracing the request through LootLocker systems, use this in contact with supp...
Definition LootLockerErrorData.h:46
int Retry_after_seconds
If the request was rate limited (status code 429) or the servers were temporarily unavailable (status...
Definition LootLockerErrorData.h:51
FString Request_id
A unique identifier of the request to use in contact with support.
Definition LootLockerErrorData.h:43
FString Doc_url
A link to further documentation on the error.
Definition LootLockerErrorData.h:40
Definition LootLockerResponse.h:101
int32 Per_page
Number of entries on each page.
Definition LootLockerResponse.h:117
TArray< FLootLockerExtendedPaginationError > Errors
List of pagination errors (if any).
Definition LootLockerResponse.h:142
FString Prev_page
The page index to use for fetching the page of entries immediately preceding this page of entries.
Definition LootLockerResponse.h:137
int32 Last_page
The page index to use for fetching the last page of entries.
Definition LootLockerResponse.h:122
FString Next_page
The page index to use for fetching the page of entries immediately succeeding this page of entries.
Definition LootLockerResponse.h:132
int32 Total
How many entries in total exists in the paginated list.
Definition LootLockerResponse.h:107
int32 Current_page
The page index used for fetching this page of entries.
Definition LootLockerResponse.h:127
int32 Offset
How many entries (counting from the beginning of the paginated list) from the first entry that the cu...
Definition LootLockerResponse.h:112
Definition LootLockerResponse.h:85
FString Message
The error message in question.
Definition LootLockerResponse.h:96
FString Field
Which field in the pagination that this error relates to.
Definition LootLockerResponse.h:91
Definition LootLockerResponse.h:64
int32 Next_Cursor
The cursor to use for fetching the set of entries immediately succeeding this set of entries.
Definition LootLockerResponse.h:75
int32 Previous_Cursor
The cursor to use for fetching the set of entries immediately preceding this set of entries.
Definition LootLockerResponse.h:80
int32 Total
How many entries in total exists in the paginated list.
Definition LootLockerResponse.h:70
Definition LootLockerResponse.h:43
FString Previous_Cursor
The cursor to use for fetching the set of entries immediately preceding this set of entries.
Definition LootLockerResponse.h:59
int Total
How many entries in total exists in the paginated list.
Definition LootLockerResponse.h:49
FString Next_Cursor
The cursor to use for fetching the set of entries immediately succeeding this set of entries.
Definition LootLockerResponse.h:54
Definition LootLockerRequestContext.h:11
FString RequestURL
The url that this request was made to.
Definition LootLockerRequestContext.h:24
FString RequestId
The unique identifier for this request.
Definition LootLockerRequestContext.h:21
FString PlayerUlid
What player this request was made on behalf of.
Definition LootLockerRequestContext.h:15
FString RequestTime
The time that this request was made.
Definition LootLockerRequestContext.h:18
FString RequestMethod
The HTTP Method that was used for this request.
Definition LootLockerRequestContext.h:27
FString RequestParametersJsonString
The request parameters as a json string.
Definition LootLockerRequestContext.h:30
Base response struct — every SDK callback receives a struct that derives from this.
Definition LootLockerResponse.h:19
bool success
Whether this request was a success.
Definition LootLockerResponse.h:23
FLootLockerRequestContext Context
Context for the request.
Definition LootLockerResponse.h:35
int StatusCode
HTTP Status code from the request to LootLockers backend.
Definition LootLockerResponse.h:26
FString FullTextFromServer
Raw text/http body from the server response.
Definition LootLockerResponse.h:29
FLootLockerErrorData ErrorData
If this request was not a success, this structure holds all the information needed to identify the pr...
Definition LootLockerResponse.h:32
Static defines of the different predefined error status codes that can occur in responses.
Definition LootLockerResponse.h:149
static const int LL_UNDEFINED_BEHAVIOUR_ERROR
Definition LootLockerResponse.h:154
static const int LL_ERROR_REQUEST_TIMED_OUT
Definition LootLockerResponse.h:155
static const int LL_ERROR_UNDOCUMENTED
Definition LootLockerResponse.h:150
static const int LL_ERROR_PARSE_ERROR
Definition LootLockerResponse.h:153
static const int LL_ERROR_INVALID_HTTP
Definition LootLockerResponse.h:151
static const int LL_ERROR_SESSION_REFRESH_FAILED
Definition LootLockerResponse.h:156
static const int LL_ERROR_INVALID_INPUT
Definition LootLockerResponse.h:152