Documentation

PlayerNamesApi

Import

Import

  • const { PlayerNamesApi } = require("@unity-services/player-names-1.0");

Constructors

Constructor

Methods

Get Name

  • getName(playerId: string, autoGenerate?: boolean, showMetadata?: boolean, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<Player, any>>
  • Get a player's name. The '/me' endpoint can be used to get the name of the calling player.

    summary

    Get a player's name.

    throws

    {RequiredError}

    memberof

    PlayerNamesApi

    Parameters

    • playerId: string

      The player&#39;s ID.

    • Optional autoGenerate: boolean
    • Optional showMetadata: boolean
    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<Player, any>>

Update Name

  • updateName(playerId: string, updateNameRequest: UpdateNameRequest, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<Player, any>>
  • 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.

    summary

    Update a player's name.

    throws

    {RequiredError}

    memberof

    PlayerNamesApi

    Parameters

    • playerId: string

      The player&#39;s ID.

    • updateNameRequest: UpdateNameRequest
    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<Player, any>>