Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Latest commit

 

History

History
107 lines (85 loc) · 4.25 KB

README.md

File metadata and controls

107 lines (85 loc) · 4.25 KB

Dragon6 API

NuGet Publishing NuGet Nuget DragonFruit Discord

Warning

Deprecation Notice: This project has been discontinued and as such some aspects may no longer function as intended. Your mileage may vary.

Overview

The Dragon6 API is the backbone of the website and apps with the same name, providing an easy-to-use platform for retrieving publicly-available data about other Ubisoft Accounts and their Rainbow Six | Siege Stats.

This API supports:

  • Ubisoft Account Authentication
  • Ubisoft Account Searches (by name and ubisoft id)
  • Ubisoft Account Activity Tracking (for R6)
  • Legacy Stats (lifetime account stats)
  • Seasonal Stats (ranked and unranked/casual stats per-season)
  • Modern Stats (the stats currently found on the official Ubisoft tracker) (coming soon)
  • Ubisoft Toolkits (IP geolocation, Rainbow Six Server Status)

Usage

  1. Download the package from by clicking the NuGet badge at the top of this document, and follow the instructions there for your environment
  2. Create a class inside your project, naming it what you want to call your client type (for example StatsClient)
    using System;
    using System.IO;
    using System.Threading.Tasks;
    using DragonFruit.Data;
    using DragonFruit.Data.Serializers.Newtonsoft;
    using DragonFruit.Six.Api;
    using DragonFruit.Six.Api.Authentication;
    
    public class StatsClient : Dragon6Client
    {
        // change this to whatever you want
        private readonly string _tokenFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DragonFruit Network", "ubi.token");
        
        static StatsClient()
        {
            Directory.CreateDirectory(Path.GetDirectoryName(_tokenFile));
        }
    
        /// <summary>
        /// Tells the Dragon6 Client how to get a token in the case of a restart or expiration
        /// </summary>
        protected override IUbisoftToken GetToken()
        {
            if (File.Exists(_tokenFile))
            {
                // if we have a file with some potentially valid keys, try that first
                var token = FileServices.ReadFile<UbisoftToken>(_tokenFile);
    
                if (!token.Expired)
                    return token;
            }
    
            // store logins somewhere that is NOT in the code
            var username = "username";
            var password = "password";
            var newToken = this.GetUbiToken(username, password);
    
            // write new token to disk (non-blocking)
            _ = Task.Run(() => FileServices.WriteFile(_tokenFile, newToken));
            
            // return to keep going
            return newToken;
        }
    }
  3. Create an instance of the class you just defined in either a static location or as a Singleton (if you're using a dependency container)
  4. Add some using statements where you want to consume the class:
using DragonFruit.Six.Api.Legacy;
using DragonFruit.Six.Api.Seasonal;
using DragonFruit.Six.Api.Accounts;
using DragonFruit.Six.Api.Modern;
  1. Check out the extension methods available to you using IntelliSense (type the client name followed by the dot and browse the extensions):
var myAccount = await statsClient.GetAccountAsync("PaPa.Curry", Platform.PC, IdentifierType.Name);

Official Apps

Contributing

Refer to CONTRIBUTING.md for more information