Skip to content

Commit 3daac2d

Browse files
Erik Bylundkirre-bylund
authored andcommitted
fix: Handle public field in Update Keys Response
1 parent cc62ddf commit 3daac2d

File tree

3 files changed

+43
-38
lines changed

3 files changed

+43
-38
lines changed

Runtime/Client/LootLockerEndPoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public class LootLockerEndPoints
125125
// Persistentplayer storage
126126
[Header("Persitent Player Storage")]
127127
public static EndPointClass getEntirePersistentStorage = new EndPointClass("v1/player/storage", LootLockerHTTPMethod.GET);
128-
public static EndPointClass getSingleKeyFromPersitenctStorage = new EndPointClass("v1/player/storage?key={0}", LootLockerHTTPMethod.GET);
128+
public static EndPointClass getSingleKeyFromPersistentStorage = new EndPointClass("v1/player/storage?key={0}", LootLockerHTTPMethod.GET);
129129
public static EndPointClass updateOrCreateKeyValue = new EndPointClass("v1/player/storage", LootLockerHTTPMethod.POST);
130130
public static EndPointClass deleteKeyValue = new EndPointClass("v1/player/storage?key={0}", LootLockerHTTPMethod.DELETE);
131131
public static EndPointClass getOtherPlayersPublicKeyValuePairs = new EndPointClass("v1/player/{0}/storage", LootLockerHTTPMethod.GET);

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,25 +3127,25 @@ public static void DeleteCharacterProgression(int characterId, string progressio
31273127
/// <summary>
31283128
/// Get the player storage for the currently active player (key/values).
31293129
/// </summary>
3130-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3131-
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStoragResponse> onComplete)
3130+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3131+
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStorageResponse> onComplete)
31323132
{
31333133
if (!CheckInitialized())
31343134
{
3135-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3135+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
31363136
return;
31373137
}
31383138
LootLockerAPIManager.GetEntirePersistentStorage(onComplete);
31393139
}
31403140
/// <summary>
31413141
/// Get the player storage as a Dictionary<string, string> for the currently active player (key/values).
31423142
/// </summary>
3143-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponseDictionary</param>
3144-
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStoragResponseDictionary> onComplete)
3143+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponseDictionary</param>
3144+
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStorageResponseDictionary> onComplete)
31453145
{
31463146
if (!CheckInitialized())
31473147
{
3148-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponseDictionary>());
3148+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponseDictionary>());
31493149
return;
31503150
}
31513151
LootLockerAPIManager.GetEntirePersistentStorage(onComplete);
@@ -3173,12 +3173,12 @@ public static void GetSingleKeyPersistentStorage(string key, Action<LootLockerGe
31733173
/// </summary>
31743174
/// <param name="key">Name of the key</param>
31753175
/// <param name="value">Value of the key</param>
3176-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3177-
public static void UpdateOrCreateKeyValue(string key, string value, Action<LootLockerGetPersistentStoragResponse> onComplete)
3176+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3177+
public static void UpdateOrCreateKeyValue(string key, string value, Action<LootLockerGetPersistentStorageResponse> onComplete)
31783178
{
31793179
if (!CheckInitialized())
31803180
{
3181-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3181+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
31823182
return;
31833183
}
31843184
LootLockerGetPersistentStorageRequest data = new LootLockerGetPersistentStorageRequest();
@@ -3192,12 +3192,12 @@ public static void UpdateOrCreateKeyValue(string key, string value, Action<LootL
31923192
/// <param name="key">Name of the key</param>
31933193
/// <param name="value">Value of the key</param>
31943194
/// <param name="isPublic">Is the key public?</param>
3195-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3196-
public static void UpdateOrCreateKeyValue(string key, string value, bool isPublic, Action<LootLockerGetPersistentStoragResponse> onComplete)
3195+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3196+
public static void UpdateOrCreateKeyValue(string key, string value, bool isPublic, Action<LootLockerGetPersistentStorageResponse> onComplete)
31973197
{
31983198
if (!CheckInitialized())
31993199
{
3200-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3200+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
32013201
return;
32023202
}
32033203
LootLockerGetPersistentStorageRequest data = new LootLockerGetPersistentStorageRequest();
@@ -3209,12 +3209,12 @@ public static void UpdateOrCreateKeyValue(string key, string value, bool isPubli
32093209
/// Update or create multiple key/value pairs in the player storage for the currently active player.
32103210
/// </summary>
32113211
/// <param name="data">A LootLockerGetPersistentStorageRequest with multiple keys</param>
3212-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3213-
public static void UpdateOrCreateKeyValue(LootLockerGetPersistentStorageRequest data, Action<LootLockerGetPersistentStoragResponse> onComplete)
3212+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3213+
public static void UpdateOrCreateKeyValue(LootLockerGetPersistentStorageRequest data, Action<LootLockerGetPersistentStorageResponse> onComplete)
32143214
{
32153215
if (!CheckInitialized())
32163216
{
3217-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3217+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
32183218
return;
32193219
}
32203220
LootLockerAPIManager.UpdateOrCreateKeyValue(data, onComplete);
@@ -3224,12 +3224,12 @@ public static void UpdateOrCreateKeyValue(LootLockerGetPersistentStorageRequest
32243224
/// Delete a key from the player storage for the currently active player.
32253225
/// </summary>
32263226
/// <param name="keyToDelete">The key/value key(name) to delete</param>
3227-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3228-
public static void DeleteKeyValue(string keyToDelete, Action<LootLockerGetPersistentStoragResponse> onComplete)
3227+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3228+
public static void DeleteKeyValue(string keyToDelete, Action<LootLockerGetPersistentStorageResponse> onComplete)
32293229
{
32303230
if (!CheckInitialized())
32313231
{
3232-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3232+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
32333233
return;
32343234
}
32353235
LootLockerGetRequest data = new LootLockerGetRequest();
@@ -3241,13 +3241,13 @@ public static void DeleteKeyValue(string keyToDelete, Action<LootLockerGetPersis
32413241
/// Get the public player storage(key/values) for a specific player.
32423242
/// </summary>
32433243
/// <param name="otherPlayerId">The ID of the player to retrieve the public ley/values for</param>
3244-
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStoragResponse</param>
3245-
public static void GetOtherPlayersPublicKeyValuePairs(string otherPlayerId, Action<LootLockerGetPersistentStoragResponse> onComplete)
3244+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerGetPersistentStorageResponse</param>
3245+
public static void GetOtherPlayersPublicKeyValuePairs(string otherPlayerId, Action<LootLockerGetPersistentStorageResponse> onComplete)
32463246
{
32473247

32483248
if (!CheckInitialized())
32493249
{
3250-
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStoragResponse>());
3250+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetPersistentStorageResponse>());
32513251
return;
32523252
}
32533253
LootLockerGetRequest data = new LootLockerGetRequest();

Runtime/Game/Requests/PersitentPlayerStorageRequest.cs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55

66
namespace LootLocker.Requests
77
{
8-
public class LootLockerGetPersistentStoragResponse : LootLockerResponse
8+
public class LootLockerGetPersistentStorageResponse : LootLockerResponse
99
{
1010
public virtual LootLockerPayload[] payload { get; set; }
1111
}
12-
public class LootLockerGetPersistentStoragResponseDictionary : LootLockerResponse
12+
[Obsolete("This class has been replaced by LootLockerGetPersistentStorageResponse")]
13+
public class LootLockerGetPersistentStoragResponse : LootLockerGetPersistentStorageResponse
14+
{ }
15+
public class LootLockerGetPersistentStorageResponseDictionary : LootLockerResponse
1316
{
1417
public virtual Dictionary<string, string> payload { get; set; }
1518
}
19+
[Obsolete("This class has been replaced by LootLockerGetPersistentStorageResponseDictionary")]
20+
public class LootLockerGetPersistentStoragResponseDictionary : LootLockerGetPersistentStorageResponseDictionary
21+
{ }
1622

1723
public class LootLockerGetPersistentStorageRequest
1824
{
@@ -37,12 +43,6 @@ public class LootLockerPayload
3743
public string key { get; set; }
3844
public string value { get; set; }
3945
public int order { get; set; }
40-
41-
#if LOOTLOCKER_USE_NEWTONSOFTJSON
42-
[JsonProperty("public")]
43-
#else
44-
[Json(Name = "public")]
45-
#endif
4646
public bool is_public { get; set; }
4747
}
4848
}
@@ -51,14 +51,14 @@ namespace LootLocker
5151
{
5252
public partial class LootLockerAPIManager
5353
{
54-
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStoragResponse> onComplete)
54+
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStorageResponse> onComplete)
5555
{
5656
EndPointClass endPoint = LootLockerEndPoints.getEntirePersistentStorage;
5757

5858
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, null, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
5959
}
6060

61-
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStoragResponseDictionary> onComplete)
61+
public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStorageResponseDictionary> onComplete)
6262
{
6363
EndPointClass endPoint = LootLockerEndPoints.getEntirePersistentStorage;
6464

@@ -67,29 +67,34 @@ public static void GetEntirePersistentStorage(Action<LootLockerGetPersistentStor
6767

6868
public static void GetSingleKeyPersistentStorage(LootLockerGetRequest data, Action<LootLockerGetPersistentSingle> onComplete)
6969
{
70-
EndPointClass endPoint = LootLockerEndPoints.getSingleKeyFromPersitenctStorage;
70+
EndPointClass endPoint = LootLockerEndPoints.getSingleKeyFromPersistentStorage;
7171

7272
string getVariable = string.Format(endPoint.endPoint, data.getRequests[0]);
7373

7474
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
7575
}
7676

77-
public static void UpdateOrCreateKeyValue(LootLockerGetPersistentStorageRequest data, Action<LootLockerGetPersistentStoragResponse> onComplete)
77+
public static void UpdateOrCreateKeyValue(LootLockerGetPersistentStorageRequest data, Action<LootLockerGetPersistentStorageResponse> onComplete)
7878
{
7979
if(data == null)
8080
{
81-
onComplete?.Invoke(LootLockerResponseFactory.InputUnserializableError<LootLockerGetPersistentStoragResponse>());
81+
onComplete?.Invoke(LootLockerResponseFactory.InputUnserializableError<LootLockerGetPersistentStorageResponse>());
8282
return;
8383
}
8484

8585
string json = LootLockerJson.SerializeObject(data);
8686

8787
EndPointClass endPoint = LootLockerEndPoints.updateOrCreateKeyValue;
8888

89-
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
89+
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, onComplete:
90+
(serverResponse) =>
91+
{
92+
serverResponse.text = serverResponse.text.Replace("\"public\"", "\"is_public\"");
93+
LootLockerResponse.Deserialize(onComplete, serverResponse);
94+
});
9095
}
9196

92-
public static void DeleteKeyValue(LootLockerGetRequest data, Action<LootLockerGetPersistentStoragResponse> onComplete)
97+
public static void DeleteKeyValue(LootLockerGetRequest data, Action<LootLockerGetPersistentStorageResponse> onComplete)
9398
{
9499
EndPointClass endPoint = LootLockerEndPoints.deleteKeyValue;
95100

@@ -98,7 +103,7 @@ public static void DeleteKeyValue(LootLockerGetRequest data, Action<LootLockerGe
98103
LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, null, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
99104
}
100105

101-
public static void GetOtherPlayersPublicKeyValuePairs(LootLockerGetRequest data, Action<LootLockerGetPersistentStoragResponse> onComplete)
106+
public static void GetOtherPlayersPublicKeyValuePairs(LootLockerGetRequest data, Action<LootLockerGetPersistentStorageResponse> onComplete)
102107
{
103108
EndPointClass endPoint = LootLockerEndPoints.getOtherPlayersPublicKeyValuePairs;
104109

0 commit comments

Comments
 (0)