/valorant_client

Unofficial valorant client to interact with riot's valorant game api.

Primary LanguageDartMIT LicenseMIT

ValorantClient

pub.dev

Dart Flutter

likes popularity pub points

valorant_client is a library to interact with VALORANT Game API's to fetch user specific data such as matches played, user info, store info etc.


Usage

  • Add valorant_client as a dependency on pubspec.yaml file on your project root. At the time of this writing, the latest package version is 1.1.0. Do check Package Page to get latest version.
dependencies:
  valorant_client: ^1.1.3
  • Import the library to your project class in which you want to use the library.
import 'package:valorant_client/valorant_client.dart';
  • Create a new instance of ValorantClient class.
ValorantClient client = ValorantClient(
    UserDetails(userName: {'your_username'}, password: {'your_password'}, region: {your_region}),
    callback: Callback(
      onError: (String error) {
        print(error);
      },
      onRequestError: (DioError error) {
        print(error.message);
      },
    ),
  );

NOTE: Passing the callback here is optional. However, to know if your request failed internally due to wrong status code etc, you will require the callback.

  • Now you can initialize client. Optional Boolean parameter can be set as true if you want to handle re-authorization if session becames invalid.
await client.init(true);

NOTE: This is an async function, it authorizes this client to valorant API's. without calling this, you will not get results from the api.

  • Thats it! Now you can send api requests to Valorant API. To Get current authorized player, you can call:
final currentPlayer = await client.playerInterface.getPlayer();

Features Implemented

  • Authorization (RSO authorization flow)

    • You can use this authorization system to authorize an account, get Authorization headers required for API calls, and use it with any endpoint which is not yet implemented in this library.
    • Authorized Session normally lasts for 1 hour (Riot API limitation), you can set it to automatically re-authorize depending on the validity period if required.
  • Player Endpoint

    • Get Player (IGN, Tag Line)
    • Get Store Items
    • Get MMR
    • Get Balance (VP, Radianite Points etc)
  • Assets Endpoint

    • Get All Content Assets (Including their path, asset id etc)

Buy Me A Coffee