Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 99 additions & 10 deletions Runtime/Game/LootLockerSDKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1665,11 +1665,11 @@ public static void ListConnectedAccounts(Action<LootLockerListConnectedAccountsR
/// <param name="accountToDisconnect">What account to disconnect from this LootLocker Account</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void DisconnectAccount(LootLockerAccountProvider accountToDisconnect, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
public static void DisconnectAccount(LootLockerAccountProvider accountToDisconnect, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

Expand All @@ -1685,11 +1685,11 @@ public static void DisconnectAccount(LootLockerAccountProvider accountToDisconne
/// <param name="idToken">The Id Token from google sign in</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectGoogleAccount(string idToken, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
public static void ConnectGoogleAccount(string idToken, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

Expand All @@ -1708,11 +1708,11 @@ public static void ConnectGoogleAccount(string idToken, Action<LootLockerRespons
/// <param name="platform">Google OAuth2 ClientID platform</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPlatform platform, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPlatform platform, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

Expand All @@ -1730,11 +1730,11 @@ public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPla
/// <param name="authorizationCode">Authorization code, provided by apple during Sign In</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

Expand All @@ -1745,6 +1745,95 @@ public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Act
LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); });
}

/// <summary>
/// Connect a Twitch Account to the currently logged in LootLocker account allowing that Twitch account to start sessions for this player
/// IMPORTANT: If you are using multiple users, be very sure to pass in the correct `forPlayerWithUlid` parameter as that will be the account that the Twitch account is linked into
/// </summary>
/// <param name="authorizationCode">The Authorization Code from Twitch sign in</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectTwitchAccount(string authorizationCode, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

string endpoint = LootLockerEndPoints.connectProviderToAccount.WithPathParameter("twitch");

string data = LootLockerJson.SerializeObject(new LootLockerConnectTwitchProviderToAccountRequest() { authorization_code = authorizationCode });

LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); });
}

/// <summary>
/// Connect an Epic Account to the currently logged in LootLocker account allowing that Epic account to start sessions for this player
/// IMPORTANT: If you are using multiple users, be very sure to pass in the correct `forPlayerWithUlid` parameter as that will be the account that the Epic account is linked into
/// </summary>
/// <param name="token">The Token from Epic sign in</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectEpicAccount(string Token, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

string endpoint = LootLockerEndPoints.connectProviderToAccount.WithPathParameter("epic");

string data = LootLockerJson.SerializeObject(new LootLockerConnectEpicProviderToAccountRequest() { token = Token });

LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); });
}

/// <summary>
/// Connect a Playstation Account to the currently logged in LootLocker account allowing that Playstation account to start sessions for this player
/// IMPORTANT: If you are using multiple users, be very sure to pass in the correct `forPlayerWithUlid` parameter as that will be the account that the Playstation account is linked into
/// </summary>
/// <param name="environment">The environment for the playstation account (dev, qa, prod)</param>
/// <param name="code">The code from playstation sign in</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectPlaystationAccount(string environment, string code, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

string endpoint = LootLockerEndPoints.connectProviderToAccount.WithPathParameter("playstation");

string data = LootLockerJson.SerializeObject(new LootLockerConnectPlaystationProviderToAccountRequest() { environment = environment, code = code });

LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); });
}

/// <summary>
/// Connect an Discord Account to the currently logged in LootLocker account allowing that Discord account to start sessions for this player
/// IMPORTANT: If you are using multiple users, be very sure to pass in the correct `forPlayerWithUlid` parameter as that will be the account that the Discord account is linked into
/// </summary>
/// <param name="token">The Token from Discord sign in</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectDiscordAccount(string token, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

string endpoint = LootLockerEndPoints.connectProviderToAccount.WithPathParameter("discord");

string data = LootLockerJson.SerializeObject(new LootLockerConnectDiscordProviderToAccountRequest() { token = token });

LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); });
}

/// <summary>
/// Connect an identity provider (authorized using a remote link session) to the currently logged in LootLocker account allowing that authentication method to start sessions for this player
/// IMPORTANT: If you are using multiple users, be very sure to pass in the correct `forPlayerWithUlid` parameter as that will be the account that the Remote Session account is linked into
Expand All @@ -1753,11 +1842,11 @@ public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Act
/// <param name="Nonce">The nonce returned with the response when starting a lease process. Note that the process must have concluded successfully first.</param>
/// <param name="onComplete">onComplete Action for handling the response</param>
/// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param>
public static void ConnectRemoteSessionAccount(string Code, string Nonce, Action<LootLockerResponse> onComplete, string forPlayerWithUlid = null)
public static void ConnectRemoteSessionAccount(string Code, string Nonce, Action<LootLockerAccountConnectedResponse> onComplete, string forPlayerWithUlid = null)
{
if (!CheckInitialized(false, forPlayerWithUlid))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerResponse>(forPlayerWithUlid));
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerAccountConnectedResponse>(forPlayerWithUlid));
return;
}

Expand Down
56 changes: 49 additions & 7 deletions Runtime/Game/Requests/ConnectedAccountRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public enum LootLockerAccountProvider
nintendo = 6,
xbox = 7,
playstation = 8,
twitch = 9
twitch = 9,
epic = 10,
discord = 11
}

/// <summary>
Expand Down Expand Up @@ -117,6 +119,50 @@ public class LootLockerConnectAppleRestProviderToAccountRequest
/// </summary>
public string authorization_code { get; set; }
}

/// <summary>
/// </summary>
public class LootLockerConnectEpicProviderToAccountRequest
{
/// <summary>
/// The Token from epic sign in
/// </summary>
public string token { get; set; }
}

/// <summary>
/// </summary>
public class LootLockerConnectPlaystationProviderToAccountRequest
{
/// <summary>
/// The environment for the playstation account (dev, qa, prod)
/// </summary>
public string environment { get; set; }
/// <summary>
/// The code from playstation sign in
/// </summary>
public string code { get; set; }
}

/// <summary>
/// </summary>
public class LootLockerConnectDiscordProviderToAccountRequest
{
/// <summary>
/// The Token from discord sign in
/// </summary>
public string token { get; set; }
}

/// <summary>
/// </summary>
public class LootLockerConnectTwitchProviderToAccountRequest
{
/// <summary>
/// The Authorization Code from Twitch sign in
/// </summary>
public string authorization_code { get; set; }
}

//==================================================
// Response Definitions
Expand All @@ -127,13 +173,9 @@ public class LootLockerConnectAppleRestProviderToAccountRequest
public class LootLockerAccountConnectedResponse : LootLockerResponse
{
/// <summary>
/// The account provider
/// The connected account provider
/// </summary>
public LootLockerAccountProvider provider { get; set; }
/// <summary>
/// Decorated name of this provider to use for displaying
/// </summary>
public string provider_name { get; set; }
public LootLockerConnectedAccountProvider connected_account { get; set; }
}

/// <summary>
Expand Down