Skip to content

Commit 325db02

Browse files
committed
fix: Fix Path Parameters in hero endpoints
1 parent 6644502 commit 325db02

File tree

2 files changed

+21
-47
lines changed

2 files changed

+21
-47
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4059,17 +4059,18 @@ public static void GetHeroInventory(int heroID, Action<LootLockerInventoryRespon
40594059
/// <summary>
40604060
/// List the loadout of the specified hero that the current player owns
40614061
/// </summary>
4062+
/// <param name="heroID">HeroID Id of the hero</param>
40624063
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerHeroLoadoutResponse</param>
40634064
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
4064-
public static void GetHeroLoadout(Action<LootLockerHeroLoadoutResponse> onComplete, string forPlayerWithUlid = null)
4065+
public static void GetHeroLoadout(int HeroID, Action<LootLockerHeroLoadoutResponse> onComplete, string forPlayerWithUlid = null)
40654066
{
40664067
if (!CheckInitialized(false, forPlayerWithUlid))
40674068
{
40684069
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerHeroLoadoutResponse>(forPlayerWithUlid));
40694070
return;
40704071
}
40714072

4072-
LootLockerAPIManager.GetHeroLoadout(forPlayerWithUlid, onComplete);
4073+
LootLockerAPIManager.GetHeroLoadout(forPlayerWithUlid, HeroID, onComplete);
40734074
}
40744075

40754076
/// <summary>
@@ -4110,7 +4111,7 @@ public static void AddAssetToHeroLoadout(int heroID, int assetInstanceID, Action
41104111
data.hero_id = heroID;
41114112

41124113

4113-
LootLockerAPIManager.AddAssetToHeroLoadout(forPlayerWithUlid, data, onComplete);
4114+
LootLockerAPIManager.AddAssetToHeroLoadout(forPlayerWithUlid, heroID, data, onComplete);
41144115
}
41154116

41164117
/// <summary>
@@ -4136,7 +4137,7 @@ public static void AddAssetVariationToHeroLoadout(int heroID, int assetID, int a
41364137
data.asset_id = assetID;
41374138
data.asset_variation_id = assetInstanceID;
41384139

4139-
LootLockerAPIManager.AddAssetVariationToHeroLoadout(forPlayerWithUlid, data, onComplete);
4140+
LootLockerAPIManager.AddAssetVariationToHeroLoadout(forPlayerWithUlid, heroID, data, onComplete);
41404141
}
41414142

41424143
/// <summary>
@@ -4147,20 +4148,15 @@ public static void AddAssetVariationToHeroLoadout(int heroID, int assetID, int a
41474148
/// <param name="heroID">Id of the hero</param>
41484149
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerHeroLoadoutResponse</param>
41494150
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
4150-
public static void RemoveAssetFromHeroLoadout(string assetID, string heroID, Action<LootLockerHeroLoadoutResponse> onComplete, string forPlayerWithUlid = null)
4151+
public static void RemoveAssetFromHeroLoadout(int assetID, int heroID, Action<LootLockerHeroLoadoutResponse> onComplete, string forPlayerWithUlid = null)
41514152
{
41524153
if (!CheckInitialized(false, forPlayerWithUlid))
41534154
{
41544155
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerHeroLoadoutResponse>(forPlayerWithUlid));
41554156
return;
41564157
}
41574158

4158-
LootLockerGetRequest lootLockerGetRequest = new LootLockerGetRequest();
4159-
4160-
lootLockerGetRequest.getRequests.Add(assetID);
4161-
lootLockerGetRequest.getRequests.Add(heroID);
4162-
4163-
LootLockerAPIManager.RemoveAssetFromHeroLoadout(forPlayerWithUlid, lootLockerGetRequest, onComplete);
4159+
LootLockerAPIManager.RemoveAssetFromHeroLoadout(forPlayerWithUlid, heroID, assetID, onComplete);
41644160
}
41654161

41664162
#endregion

Runtime/Game/Requests/HeroRequest.cs

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ public static void ListPlayerHeroes(string forPlayerWithUlid, Action<LootLockerL
116116
public static void ListOtherPlayersHeroesBySteamID64(string forPlayerWithUlid, int SteamID64, Action<LootLockerPlayerHeroResponse> onComplete)
117117
{
118118
EndPointClass endPoint = LootLockerEndPoints.listOtherPlayersHeroesBySteamID64;
119-
120-
string getVariable = endPoint.endPoint;
121-
122-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, SteamID64.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
119+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(SteamID64.ToString()), endPoint.httpMethod, SteamID64.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
123120
}
124121

125122
public static void CreateHero(LootLockerCreateHeroRequest data,
@@ -154,19 +151,14 @@ public static void CreateHeroWithVariation(string forPlayerWithUlid, LootLockerC
154151
public static void GetHero(string forPlayerWithUlid, int HeroID, Action<LootLockerPlayerHeroResponse> onComplete)
155152
{
156153
EndPointClass endPoint = LootLockerEndPoints.getHero;
157-
158-
string getVariable = endPoint.endPoint;
159-
160-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
154+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
161155
}
162156

163157
public static void GetOtherPlayersDefaultHeroBySteamID64(string forPlayerWithUlid, int steamID64, Action<LootLockerPlayerHeroResponse> onComplete)
164158
{
165159
EndPointClass endPoint = LootLockerEndPoints.getOtherPlayersDefaultHeroBySteamID64;
166160

167-
string getVariable = endPoint.endPoint;
168-
169-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, steamID64.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
161+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(steamID64.ToString()), endPoint.httpMethod, steamID64.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
170162
}
171163

172164
public static void UpdateHero(string forPlayerWithUlid, LootLockerGetRequest lootLockerGetRequest, LootLockerUpdateHeroRequest data, Action<LootLockerPlayerHeroResponse> onComplete)
@@ -189,39 +181,31 @@ public static void DeleteHero(string forPlayerWithUlid, int HeroID, Action<LootL
189181
{
190182
EndPointClass endPoint = LootLockerEndPoints.deleteHero;
191183

192-
string getVariable = endPoint.endPoint;
193-
194-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
184+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
195185
}
196186

197187
public static void GetHeroInventory(string forPlayerWithUlid, int HeroID, Action<LootLockerInventoryResponse> onComplete)
198188
{
199189
EndPointClass endPoint = LootLockerEndPoints.getHeroInventory;
200190

201-
string getVariable = endPoint.endPoint;
202-
203-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
191+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
204192
}
205193

206-
public static void GetHeroLoadout(string forPlayerWithUlid, Action<LootLockerHeroLoadoutResponse> onComplete)
194+
public static void GetHeroLoadout(string forPlayerWithUlid, int HeroID, Action<LootLockerHeroLoadoutResponse> onComplete)
207195
{
208196
EndPointClass endPoint = LootLockerEndPoints.getHeroLoadout;
209197

210-
string getVariable = endPoint.endPoint;
211-
212-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
198+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
213199
}
214200

215201
public static void GetOtherPlayersHeroLoadout(string forPlayerWithUlid, int HeroID, Action<LootLockerHeroLoadoutResponse> onComplete)
216202
{
217203
EndPointClass endPoint = LootLockerEndPoints.getOtherPlayersHeroLoadout;
218204

219-
string getVariable = endPoint.endPoint;
220-
221-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
205+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, HeroID.ToString(), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
222206
}
223207

224-
public static void AddAssetToHeroLoadout(string forPlayerWithUlid, LootLockerAddAssetToHeroLoadoutRequest data, Action<LootLockerHeroLoadoutResponse> onComplete)
208+
public static void AddAssetToHeroLoadout(string forPlayerWithUlid, int HeroID, LootLockerAddAssetToHeroLoadoutRequest data, Action<LootLockerHeroLoadoutResponse> onComplete)
225209
{
226210
EndPointClass endPoint = LootLockerEndPoints.addAssetToHeroLoadout;
227211

@@ -232,12 +216,10 @@ public static void AddAssetToHeroLoadout(string forPlayerWithUlid, LootLockerAdd
232216
}
233217
string json = LootLockerJson.SerializeObject(data);
234218

235-
string getVariable = endPoint.endPoint;
236-
237-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
219+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
238220
}
239221

240-
public static void AddAssetVariationToHeroLoadout(string forPlayerWithUlid, LootLockerAddAssetVariationToHeroLoadoutRequest data, Action<LootLockerHeroLoadoutResponse> onComplete)
222+
public static void AddAssetVariationToHeroLoadout(string forPlayerWithUlid, int HeroID, LootLockerAddAssetVariationToHeroLoadoutRequest data, Action<LootLockerHeroLoadoutResponse> onComplete)
241223
{
242224
EndPointClass endPoint = LootLockerEndPoints.addAssetVariationToHeroLoadout;
243225

@@ -248,18 +230,14 @@ public static void AddAssetVariationToHeroLoadout(string forPlayerWithUlid, Loot
248230
}
249231
string json = LootLockerJson.SerializeObject(data);
250232

251-
string getVariable = endPoint.endPoint;
252-
253-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
233+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameter(HeroID.ToString()), endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
254234
}
255235

256-
public static void RemoveAssetFromHeroLoadout(string forPlayerWithUlid, LootLockerGetRequest lootLockerGetRequest, Action<LootLockerHeroLoadoutResponse> onComplete)
236+
public static void RemoveAssetFromHeroLoadout(string forPlayerWithUlid, int HeroID, int assetID, Action<LootLockerHeroLoadoutResponse> onComplete)
257237
{
258238
EndPointClass endPoint = LootLockerEndPoints.removeAssetFromHeroLoadout;
259239

260-
string getVariable = endPoint.WithPathParameters(lootLockerGetRequest.getRequests[0], lootLockerGetRequest.getRequests[1]);
261-
262-
LootLockerServerRequest.CallAPI(forPlayerWithUlid, getVariable, endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }); ;
240+
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endPoint.WithPathParameters(assetID.ToString(), HeroID.ToString()), endPoint.httpMethod, null, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
263241

264242
}
265243

0 commit comments

Comments
 (0)