FaceitSharp 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package FaceitSharp --version 1.0.3                
NuGet\Install-Package FaceitSharp -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FaceitSharp" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FaceitSharp --version 1.0.3                
#r "nuget: FaceitSharp, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FaceitSharp as a Cake Addin
#addin nuget:?package=FaceitSharp&version=1.0.3

// Install FaceitSharp as a Cake Tool
#tool nuget:?package=FaceitSharp&version=1.0.3                

faceit-sharp

C# API for interacting with FaceIT and it's chat rooms

Installation

You can install the package using your favourite NuGet method

PM> Install-Package FaceitSharp

Usage

There are two different ways to use this library. There is a preferred method and a basic method. Both are outlined below.

Basic Usage

This method isn't suggested for large applications, but it's a good way to get started and to play around.

using FaceitSharp;

var config = new StaticFaceitConfig("your_api_key", "your_user_agent");
IFaceitApi api = FaceitApi.Create(config);

var yourAccount = await api.Internal.Users.Me();
var someoneElse = await api.Internal.Users.ByUsername("some_username");

var match = await api.Internal.Matches.Get("some_match_id");

How you should do it

You should attach FaceitSharp to your Dependency Injection container, with the appropriate configuration in your appsettings.json file (or your preferred method of IConfiguration handling).

using FaceitSharp;

//Get this however you want:
IServiceCollection services;

services.AddFaceit(c => 
	c.WithConfig() //This will tell the library to look for your IConfiguration object
	 .WithWebhookHandler<SomeWebhookHandler>()); //This will tell the library to use your custom WebhookHandler

...

//Then you can use it like so:

public class SomeService(IFaceitApi _api)
{
	public async Task DoSomeStuff()
	{
		var yourAccount = await _api.Internal.Users.Me();
		var someoneElse = await _api.Internal.Users.ByUsername("some_username");

		var match = await _api.Internal.Matches.Get("some_match_id");
	}
}

...

//You can create custom webhook handlers like so:
using FaceitSharp.Webhooks;

public class SomeWebhookHandler(
	IFaceitApi _api) : FaceitWebhookEventHandler
{
	public override async Task HubUserAdded(FaceitWebhookDetails webhook, EventHubUserAdded user)
	{
		var profile = await _api.Internal.Users.ById(user.UserId);
		var hub = await _api.Internal.Hubs.Get(user.Id);

		//Now you have the user's profile and the hub they joined
	}
}

FaceIT documentation

You can find the FaceIT documentation here. You can also find the FaceIT developers discord server on that page as well (click the question icon on the bottom left of the side-bar).

For questions about FaceitSharp specifically, you can contact us on discord here.

Please note, that this library is not affiliated with FaceIT and is mostly used internally by ChampionsForge. We have special permissions for certain aspects of this library that might not apply to just anyone, so use at your own risk.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.13 101 9/8/2024
1.0.12 92 9/8/2024
1.0.11 101 9/8/2024
1.0.10 93 9/8/2024
1.0.9 118 9/7/2024
1.0.8 109 8/31/2024
1.0.7 96 8/28/2024
1.0.6 110 8/26/2024
1.0.5 100 8/26/2024
1.0.4 99 8/26/2024
1.0.3 120 8/25/2024
1.0.2 111 8/24/2024
1.0.1 130 8/22/2024
1.0.0 123 8/20/2024