LootLocker Unreal SDK 10.4.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:10
FString Code
A descriptive code identifying the error.
Definition LootLockerErrorData.h:14
FString Message
A free text description of the problem and potential suggestions for fixing it.
Definition LootLockerErrorData.h:31
FString Trace_id
A unique identifier for tracing the request through LootLocker systems, use this in contact with supp...
Definition LootLockerErrorData.h:23
int Retry_after_seconds
If the request was rate limited (status code 429) or the servers were temporarily unavailable (status...
Definition LootLockerErrorData.h:28
FString Request_id
A unique identifier of the request to use in contact with support.
Definition LootLockerErrorData.h:20
FString Doc_url
A link to further documentation on the error.
Definition LootLockerErrorData.h:17
Definition LootLockerResponse.h:101
Definition LootLockerResponse.h:85
Definition LootLockerResponse.h:64
Definition LootLockerResponse.h:43
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