// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices.Connect
{
public sealed partial class ConnectInterface : Handle
{
public ConnectInterface()
{
}
public ConnectInterface(System.IntPtr innerHandle) : base(innerHandle)
{
}
///
/// The most recent version of the API.
///
public const int AddnotifyauthexpirationApiLatest = 1;
///
/// The most recent version of the API.
///
public const int AddnotifyloginstatuschangedApiLatest = 1;
///
/// The most recent version of the API.
///
public const int CopyproductuserexternalaccountbyaccountidApiLatest = 1;
///
/// The most recent version of the API.
///
public const int CopyproductuserexternalaccountbyaccounttypeApiLatest = 1;
///
/// The most recent version of the API.
///
public const int CopyproductuserexternalaccountbyindexApiLatest = 1;
///
/// The most recent version of the API.
///
public const int CopyproductuserinfoApiLatest = 1;
///
/// The most recent version of the API.
///
public const int CreatedeviceidApiLatest = 1;
///
/// Max length of a device model name, not including the terminating null
///
public const int CreatedeviceidDevicemodelMaxLength = 64;
///
/// The most recent version of the API.
///
public const int CreateuserApiLatest = 1;
///
/// The most recent version of the struct.
///
public const int CredentialsApiLatest = 1;
///
/// The most recent version of the API.
///
public const int DeletedeviceidApiLatest = 1;
///
/// Max length of an external account ID in string form
///
public const int ExternalAccountIdMaxLength = 256;
///
/// The most recent version of the struct.
///
public const int ExternalaccountinfoApiLatest = 1;
///
/// The most recent version of the API.
///
public const int GetexternalaccountmappingApiLatest = 1;
///
/// DEPRECATED! Use instead.
///
public const int GetexternalaccountmappingsApiLatest = GetexternalaccountmappingApiLatest;
///
/// The most recent version of the API.
///
public const int GetproductuserexternalaccountcountApiLatest = 1;
///
/// The most recent version of the API.
///
public const int GetproductuseridmappingApiLatest = 1;
///
/// The most recent version of the API.
///
public const int LinkaccountApiLatest = 1;
///
/// The most recent version of the API.
///
public const int LoginApiLatest = 2;
///
/// The most recent version of the API.
///
public const int OnauthexpirationcallbackApiLatest = 1;
///
/// The most recent version of the API.
///
public const int QueryexternalaccountmappingsApiLatest = 1;
///
/// Maximum number of account IDs that can be queried at once
///
public const int QueryexternalaccountmappingsMaxAccountIds = 128;
///
/// The most recent version of the API.
///
public const int QueryproductuseridmappingsApiLatest = 2;
///
/// Timestamp value representing an undefined time for last login time.
///
public const int TimeUndefined = -1;
///
/// The most recent version of the API.
///
public const int TransferdeviceidaccountApiLatest = 1;
///
/// The most recent version of the API.
///
public const int UnlinkaccountApiLatest = 1;
///
/// The most recent version of the struct.
///
public const int UserlogininfoApiLatest = 1;
///
/// Max length of a display name, not including the terminating null.
///
public const int UserlogininfoDisplaynameMaxLength = 32;
///
/// Register to receive upcoming authentication expiration notifications.
/// Notification is approximately 10 minutes prior to expiration.
/// Call again with valid third party credentials to refresh access.
///
/// @note must call RemoveNotifyAuthExpiration to remove the notification.
///
/// structure containing the API version of the callback to use.
/// arbitrary data that is passed back to you in the callback.
/// a callback that is fired when the authentication is about to expire.
///
/// handle representing the registered callback.
///
public ulong AddNotifyAuthExpiration(AddNotifyAuthExpirationOptions options, object clientData, OnAuthExpirationCallback notification)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var notificationInternal = new OnAuthExpirationCallbackInternal(OnAuthExpirationCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, notification, notificationInternal);
var funcResult = Bindings.EOS_Connect_AddNotifyAuthExpiration(InnerHandle, optionsAddress, clientDataAddress, notificationInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Register to receive user login status updates.
/// @note must call RemoveNotifyLoginStatusChanged to remove the notification.
///
/// structure containing the API version of the callback to use.
/// arbitrary data that is passed back to you in the callback.
/// a callback that is fired when the login status for a user changes.
///
/// handle representing the registered callback.
///
public ulong AddNotifyLoginStatusChanged(AddNotifyLoginStatusChangedOptions options, object clientData, OnLoginStatusChangedCallback notification)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var notificationInternal = new OnLoginStatusChangedCallbackInternal(OnLoginStatusChangedCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, notification, notificationInternal);
var funcResult = Bindings.EOS_Connect_AddNotifyLoginStatusChanged(InnerHandle, optionsAddress, clientDataAddress, notificationInternal);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);
return funcResult;
}
///
/// Fetch information about an external account linked to a Product User ID.
/// On a successful call, the caller must release the returned structure using the API.
///
///
/// Structure containing the target external account ID.
/// The external account info data for the user with given external account ID.
///
/// An that indicates the external account data was copied into the OutExternalAccountInfo.
/// if the information is available and passed out in OutExternalAccountInfo.
/// if you pass a null pointer for the out parameter.
/// if the account data doesn't exist or hasn't been queried yet.
///
public Result CopyProductUserExternalAccountByAccountId(CopyProductUserExternalAccountByAccountIdOptions options, out ExternalAccountInfo outExternalAccountInfo)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outExternalAccountInfoAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Connect_CopyProductUserExternalAccountByAccountId(InnerHandle, optionsAddress, ref outExternalAccountInfoAddress);
Helper.TryMarshalDispose(ref optionsAddress);
if (Helper.TryMarshalGet(outExternalAccountInfoAddress, out outExternalAccountInfo))
{
Bindings.EOS_Connect_ExternalAccountInfo_Release(outExternalAccountInfoAddress);
}
return funcResult;
}
///
/// Fetch information about an external account of a specific type linked to a Product User ID.
/// On a successful call, the caller must release the returned structure using the API.
///
///
/// Structure containing the target external account type.
/// The external account info data for the user with given external account type.
///
/// An that indicates the external account data was copied into the OutExternalAccountInfo.
/// if the information is available and passed out in OutExternalAccountInfo.
/// if you pass a null pointer for the out parameter.
/// if the account data doesn't exist or hasn't been queried yet.
///
public Result CopyProductUserExternalAccountByAccountType(CopyProductUserExternalAccountByAccountTypeOptions options, out ExternalAccountInfo outExternalAccountInfo)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outExternalAccountInfoAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Connect_CopyProductUserExternalAccountByAccountType(InnerHandle, optionsAddress, ref outExternalAccountInfoAddress);
Helper.TryMarshalDispose(ref optionsAddress);
if (Helper.TryMarshalGet(outExternalAccountInfoAddress, out outExternalAccountInfo))
{
Bindings.EOS_Connect_ExternalAccountInfo_Release(outExternalAccountInfoAddress);
}
return funcResult;
}
///
/// Fetch information about an external account linked to a Product User ID.
/// On a successful call, the caller must release the returned structure using the API.
///
///
/// Structure containing the target index.
/// The external account info data for the user with given index.
///
/// An that indicates the external account data was copied into the OutExternalAccountInfo.
/// if the information is available and passed out in OutExternalAccountInfo.
/// if you pass a null pointer for the out parameter.
/// if the account data doesn't exist or hasn't been queried yet.
///
public Result CopyProductUserExternalAccountByIndex(CopyProductUserExternalAccountByIndexOptions options, out ExternalAccountInfo outExternalAccountInfo)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outExternalAccountInfoAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Connect_CopyProductUserExternalAccountByIndex(InnerHandle, optionsAddress, ref outExternalAccountInfoAddress);
Helper.TryMarshalDispose(ref optionsAddress);
if (Helper.TryMarshalGet(outExternalAccountInfoAddress, out outExternalAccountInfo))
{
Bindings.EOS_Connect_ExternalAccountInfo_Release(outExternalAccountInfoAddress);
}
return funcResult;
}
///
/// Fetch information about a Product User, using the external account that they most recently logged in with as the reference.
/// On a successful call, the caller must release the returned structure using the API.
///
///
/// Structure containing the target external account ID.
/// The external account info data last logged in for the user.
///
/// An that indicates the external account data was copied into the OutExternalAccountInfo.
/// if the information is available and passed out in OutExternalAccountInfo.
/// if you pass a null pointer for the out parameter.
/// if the account data doesn't exist or hasn't been queried yet.
///
public Result CopyProductUserInfo(CopyProductUserInfoOptions options, out ExternalAccountInfo outExternalAccountInfo)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var outExternalAccountInfoAddress = System.IntPtr.Zero;
var funcResult = Bindings.EOS_Connect_CopyProductUserInfo(InnerHandle, optionsAddress, ref outExternalAccountInfoAddress);
Helper.TryMarshalDispose(ref optionsAddress);
if (Helper.TryMarshalGet(outExternalAccountInfoAddress, out outExternalAccountInfo))
{
Bindings.EOS_Connect_ExternalAccountInfo_Release(outExternalAccountInfoAddress);
}
return funcResult;
}
///
/// Create a new unique pseudo-account that can be used to identify the current user profile on the local device.
///
/// This function is intended to be used by mobile games and PC games that wish to allow
/// a new user to start playing without requiring to login to the game using any user identity.
/// In addition to this, the Device ID feature is used to automatically login the local user
/// also when they have linked at least one external user account(s) with the local Device ID.
///
/// It is possible to link many devices with the same user's account keyring using the Device ID feature.
///
/// Linking a device later or immediately with a real user account will ensure that the player
/// will not lose their progress if they switch devices or lose the device at some point,
/// as they will be always able to login with one of their linked real accounts and also link
/// another new device with the user account associations keychain. Otherwise, without having
/// at least one permanent user account linked to the Device ID, the player would lose all of their
/// game data and progression permanently should something happen to their device or the local
/// user profile on the device.
///
/// After a successful one-time CreateDeviceId operation, the game can login the local user
/// automatically on subsequent game starts with using the
/// credentials type. If a Device ID already exists for the local user on the device then
/// error result is returned and the caller should proceed to calling directly.
///
/// structure containing operation input parameters.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the create operation completes, either successfully or in error.
public void CreateDeviceId(CreateDeviceIdOptions options, object clientData, OnCreateDeviceIdCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnCreateDeviceIdCallbackInternal(OnCreateDeviceIdCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_CreateDeviceId(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Create an account association with the Epic Online Service as a product user given their external auth credentials.
///
/// structure containing a continuance token from a "user not found" response during Login (always try login first).
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the create operation completes, either successfully or in error.
public void CreateUser(CreateUserOptions options, object clientData, OnCreateUserCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnCreateUserCallbackInternal(OnCreateUserCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_CreateUser(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Delete any existing Device ID access credentials for the current user profile on the local device.
///
/// The deletion is permanent and it is not possible to recover lost game data and progression
/// if the Device ID had not been linked with at least one real external user account.
///
/// structure containing operation input parameters
/// arbitrary data that is passed back to you in the CompletionDelegate
/// a callback that is fired when the delete operation completes, either successfully or in error
public void DeleteDeviceId(DeleteDeviceIdOptions options, object clientData, OnDeleteDeviceIdCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnDeleteDeviceIdCallbackInternal(OnDeleteDeviceIdCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_DeleteDeviceId(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Fetch a Product User ID that maps to an external account ID cached from a previous query.
///
/// structure containing the local user and target external account ID.
///
/// The Product User ID, previously retrieved from the backend service, for the given target external account.
///
public ProductUserId GetExternalAccountMapping(GetExternalAccountMappingsOptions options)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var funcResult = Bindings.EOS_Connect_GetExternalAccountMapping(InnerHandle, optionsAddress);
Helper.TryMarshalDispose(ref optionsAddress);
ProductUserId funcResultReturn;
Helper.TryMarshalGet(funcResult, out funcResultReturn);
return funcResultReturn;
}
///
/// Fetch a Product User ID that is logged in. This Product User ID is in the Epic Online Services namespace.
///
/// an index into the list of logged in users. If the index is out of bounds, the returned Product User ID will be invalid.
///
/// the Product User ID associated with the index passed.
///
public ProductUserId GetLoggedInUserByIndex(int index)
{
var funcResult = Bindings.EOS_Connect_GetLoggedInUserByIndex(InnerHandle, index);
ProductUserId funcResultReturn;
Helper.TryMarshalGet(funcResult, out funcResultReturn);
return funcResultReturn;
}
///
/// Fetch the number of product users that are logged in.
///
///
/// the number of product users logged in.
///
public int GetLoggedInUsersCount()
{
var funcResult = Bindings.EOS_Connect_GetLoggedInUsersCount(InnerHandle);
return funcResult;
}
///
/// Fetches the login status for an Product User ID. This Product User ID is considered logged in as long as the underlying access token has not expired.
///
/// the Product User ID of the user being queried.
///
/// the enum value of a user's login status.
///
public LoginStatus GetLoginStatus(ProductUserId localUserId)
{
var localUserIdInnerHandle = System.IntPtr.Zero;
Helper.TryMarshalSet(ref localUserIdInnerHandle, localUserId);
var funcResult = Bindings.EOS_Connect_GetLoginStatus(InnerHandle, localUserIdInnerHandle);
return funcResult;
}
///
/// Fetch the number of linked external accounts for a Product User ID.
///
///
/// The Options associated with retrieving the external account info count.
///
/// Number of external accounts or 0 otherwise.
///
public uint GetProductUserExternalAccountCount(GetProductUserExternalAccountCountOptions options)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var funcResult = Bindings.EOS_Connect_GetProductUserExternalAccountCount(InnerHandle, optionsAddress);
Helper.TryMarshalDispose(ref optionsAddress);
return funcResult;
}
///
/// Fetch an external account ID, in string form, that maps to a given Product User ID.
///
/// structure containing the local user and target Product User ID.
/// The buffer into which the external account ID data should be written. The buffer must be long enough to hold a string of .
///
/// The size of the OutBuffer in characters.
/// The input buffer should include enough space to be null-terminated.
/// When the function returns, this parameter will be filled with the length of the string copied into OutBuffer.
///
///
/// An that indicates the external account ID was copied into the OutBuffer.
/// if the information is available and passed out in OutUserInfo.
/// if you pass a null pointer for the out parameter.
/// if the mapping doesn't exist or hasn't been queried yet.
/// if the OutBuffer is not large enough to receive the external account ID. InOutBufferLength contains the required minimum length to perform the operation successfully.
///
public Result GetProductUserIdMapping(GetProductUserIdMappingOptions options, out string outBuffer)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
System.IntPtr outBufferAddress = System.IntPtr.Zero;
int inOutBufferLength = ExternalAccountIdMaxLength + 1;
Helper.TryMarshalAllocate(ref outBufferAddress, inOutBufferLength);
var funcResult = Bindings.EOS_Connect_GetProductUserIdMapping(InnerHandle, optionsAddress, outBufferAddress, ref inOutBufferLength);
Helper.TryMarshalDispose(ref optionsAddress);
Helper.TryMarshalGet(outBufferAddress, out outBuffer);
Helper.TryMarshalDispose(ref outBufferAddress);
return funcResult;
}
///
/// Link a set of external auth credentials with an existing product user on the Epic Online Service.
///
/// structure containing a continuance token from a "user not found" response during Login (always try login first) and a currently logged in user not already associated with this external auth provider.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the link operation completes, either successfully or in error.
public void LinkAccount(LinkAccountOptions options, object clientData, OnLinkAccountCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnLinkAccountCallbackInternal(OnLinkAccountCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_LinkAccount(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Login/Authenticate given a valid set of external auth credentials.
///
/// structure containing the external account credentials and type to use during the login operation.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the login operation completes, either successfully or in error.
public void Login(LoginOptions options, object clientData, OnLoginCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnLoginCallbackInternal(OnLoginCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_Login(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Retrieve the equivalent Product User IDs from a list of external account IDs from supported account providers.
/// The values will be cached and retrievable through .
///
/// structure containing a list of external account IDs, in string form, to query for the Product User ID representation.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the query operation completes, either successfully or in error.
public void QueryExternalAccountMappings(QueryExternalAccountMappingsOptions options, object clientData, OnQueryExternalAccountMappingsCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnQueryExternalAccountMappingsCallbackInternal(OnQueryExternalAccountMappingsCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_QueryExternalAccountMappings(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Retrieve the equivalent external account mappings from a list of Product User IDs.
/// This will include data for each external account info found for the linked product IDs.
///
/// The values will be cached and retrievable via , ,
/// or .
///
///
///
///
///
///
///
///
/// structure containing a list of Product User IDs to query for the external account representation.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the query operation completes, either successfully or in error.
public void QueryProductUserIdMappings(QueryProductUserIdMappingsOptions options, object clientData, OnQueryProductUserIdMappingsCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnQueryProductUserIdMappingsCallbackInternal(OnQueryProductUserIdMappingsCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_QueryProductUserIdMappings(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Unregister from receiving expiration notifications.
///
/// handle representing the registered callback.
public void RemoveNotifyAuthExpiration(ulong inId)
{
Helper.TryRemoveCallbackByNotificationId(inId);
Bindings.EOS_Connect_RemoveNotifyAuthExpiration(InnerHandle, inId);
}
///
/// Unregister from receiving user login status updates.
///
/// handle representing the registered callback.
public void RemoveNotifyLoginStatusChanged(ulong inId)
{
Helper.TryRemoveCallbackByNotificationId(inId);
Bindings.EOS_Connect_RemoveNotifyLoginStatusChanged(InnerHandle, inId);
}
///
/// Transfer a Device ID pseudo-account and the product user associated with it into another
/// keychain linked with real user accounts (such as Epic Games, PlayStation(TM)Network, Xbox Live, and other).
///
/// This function allows transferring a product user, i.e. the local user's game progression
/// backend data from a Device ID owned keychain into a keychain with real user accounts
/// linked to it. The transfer of Device ID owned product user into a keychain of real user
/// accounts allows persisting the user's game data on the backend in the event that they
/// would lose access to the local device or otherwise switch to another device or platform.
///
/// This function is only applicable in the situation of where the local user first plays
/// the game using the anonymous Device ID login, then later logs in using a real user
/// account that they have also already used to play the same game or another game under the
/// same organization within Epic Online Services. In such situation, while normally the login
/// attempt with a real user account would return and an
/// and allow calling the API to link it with the Device ID's keychain,
/// instead the login operation succeeds and finds an existing user because the association
/// already exists. Because the user cannot have two product users simultaneously to play with,
/// the game should prompt the user to choose which profile to keep and which one to discard
/// permanently. Based on the user choice, the game may then proceed to transfer the Device ID
/// login into the keychain that is persistent and backed by real user accounts, and if the user
/// chooses so, move the product user as well into the destination keychain and overwrite the
/// existing previous product user with it. To clarify, moving the product user with the Device ID
/// login in this way into a persisted keychain allows to preserve the so far only locally persisted
/// game progression and thus protect the user against a case where they lose access to the device.
///
/// On success, the completion callback will return the preserved that remains
/// logged in while the discarded has been invalidated and deleted permanently.
/// Consecutive logins using the existing Device ID login type or the external account will
/// connect the user to the same backend data belonging to the preserved .
///
/// Example walkthrough: Cross-platform mobile game using the anonymous Device ID login.
///
/// For onboarding new users, the game will attempt to always automatically login the local user
/// by calling using the login type. If the local
/// Device ID credentials are not found, and the game wants a frictionless entry for the first time
/// user experience, the game will automatically call to create new
/// Device ID pseudo-account and then login the local user into it. Consecutive game starts will
/// thus automatically login the user to their locally persisted Device ID account.
///
/// The user starts playing anonymously using the Device ID login type and makes significant game progress.
/// Later, they login using an external account that they have already used previously for the
/// same game perhaps on another platform, or another game owned by the same organization.
/// In such case, will automatically login the user to their existing account
/// linking keychain and create automatically a new empty product user for this product.
///
/// In order for the user to use their existing previously created keychain and have the locally
/// created Device ID login reference to that keychain instead, the user's current product user
/// needs to be moved to be under that keychain so that their existing game progression will be
/// preserved. To do so, the game can call to transfer the
/// Device ID login and the product user associated with it into the other keychain that has real
/// external user account(s) linked to it. Note that it is important that the game either automatically
/// checks that the other product user does not have any meaningful progression data, or otherwise
/// will prompt the user to make the choice on which game progression to preserve and which can
/// be discarded permanently. The other product user will be discarded permanently and cannot be
/// recovered, so it is very important that the user is guided to make the right choice to avoid
/// accidental loss of all game progression.
///
///
///
/// structure containing the logged in product users and specifying which one will be preserved.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the transfer operation completes, either successfully or in error.
public void TransferDeviceIdAccount(TransferDeviceIdAccountOptions options, object clientData, OnTransferDeviceIdAccountCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnTransferDeviceIdAccountCallbackInternal(OnTransferDeviceIdAccountCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_TransferDeviceIdAccount(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
///
/// Unlink external auth credentials from the owning keychain of a logged in product user.
///
/// This function allows recovering the user from scenarios where they have accidentally proceeded to creating
/// a new product user for the local native user account, instead of linking it with an existing keychain that
/// they have previously created by playing the game (or another game owned by the organization) on another platform.
///
/// In such scenario, after the initial platform login and a new product user creation, the user wishes to re-login
/// using other set of external auth credentials to connect with their existing game progression data. In order to
/// allow automatic login also on the current platform, they will need to unlink the accidentally created new keychain
/// and product user and then use the and APIs to link the local native platform
/// account with that previously created existing product user and its owning keychain.
///
/// In another scenario, the user may simply want to disassociate the account that they have logged in with from the current
/// keychain that it is linked with, perhaps to link it against another keychain or to separate the game progressions again.
///
/// In order to protect against account theft, it is only possible to unlink user accounts that have been authenticated
/// and logged in to the product user in the current session. This prevents a malicious actor from gaining access to one
/// of the linked accounts and using it to remove all other accounts linked with the keychain. This also prevents a malicious
/// actor from replacing the unlinked account with their own corresponding account on the same platform, as the unlinking
/// operation will ensure that any existing authentication session cannot be used to re-link and overwrite the entry without
/// authenticating with one of the other linked accounts in the keychain. These restrictions limit the potential attack surface
/// related to account theft scenarios.
///
/// structure containing operation input parameters.
/// arbitrary data that is passed back to you in the CompletionDelegate.
/// a callback that is fired when the unlink operation completes, either successfully or in error.
public void UnlinkAccount(UnlinkAccountOptions options, object clientData, OnUnlinkAccountCallback completionDelegate)
{
var optionsAddress = System.IntPtr.Zero;
Helper.TryMarshalSet(ref optionsAddress, options);
var clientDataAddress = System.IntPtr.Zero;
var completionDelegateInternal = new OnUnlinkAccountCallbackInternal(OnUnlinkAccountCallbackInternalImplementation);
Helper.AddCallback(ref clientDataAddress, clientData, completionDelegate, completionDelegateInternal);
Bindings.EOS_Connect_UnlinkAccount(InnerHandle, optionsAddress, clientDataAddress, completionDelegateInternal);
Helper.TryMarshalDispose(ref optionsAddress);
}
[MonoPInvokeCallback(typeof(OnAuthExpirationCallbackInternal))]
internal static void OnAuthExpirationCallbackInternalImplementation(System.IntPtr data)
{
OnAuthExpirationCallback callback;
AuthExpirationCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnCreateDeviceIdCallbackInternal))]
internal static void OnCreateDeviceIdCallbackInternalImplementation(System.IntPtr data)
{
OnCreateDeviceIdCallback callback;
CreateDeviceIdCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnCreateUserCallbackInternal))]
internal static void OnCreateUserCallbackInternalImplementation(System.IntPtr data)
{
OnCreateUserCallback callback;
CreateUserCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnDeleteDeviceIdCallbackInternal))]
internal static void OnDeleteDeviceIdCallbackInternalImplementation(System.IntPtr data)
{
OnDeleteDeviceIdCallback callback;
DeleteDeviceIdCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnLinkAccountCallbackInternal))]
internal static void OnLinkAccountCallbackInternalImplementation(System.IntPtr data)
{
OnLinkAccountCallback callback;
LinkAccountCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnLoginCallbackInternal))]
internal static void OnLoginCallbackInternalImplementation(System.IntPtr data)
{
OnLoginCallback callback;
LoginCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnLoginStatusChangedCallbackInternal))]
internal static void OnLoginStatusChangedCallbackInternalImplementation(System.IntPtr data)
{
OnLoginStatusChangedCallback callback;
LoginStatusChangedCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnQueryExternalAccountMappingsCallbackInternal))]
internal static void OnQueryExternalAccountMappingsCallbackInternalImplementation(System.IntPtr data)
{
OnQueryExternalAccountMappingsCallback callback;
QueryExternalAccountMappingsCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnQueryProductUserIdMappingsCallbackInternal))]
internal static void OnQueryProductUserIdMappingsCallbackInternalImplementation(System.IntPtr data)
{
OnQueryProductUserIdMappingsCallback callback;
QueryProductUserIdMappingsCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnTransferDeviceIdAccountCallbackInternal))]
internal static void OnTransferDeviceIdAccountCallbackInternalImplementation(System.IntPtr data)
{
OnTransferDeviceIdAccountCallback callback;
TransferDeviceIdAccountCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
[MonoPInvokeCallback(typeof(OnUnlinkAccountCallbackInternal))]
internal static void OnUnlinkAccountCallbackInternalImplementation(System.IntPtr data)
{
OnUnlinkAccountCallback callback;
UnlinkAccountCallbackInfo callbackInfo;
if (Helper.TryGetAndRemoveCallback(data, out callback, out callbackInfo))
{
callback(callbackInfo);
}
}
}
}