CotC C# SDK for Unity  v1.4.0.1
Making social games is easy !
Properties | Public Member Functions | Public Attributes | List of all members

Description

Root class of the SDK. It is stateless and allows to perform basic operations with the SDK, such as Ping.

The CotcSdk.Cloud object may typically be used to log in, which would return a CotcSdk.Gamer object, another very important object from the SDK.

Other objects such as a CotcSdk.CloudIndexing object can also be obtained synchronously in order to perform categorized operations. These objects may not be stateless though, so please refer to their respective documentation.

Properties

Game Game [get]
 Provides an API to manipulate game data, such as key/value or leaderboards. More...
 

Public Member Functions

CloudIndexing Index (string indexName, string domain=Common.PrivateDomain)
 Allows to manipulate an index. Usage: Cloud.Index("matches").IndexObject(...);. More...
 
Promise< DonePing ()
 Executes a "ping" request to the server. Allows to know whether the server is currently working as expected. More...
 
Promise< PagedList< UserInfo > > ListUsers (string filter, int limit=30, int offset=0)
 Method used to check or retrieve users from Clan of the Cloud community. The domain is not taken in account for this search. More...
 
Promise< GamerLoginAnonymously (Bundle additionalOptions=null)
 Logs the current user in anonymously. More...
 
Promise< GamerLogin (string network, string networkId, string networkSecret, Bundle additionalOptions=null)
 Logs the current user in, using any supported social network. More...
 
Promise< GamerLogin (LoginNetwork network, string networkId, string networkSecret, bool preventRegistration=false, Bundle additionalOptions=null)
 
Promise< GamerLoginWithShortcode (string shortcode, Bundle additionalOptions=null)
 Logs in by using a shortcode previously generated through SendResetPasswordEmail. More...
 
Promise< GamerResumeSession (string gamerId, string gamerSecret, Bundle additionalOptions=null)
 Logs back in with existing credentials. Should be used for users who have already been logged in previously and the application has been quit for instance. More...
 
Promise< DoneLogout (Gamer gamer)
 Logs out a previously logged in player. More...
 
Promise< DoneSendResetPasswordEmail (string userEmail, string mailSender, string mailTitle, string mailBody)
 Can be used to send an e-mail to a user registered by 'email' network in order to help him recover his/her password. More...
 
Promise< DoneUserExists (string network, string networkId)
 Checks that an user exists on a given network. More...
 
Promise< DoneUserExists (LoginNetwork network, string networkId)
 

Public Attributes

HttpRequestFailedHandler HttpRequestFailedHandler
 This handler, when set, is called synchronously whenever an HTTP request fails with a recoverable error. Some errors won't call this handler and will fail directly, such as when providing invalid arguments. This handler rather covers network errors. You need to call one of the methods of the HttpRequestFailedArgs in order to tell what to do next: either retry or abort the request. Changing this value only affects the calls made later on, not the requests currently running. You should set it once at startup. More...
 
const string SdkVersion = "1.4.2.0"
 

Property Documentation

◆ Game

Game CotcSdk.Cloud.Game
get

Provides an API to manipulate game data, such as key/value or leaderboards.

Returns
An object that allow to manipulate game specific data.

Member Function Documentation

◆ Index()

CloudIndexing CotcSdk.Cloud.Index ( string  indexName,
string  domain = Common.PrivateDomain 
)

Allows to manipulate an index. Usage: Cloud.Index("matches").IndexObject(...);.

Parameters
indexNameName of the index; scopes your searches.
domainThe domain to manipulate the index on.

◆ ListUsers()

Promise<PagedList<UserInfo> > CotcSdk.Cloud.ListUsers ( string  filter,
int  limit = 30,
int  offset = 0 
)

Method used to check or retrieve users from Clan of the Cloud community. The domain is not taken in account for this search.

Returns
Task returning the fetched list of users. The list is paginated (see CotcSdk.PagedList for more info).
Parameters
filterMay contain a nickname, a display name or e-mail address.
limitThe maximum number of results to return per page.
offsetNumber of the first result.

◆ Login()

Promise<Gamer> CotcSdk.Cloud.Login ( string  network,
string  networkId,
string  networkSecret,
Bundle  additionalOptions = null 
)

Logs the current user in, using any supported social network.

Returns
Promise resolved when the login has finished. The resulting Gamer object can then be used for many purposes related to the signed in account.
Parameters
networkThe network to connect with. If an user is recognized on a given network (same network ID), then it will be signed back in and its user data will be used.
networkIdThe ID on the network. For example, with the facebook network, this would be the User ID. On e-mail accounts e-mail then, this would be the e-mail address.
networkSecretThe secret for the network. For e-mail accounts, this would be the passord. For facebook or other SNS accounts, this would be the user token. For the LoginNetwork.GameCenter, the password is not used, so you may pass "n/a".
additionalOptionsAdditional options can be passed, such as thenBatch to execute a batch after login or preventRegistration to accept only already created accounts. Pass it as a Bundle with the additional keys. May not override preventRegistration key since it is defined by the parameter of the same name. Example options Bundle's Json: {"preventRegistration": true, "thenBatch": {"domain": "private", "name": "TestBatch", "params": {"test": true}}}

◆ LoginAnonymously()

Promise<Gamer> CotcSdk.Cloud.LoginAnonymously ( Bundle  additionalOptions = null)

Logs the current user in anonymously.

Returns
Task returning when the login has finished. The resulting Gamer object can then be used for many purposes related to the signed in account.
Parameters
additionalOptionsAdditional options can be passed, such as thenBatch to execute a batch after login. Pass it as a Bundle with the additional keys.

◆ LoginWithShortcode()

Promise<Gamer> CotcSdk.Cloud.LoginWithShortcode ( string  shortcode,
Bundle  additionalOptions = null 
)

Logs in by using a shortcode previously generated through SendResetPasswordEmail.

Parameters
shortcodeThe shortcode received by the user by e-mail.
additionalOptionsAdditional options can be passed, such as thenBatch to execute a batch after login. Pass it as a Bundle with the additional keys
Returns
Promise resolved when the login has finished. The resulting Gamer object can then be used for many purposes related to the signed in account.

◆ Logout()

Promise<Done> CotcSdk.Cloud.Logout ( Gamer  gamer)

Logs out a previously logged in player.

Parameters
gamerThe gamer to log out.
Returns
Promise resolved when the request has finished.

◆ Ping()

Promise<Done> CotcSdk.Cloud.Ping ( )

Executes a "ping" request to the server. Allows to know whether the server is currently working as expected.

Returns
Promise resolved when the request has finished.

◆ ResumeSession()

Promise<Gamer> CotcSdk.Cloud.ResumeSession ( string  gamerId,
string  gamerSecret,
Bundle  additionalOptions = null 
)

Logs back in with existing credentials. Should be used for users who have already been logged in previously and the application has been quit for instance.

Returns
Task returning when the login has finished. The resulting Gamer object can then be used for many purposes related to the signed in account.
Parameters
gamerIdCredentials of the previous session (Gamer.GamerId).
gamerSecretCredentials of the previous session (Gamer.GamerSecret).
additionalOptionsAdditional options can be passed, such as 'thenBatch' to execute a batch after login. Pass it as a Bundle with the additional keys

◆ SendResetPasswordEmail()

Promise<Done> CotcSdk.Cloud.SendResetPasswordEmail ( string  userEmail,
string  mailSender,
string  mailTitle,
string  mailBody 
)

Can be used to send an e-mail to a user registered by 'email' network in order to help him recover his/her password.

The user will receive an e-mail, containing a short code. This short code can be inputted in the LoginWithShortcode method.

Returns
Promise resolved when the request has finished.
Parameters
userEmailThe user as identified by his e-mail address.
mailSenderThe sender e-mail address as it will appear on the e-mail.
mailTitleThe title of the e-mail.
mailBodyThe body of the mail. You should include the string [[SHORTCODE]], which will be replaced by the generated short code.

◆ UserExists()

Promise<Done> CotcSdk.Cloud.UserExists ( string  network,
string  networkId 
)

Checks that an user exists on a given network.

Returns
Promise resolved when the user is found. If the user does not exist, it fails with an HTTP status code of 400.
Parameters
networkNetwork used to log in (scoping the networkId).
networkIdThe ID of the user on the network, like the e-mail address.

Member Data Documentation

◆ HttpRequestFailedHandler

HttpRequestFailedHandler CotcSdk.Cloud.HttpRequestFailedHandler

This handler, when set, is called synchronously whenever an HTTP request fails with a recoverable error. Some errors won't call this handler and will fail directly, such as when providing invalid arguments. This handler rather covers network errors. You need to call one of the methods of the HttpRequestFailedArgs in order to tell what to do next: either retry or abort the request. Changing this value only affects the calls made later on, not the requests currently running. You should set it once at startup.