Class PlayerNamesApi
Represents a collection of functions to interact with the API endpoints
Inherited Members
Namespace: Unity.Services.Apis.PlayerNames
Assembly: Unity.Services.Apis.dll
Syntax
public class PlayerNamesApi : IPlayerNamesApi, IApiAccessor
Constructors
PlayerNamesApi(IApiClient)
Initializes a new instance of the Player
Declaration
public PlayerNamesApi(IApiClient apiClient)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
PlayerNamesApi(IApiClient, IApiConfiguration)
Initializes a new instance of the Player
Declaration
public PlayerNamesApi(IApiClient apiClient, IApiConfiguration apiConfiguration)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
IApi |
apiConfiguration | The configuration object. |
Properties
Client
The client for accessing this underlying API asynchronously.
Declaration
public IApiClient Client { get; }
Property Value
Type | Description |
---|---|
IApi |
Configuration
Gets the configuration object
Declaration
public IApiConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IApi |
An instance of the Configuration |
Methods
GetBasePath()
Gets the base path of the API client.
Declaration
public string GetBasePath()
Returns
Type | Description |
---|---|
string | The base path |
GetName(string, bool?, bool?, CancellationToken)
Get a player's name. Get a player's name. The '/me' endpoint can be used to get the name of the calling player.
Declaration
public ApiOperation<Player> GetName(string playerId, bool? autoGenerate = null, bool? showMetadata = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | playerId | The player's ID. |
bool? | autoGenerate | Indicates if a player without a name should have one auto generated or not. Defaults to true. (optional) |
bool? | showMetadata | If true, returns additional metadata like 'autoGenerated' with records. Defaults to false. (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
UpdateName(string, UpdateNameRequest, CancellationToken)
Update a player's name. Update a player's name, or create it if it doesn't exist. White space is not allowed in the name, and a random numeric suffix will automatically be added to it.
Declaration
public ApiOperation<Player> UpdateName(string playerId, UpdateNameRequest updateNameRequest, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | playerId | The player's ID. |
Update |
updateNameRequest | The update name request. |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |