Class AirshipUserService

Provides access to user information.

Methods

  • Gets a single user by their ID.

    Parameters

    • userId: string

      The users ID

    Returns Promise<undefined | PublicUser>

    A user object

  • Gets a single user by their username.

    Parameters

    • username: string

      The username of the user.

    Returns Promise<undefined | PublicUser>

    A user object

  • Retrieves the location of a given player.

    Parameters

    • userId: string

      The userId of the player.

    Returns Promise<undefined | {
        serverId: string;
    }>

    The location of the player. If the player could not be found or is not playing the game, returns undefined.

  • Retrieves the locations of the given players.

    Parameters

    • userIds: string[]

    Returns Promise<{
        [userId: string]: {
            serverId: string;
        } | undefined;
    }>

    A map of userId to location. If a player could not be found or is not playing the game, they are not included in the map.

  • Gets multiple users at once. When the strict parameter is set to true (default is false), the function will error if it is unable to resolve all userIds.

    Parameters

    • userIds: string[]

      The userIds to get.

    • strict: boolean = false

      Specifies if all users must be found. If set to false, the function will succeed even if not all userIds resolve to a user.

    Returns Promise<Record<string, PublicUser>>

    An array of user objects.