diff --git a/Runtime/Game/LootLockerSDKManager.cs b/Runtime/Game/LootLockerSDKManager.cs index c2548688..a4ad052a 100644 --- a/Runtime/Game/LootLockerSDKManager.cs +++ b/Runtime/Game/LootLockerSDKManager.cs @@ -1665,11 +1665,11 @@ public static void ListConnectedAccounts(ActionWhat account to disconnect from this LootLocker Account /// onComplete Action for handling the response /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. - public static void DisconnectAccount(LootLockerAccountProvider accountToDisconnect, Action onComplete, string forPlayerWithUlid = null) + public static void DisconnectAccount(LootLockerAccountProvider accountToDisconnect, Action onComplete, string forPlayerWithUlid = null) { if (!CheckInitialized(false, forPlayerWithUlid)) { - onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); return; } @@ -1685,11 +1685,11 @@ public static void DisconnectAccount(LootLockerAccountProvider accountToDisconne /// The Id Token from google sign in /// onComplete Action for handling the response /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. - public static void ConnectGoogleAccount(string idToken, Action onComplete, string forPlayerWithUlid = null) + public static void ConnectGoogleAccount(string idToken, Action onComplete, string forPlayerWithUlid = null) { if (!CheckInitialized(false, forPlayerWithUlid)) { - onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); return; } @@ -1708,11 +1708,11 @@ public static void ConnectGoogleAccount(string idToken, ActionGoogle OAuth2 ClientID platform /// onComplete Action for handling the response /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. - public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPlatform platform, Action onComplete, string forPlayerWithUlid = null) + public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPlatform platform, Action onComplete, string forPlayerWithUlid = null) { if (!CheckInitialized(false, forPlayerWithUlid)) { - onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); return; } @@ -1730,11 +1730,11 @@ public static void ConnectGoogleAccount(string idToken, GoogleAccountProviderPla /// Authorization code, provided by apple during Sign In /// onComplete Action for handling the response /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. - public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Action onComplete, string forPlayerWithUlid = null) + public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Action onComplete, string forPlayerWithUlid = null) { if (!CheckInitialized(false, forPlayerWithUlid)) { - onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); return; } @@ -1745,6 +1745,95 @@ public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Act LootLockerServerRequest.CallAPI(forPlayerWithUlid, endpoint, LootLockerEndPoints.connectProviderToAccount.httpMethod, data, (response) => { LootLockerResponse.Deserialize(onComplete, response); }); } + /// + /// 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 + /// + /// The Authorization Code from Twitch sign in + /// onComplete Action for handling the response + /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. + public static void ConnectTwitchAccount(string authorizationCode, Action onComplete, string forPlayerWithUlid = null) + { + if (!CheckInitialized(false, forPlayerWithUlid)) + { + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(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); }); + } + + /// + /// 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 + /// + /// The Token from Epic sign in + /// onComplete Action for handling the response + /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. + public static void ConnectEpicAccount(string Token, Action onComplete, string forPlayerWithUlid = null) + { + if (!CheckInitialized(false, forPlayerWithUlid)) + { + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(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); }); + } + + /// + /// 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 + /// + /// The environment for the playstation account (dev, qa, prod) + /// The code from playstation sign in + /// onComplete Action for handling the response + /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. + public static void ConnectPlaystationAccount(string environment, string code, Action onComplete, string forPlayerWithUlid = null) + { + if (!CheckInitialized(false, forPlayerWithUlid)) + { + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(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); }); + } + + /// + /// 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 + /// + /// The Token from Discord sign in + /// onComplete Action for handling the response + /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. + public static void ConnectDiscordAccount(string token, Action onComplete, string forPlayerWithUlid = null) + { + if (!CheckInitialized(false, forPlayerWithUlid)) + { + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(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); }); + } + /// /// 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 @@ -1753,11 +1842,11 @@ public static void ConnectAppleAccountByRestSignIn(string authorizationCode, Act /// The nonce returned with the response when starting a lease process. Note that the process must have concluded successfully first. /// onComplete Action for handling the response /// Optional : Execute the request for the specified player. If not supplied, the default player will be used. - public static void ConnectRemoteSessionAccount(string Code, string Nonce, Action onComplete, string forPlayerWithUlid = null) + public static void ConnectRemoteSessionAccount(string Code, string Nonce, Action onComplete, string forPlayerWithUlid = null) { if (!CheckInitialized(false, forPlayerWithUlid)) { - onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); + onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError(forPlayerWithUlid)); return; } diff --git a/Runtime/Game/Requests/ConnectedAccountRequest.cs b/Runtime/Game/Requests/ConnectedAccountRequest.cs index 431efba0..62c81ab4 100644 --- a/Runtime/Game/Requests/ConnectedAccountRequest.cs +++ b/Runtime/Game/Requests/ConnectedAccountRequest.cs @@ -16,7 +16,8 @@ public enum LootLockerAccountProvider nintendo = 6, xbox = 7, playstation = 8, - twitch = 9 + twitch = 9, + discord = 10 } /// @@ -117,6 +118,50 @@ public class LootLockerConnectAppleRestProviderToAccountRequest /// public string authorization_code { get; set; } } + + /// + /// + public class LootLockerConnectEpicProviderToAccountRequest + { + /// + /// The Token from epic sign in + /// + public string token { get; set; } + } + + /// + /// + public class LootLockerConnectPlaystationProviderToAccountRequest + { + /// + /// The environment for the playstation account (dev, qa, prod) + /// + public string environment { get; set; } + /// + /// The code from playstation sign in + /// + public string code { get; set; } + } + + /// + /// + public class LootLockerConnectDiscordProviderToAccountRequest + { + /// + /// The Token from discord sign in + /// + public string token { get; set; } + } + + /// + /// + public class LootLockerConnectTwitchProviderToAccountRequest + { + /// + /// The Authorization Code from Twitch sign in + /// + public string authorization_code { get; set; } + } //================================================== // Response Definitions @@ -127,13 +172,9 @@ public class LootLockerConnectAppleRestProviderToAccountRequest public class LootLockerAccountConnectedResponse : LootLockerResponse { /// - /// The account provider + /// The connected account provider /// - public LootLockerAccountProvider provider { get; set; } - /// - /// Decorated name of this provider to use for displaying - /// - public string provider_name { get; set; } + public LootLockerConnectedAccountProvider connected_account { get; set; } } ///