Interface IServerClient
The Server Client provides functionality for servers that want to use Unity Services. Authorization can be done through either Service Account authentication or running within a Hosted Game Server.
Namespace: Unity.Services.Apis
Assembly: Unity.Services.Apis.dll
Syntax
public interface IServerClient
Properties
AccessToken
The access token applied to apis.
Declaration
string AccessToken { get; }
Property Value
Type | Description |
---|---|
string |
CloudCode
CloudCode Api
Declaration
ICloudCodeApi CloudCode { get; }
Property Value
Type | Description |
---|---|
ICloud |
CloudSaveData
CloudSave Player Data Api
Declaration
ICloudSaveDataApi CloudSaveData { get; }
Property Value
Type | Description |
---|---|
ICloud |
CloudSaveFiles
CloudSave Files Api
Declaration
ICloudSaveFilesApi CloudSaveFiles { get; }
Property Value
Type | Description |
---|---|
ICloud |
EconomyConfiguration
Economy Configuration Api
Declaration
IEconomyConfigurationApi EconomyConfiguration { get; }
Property Value
Type | Description |
---|---|
IEconomy |
EconomyCurrencies
Economy Currencies Api
Declaration
IEconomyCurrenciesApi EconomyCurrencies { get; }
Property Value
Type | Description |
---|---|
IEconomy |
EconomyInventory
Economy Inventory Api
Declaration
IEconomyInventoryApi EconomyInventory { get; }
Property Value
Type | Description |
---|---|
IEconomy |
EconomyPurchases
Economy Purchases Api
Declaration
IEconomyPurchasesApi EconomyPurchases { get; }
Property Value
Type | Description |
---|---|
IEconomy |
Leaderboards
Leaderboards Api
Declaration
ILeaderboardsApi Leaderboards { get; }
Property Value
Type | Description |
---|---|
ILeaderboards |
Lobby
Lobby Api
Declaration
ILobbyApi Lobby { get; }
Property Value
Type | Description |
---|---|
ILobby |
PlayerNames
Player Names Api
Declaration
IPlayerNamesApi PlayerNames { get; }
Property Value
Type | Description |
---|---|
IPlayer |
Methods
ClearCredentials()
Clears the credentials from the configuration of all apis
Declaration
void ClearCredentials()
SetAccessToken(string)
Apply the access token to the apis
Declaration
void SetAccessToken(string accessToken)
Parameters
Type | Name | Description |
---|---|---|
string | accessToken | The access token |
SetServiceAccount(string, string)
Set the service account that the apis will use.
Declaration
void SetServiceAccount(string apiKey, string apiSecret)
Parameters
Type | Name | Description |
---|---|---|
string | apiKey | The service account key |
string | apiSecret | The service account secret |
SignInFromServer(CancellationToken)
Retrieve a token to authorize server operations from a hosted server. Must be running on a multiplay server or with the server local proxy activated.
Declaration
ApiOperation<TokenResponse> SignInFromServer(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
Cancellation |
token | The optional cancellation token |
Returns
Type | Description |
---|---|
Api |
The operation |
SignInWithServiceAccount(string, string, List<string>, CancellationToken)
Exchange service account credentials for an access token to use with game apis.
- IMPORTANT * Always protect your service account credentials. Make sure service account information is never used in a game client.
Declaration
ApiOperation<ExchangeResponse> SignInWithServiceAccount(string projectId, string environmentId, List<string> scopes = null, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | The cloud project id |
string | environmentId | The environment id |
List<string> | scopes | The permission scopes |
Cancellation |
token | The optional cancellation token |
Returns
Type | Description |
---|---|
Api |
The operation |