Skip to content

Commit 3d710c7

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Added endpoint for getting a single entitlement history
1 parent b27ca0d commit 3d710c7

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

Runtime/Client/LootLockerEndPoints.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,5 +284,7 @@ public class LootLockerEndPoints
284284
// Entitlements
285285
[Header("Entitlements")]
286286
public static EndPointClass listEntitlementHistory = new EndPointClass("entitlements", LootLockerHTTPMethod.GET);
287+
public static EndPointClass getSingleEntitlementHistory = new EndPointClass("entitlements/{0}", LootLockerHTTPMethod.GET);
288+
287289
}
288290
}

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,6 +5616,19 @@ public static void ListEntitlements(Action<LootLockerEntitlementHistoryResponse>
56165616
{
56175617
ListEntitlements(-1, null, onComplete);
56185618
}
5619+
5620+
public static void GetSingleEntitlementHistory(string entitlementId, Action<LootLockerSingleEntitlementHistoryResponse> onComplete)
5621+
{
5622+
if (!CheckInitialized())
5623+
{
5624+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerSingleEntitlementHistoryResponse>());
5625+
return;
5626+
}
5627+
5628+
var endpoint = string.Format(LootLockerEndPoints.getSingleEntitlementHistory.endPoint, entitlementId);
5629+
LootLockerServerRequest.CallAPI(endpoint, LootLockerEndPoints.getSingleEntitlementHistory.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5630+
}
5631+
56195632
#endregion
56205633

56215634
#region Misc

Runtime/Game/Requests/EntitlementRequests.cs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,73 @@ public class LootLockerEntitlementHistoryResponse : LootLockerResponse
186186
/// </summary>
187187
public LootLockerPaginationResponse<string> Pagination { get; set; }
188188
}
189+
190+
/// <summary>
191+
/// Response body of the entitlement history of a single entitlement id
192+
/// </summary>
193+
public class LootLockerSingleEntitlementHistoryResponse : LootLockerResponse
194+
{
195+
/// <summary>
196+
/// When this entitlement listing was created
197+
/// </summary>
198+
public string created_at { get; set; }
199+
/// <summary>
200+
/// The type this entitlement is example is a one time purchase
201+
/// </summary>
202+
public string type { get; set; }
203+
/// <summary>
204+
/// The status of the entitlement, (pending, active, canceled)
205+
/// </summary>
206+
public string status { get; set; }
207+
/// <summary>
208+
/// The store connected to the entitlement
209+
/// </summary>
210+
public string store { get; set; }
211+
/// <summary>
212+
/// An array of the items connected to this entitlement
213+
/// </summary>
214+
public LootLockerSingleEntitlementItem[] items { get; set; }
215+
/// <summary>
216+
/// Metadata of the entitlement
217+
/// </summary>
218+
public MetadataEntry[] metadata { get; set; }
219+
220+
}
221+
222+
public class MetadataEntry
223+
{
224+
public string key { get; set; }
225+
public string value { get; set; }
226+
}
227+
/// <summary>
228+
/// Details of the entitlement item
229+
/// </summary>
230+
public class LootLockerSingleEntitlementItem
231+
{
232+
/// <summary>
233+
/// When this entitlement item listing was created
234+
/// </summary>
235+
public string created_at { get; set; }
236+
/// <summary>
237+
/// What type of reward (currency, asset, progression points, progression reset, etc.)
238+
/// </summary>
239+
public string reward_kind { get; set; }
240+
/// <summary>
241+
/// The id of the entitlement item
242+
/// </summary>
243+
public string id { get; set; }
244+
/// <summary>
245+
/// The reward id of the entitlement item
246+
/// </summary>
247+
public string reward_id { get; set; }
248+
/// <summary>
249+
/// The id of the catalog which contains the item
250+
/// </summary>
251+
public string catalog_id { get; set; }
252+
/// <summary>
253+
/// If the item is purchasable
254+
/// </summary>
255+
public bool purchasable { get; set; }
256+
}
257+
189258
}

0 commit comments

Comments
 (0)