Skip to content

Commit 381a619

Browse files
Erik Bylundkirre-bylund
authored andcommitted
Add support for wallets and balances
1 parent 99be601 commit 381a619

File tree

5 files changed

+147
-2
lines changed

5 files changed

+147
-2
lines changed

Runtime/Client/LootLockerEndPoints.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ public class LootLockerEndPoints
240240
public static EndPointClass getCurrencyByCode = new EndPointClass("v1/currency/{0]", LootLockerHTTPMethod.GET);
241241
public static EndPointClass getCurrencyDenominations = new EndPointClass("v1/currency/{0}/denominations", LootLockerHTTPMethod.GET);
242242

243+
// Balances
244+
[Header("Balances")]
245+
public static EndPointClass listBalancesInWallet = new EndPointClass("v1/balances/wallet/{0}", LootLockerHTTPMethod.GET);
246+
public static EndPointClass getWalletByWalletId = new EndPointClass("v1/wallets/{0]", LootLockerHTTPMethod.GET);
247+
public static EndPointClass getWalletByHolderId = new EndPointClass("v1/wallets/holder/{0}", LootLockerHTTPMethod.GET);
248+
243249
// Misc
244250
[Header("Misc")]
245251
public static EndPointClass ping = new EndPointClass("ping", LootLockerHTTPMethod.GET);

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5015,6 +5015,60 @@ public static void GetCurrencyDenominations(string currencyCode, Action<LootLock
50155015

50165016
#endregion
50175017

5018+
#region Balances
5019+
/// <summary>
5020+
/// Get a list of balances in a specified wallet
5021+
/// </summary>
5022+
/// <param name="walletID">Unique ID of the wallet to get balances for</param>
5023+
/// <param name="onComplete">onComplete Action for handling the response</param>
5024+
public static void ListBalancesInWallet(string walletID, Action<LootLockerListBalancesForWalletResponse> onComplete)
5025+
{
5026+
if (!CheckInitialized())
5027+
{
5028+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerListBalancesForWalletResponse>());
5029+
return;
5030+
}
5031+
var endpoint = string.Format(LootLockerEndPoints.listBalancesInWallet.endPoint, walletID);
5032+
5033+
LootLockerServerRequest.CallAPI(endpoint, LootLockerEndPoints.listBalancesInWallet.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5034+
}
5035+
5036+
/// <summary>
5037+
/// Get information about a specified wallet
5038+
/// </summary>
5039+
/// <param name="walletID">Unique ID of the wallet to get information for</param>
5040+
/// <param name="onComplete">onComplete Action for handling the response</param>
5041+
public static void GetWalletByWalletID(string walletID, Action<LootLockerGetWalletResponse> onComplete)
5042+
{
5043+
if (!CheckInitialized())
5044+
{
5045+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetWalletResponse>());
5046+
return;
5047+
}
5048+
var endpoint = string.Format(LootLockerEndPoints.getWalletByWalletId.endPoint, walletID);
5049+
5050+
LootLockerServerRequest.CallAPI(endpoint, LootLockerEndPoints.getWalletByWalletId.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5051+
}
5052+
5053+
/// <summary>
5054+
/// Get information about a wallet for a specified holder
5055+
/// </summary>
5056+
/// <param name="holderID">Unique ID of the holder of the wallet you want to get information for</param>
5057+
/// <param name="onComplete">onComplete Action for handling the response</param>
5058+
public static void GetWalletByHolderID(string holderID, Action<LootLockerGetWalletResponse> onComplete)
5059+
{
5060+
if (!CheckInitialized())
5061+
{
5062+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetWalletResponse>());
5063+
return;
5064+
}
5065+
var endpoint = string.Format(LootLockerEndPoints.getWalletByHolderId.endPoint, holderID);
5066+
5067+
LootLockerServerRequest.CallAPI(endpoint, LootLockerEndPoints.getWalletByHolderId.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5068+
}
5069+
5070+
#endregion
5071+
50185072
#region Misc
50195073

50205074
/// <summary>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using LootLocker.LootLockerEnums;
2+
3+
namespace LootLocker.LootLockerEnums
4+
{
5+
/*
6+
* Possible account linking process statuses. Undefined means that the object couldn't be constructed correctly
7+
*/
8+
public enum LootLockerWalletHolderTypes
9+
{
10+
Character = 0,
11+
Player = 1,
12+
};
13+
}
14+
15+
namespace LootLocker.Requests
16+
{
17+
//==================================================
18+
// Data Definitions
19+
//==================================================
20+
21+
/*
22+
*
23+
*/
24+
public class LootLockerBalance
25+
{
26+
/*
27+
* Current amount of the given currency in this wallet
28+
*/
29+
public string amount { get; set; }
30+
/*
31+
* Information about the currency that this balance is in
32+
*/
33+
public LootLockerCurrency currency { get; set; }
34+
/*
35+
* The id of the wallet holding this balance
36+
*/
37+
public string wallet_id { get; set; }
38+
};
39+
40+
//==================================================
41+
// Response Definitions
42+
//==================================================
43+
44+
/*
45+
*
46+
*/
47+
public class LootLockerListBalancesForWalletResponse : LootLockerResponse
48+
{
49+
/*
50+
* List of balances in different currencies in the requested wallet
51+
*/
52+
public LootLockerBalance[] balances { get; set; }
53+
};
54+
55+
/*
56+
*
57+
*/
58+
public class LootLockerGetWalletResponse : LootLockerResponse
59+
{
60+
/*
61+
* The unique id of the holder of this wallet
62+
*/
63+
public string holder_id { get; set; }
64+
/*
65+
* The unique id of this wallet
66+
*/
67+
public string id { get; set; }
68+
/*
69+
* The type of entity that holds this wallet
70+
*/
71+
public LootLockerWalletHolderTypes type { get; set;}
72+
};
73+
74+
}

Runtime/Game/Requests/BalanceRequests.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Game/Requests/CurrencyRequests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/*
88
* Information about a particular currency
99
*/
10-
public class LootLockerCurrency : LootLockerResponse
10+
public class LootLockerCurrency
1111
{
1212
/*
1313
* The unique id of the currency
@@ -26,7 +26,7 @@ public class LootLockerCurrency : LootLockerResponse
2626
/*
2727
* Represents a denomination of a currency
2828
*/
29-
public class LootLockerDenomination : LootLockerResponse
29+
public class LootLockerDenomination
3030
{
3131
/*
3232
* The unique id of the denomination

0 commit comments

Comments
 (0)