Skip to content

Commit 8ca9f4f

Browse files
Mikkel Sørensenkirre-bylund
authored andcommitted
Add account linking that was removed in last pr
1 parent 84ada24 commit 8ca9f4f

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,93 @@ public static void WhiteLabelLoginAndStartSession(string email, string password,
11391139

11401140
#endregion
11411141

1142+
#if LOOTLOCKER_ENABLE_ACCOUNT_LINKING
1143+
1144+
#region Account Linking
1145+
1146+
/// <summary>
1147+
/// Start an account linking process on behalf of the currently signed in player
1148+
/// When you want to link an additional provider to a player, you start by initiating an account link.The player can then navigate to the online link flow using the code_page_url and code, or the qr_code and continue the linking process.
1149+
/// For the duration of the linking process you can check the status using the CheckAccountLinkingProcessStatus method.
1150+
/// Returned from this method is the ID of the linking process, make sure to save that so that you can check the status of the process later.
1151+
/// https://ref.lootlocker.com/game-api/#start-account-link
1152+
/// </summary>
1153+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerAccountLinkStartResponse</param>
1154+
public static void StartAccountLinkingProcess(Action<LootLockerAccountLinkStartResponse> onComplete)
1155+
{
1156+
if (!CheckInitialized())
1157+
{
1158+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountLinkStartResponse>());
1159+
return;
1160+
}
1161+
1162+
var endpoint = LootLockerEndPoints.StartAccountLinkingProcess;
1163+
1164+
LootLockerServerRequest.CallAPI(endpoint.endPoint, endpoint.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
1165+
}
1166+
1167+
/// <summary>
1168+
/// Check the status of an ongoing account linking process
1169+
/// https://ref.lootlocker.com/game-api/#check-account-link-status
1170+
/// </summary>
1171+
/// <param name="LinkID">The ID of the account linking process which was returned when starting the linking process</param>
1172+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerAccountLinkProcessStatusResponse</param>
1173+
public static void CheckAccountLinkingProcessStatus(string LinkID, Action<LootLockerAccountLinkProcessStatusResponse> onComplete)
1174+
{
1175+
if (!CheckInitialized())
1176+
{
1177+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountLinkProcessStatusResponse>());
1178+
return;
1179+
}
1180+
1181+
var endpoint = LootLockerEndPoints.CheckAccountLinkingProcessStatus;
1182+
1183+
LootLockerServerRequest.CallAPI(string.Format(endpoint.endPoint, LinkID), endpoint.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
1184+
}
1185+
1186+
/// <summary>
1187+
/// Cancel an ongoing account linking process
1188+
/// The response will be empty unless an error occurs
1189+
/// https://ref.lootlocker.com/game-api/#cancel-account-link
1190+
/// </summary>
1191+
/// <param name="LinkID">The ID of the account linking process which was returned when starting the linking process</param>
1192+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerCancelAccountLinkingProcessResponse</param>
1193+
public static void CancelAccountLinkingProcess(string LinkID, Action<LootLockerCancelAccountLinkingProcessResponse> onComplete)
1194+
{
1195+
if (!CheckInitialized())
1196+
{
1197+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerCancelAccountLinkingProcessResponse>());
1198+
return;
1199+
}
1200+
1201+
var endpoint = LootLockerEndPoints.CancelAccountLinkingProcess;
1202+
1203+
LootLockerServerRequest.CallAPI(string.Format(endpoint.endPoint, LinkID), endpoint.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
1204+
}
1205+
1206+
/// <summary>
1207+
/// Unlink a provider from the currently signed in player
1208+
/// The response will be empty unless an error occurs
1209+
/// https://ref.lootlocker.com/game-api/#unlink-provider
1210+
/// </summary>
1211+
/// <param name="Provider">What provider to unlink from the currently logged in player</param>
1212+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerUnlinkProviderFromAccountResponse</param>
1213+
public static void UnlinkProviderFromAccount(Platforms Provider, Action<LootLockerUnlinkProviderFromAccountResponse> onComplete)
1214+
{
1215+
if (!CheckInitialized())
1216+
{
1217+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerUnlinkProviderFromAccountResponse>());
1218+
return;
1219+
}
1220+
1221+
var endpoint = LootLockerEndPoints.UnlinkProviderFromAccount;
1222+
1223+
LootLockerServerRequest.CallAPI(string.Format(endpoint.endPoint, CurrentPlatform.GetPlatformRepresentation(Provider).PlatformString), endpoint.httpMethod, onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); });
1224+
}
1225+
1226+
#endregion
1227+
1228+
#endif
11421229
#region Player
11431230
/// <summary>
11441231
/// Get general information about the current current player, such as the XP, Level information and their account balance.
@@ -2077,7 +2164,6 @@ public static void RegisterPlayerProgression(string progressionKey, Action<LootL
20772164

20782165
#endregion
20792166

2080-
20812167
#region Hero
20822168

20832169
/// <summary>

0 commit comments

Comments
 (0)