WhoAmI Service

Introduction

WhoAmIService is a service in the LionSDK that provides player-related information via a REST API. Developers can use it to retrieve various player attributes or request custom data from the backend for some other service..

What does the package do?

  • Makes a GET request to the endpoint: https://whoami.lionstudios.cc/v1/

  • Fetches player-related data based on the provided key.

  • Returns structured data to help developers customize player experiences.

Usage

WhoAmIService is a static class within the Lion SDK, providing predefined helper functions to simplify fetching player data.

Implementation

The following helper functions are available, allowing developers to easily access common player attributes without dealing with API requests directly.

Function Name
Description
Return Value

IsPayer

Checks if the player has made any previous purchases in this or any other LionStudio game.

Boolean

Example

public async void Test()
{
    bool isPlayerIsPayer = await WhoAmIService.IsPayer();
}

Advanced Usage

If developers need additional data beyond the predefined functions, a generic method is available. This method allows retrieving custom values without requiring LionSDK update.

Implementation

Generic method: The GetValue<T>() function enables fetching custom data based on a specified key. The returned value can be of any primitive data type or a custom class.

  • Code signature

    //An async function
    WhoAmIService.GetValue<T>("key");
  • Full Example:

    public async void Test()
    {
        bool isPlayerIsPayer = await WhoAmIService.GetValue<bool>("is_payer");
    }

Key” parameter in GetValue<T> function is defined by LionStudios team. If devs wants new type of data urgently without updating LionSDK they can request it.

Last updated