ApiFootball 1.0.8

dotnet add package ApiFootball --version 1.0.8                
NuGet\Install-Package ApiFootball -Version 1.0.8                
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="ApiFootball" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ApiFootball --version 1.0.8                
#r "nuget: ApiFootball, 1.0.8"                
#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 ApiFootball as a Cake Addin
#addin nuget:?package=ApiFootball&version=1.0.8

// Install ApiFootball as a Cake Tool
#tool nuget:?package=ApiFootball&version=1.0.8                

CSharpApiFootball

Test NuGet

DI compatible C# API client for api-football.com. Only v3 endpoints will be supported. A list of availble endpoints can be found below, not a lot of them are there yet but this is a work in progress. It should work with both api-sports and rapidapi keys, but because I do not have a rapidapi key I cannot test this. If you would like to help out, feel free to open a pull request!

This project is not affiliated with api-football or api-sports.

Example

var key = "your api key";
var host = Host
    .CreateDefaultBuilder(Array.Empty<string>())
    .ConfigureServices(services => {
        services
            .AddApiFootball(key); // Configure ApiFootball clients
    }).Build();

var serviceScope = host.Services.CreateScope();
var provider = serviceScope.ServiceProvider;

// Print Dutch Eredivisie games and final scores for the 2022 season
var fixturesClient = provider.GetRequiredService<IFixturesClient>();
var fixtures = await fixturesClient.GetFixtures(league:88, season:2022);
fixtures.Response
    .Select(fix => $"{fix.Teams.Home.Name, 20}  -  {fix.Teams.Away.Name, -20} {" ", 10} {fix.Goals.Home} - {fix.Goals.Away}")
    .ToList()
    .ForEach(Console.WriteLine);
    
// Print all timezones
var timezoneClient = provider.GetRequiredService<ITimezoneClient>();
var timezones = await timezoneClient.GetTimezones();
timezones.Response.ForEach(Console.WriteLine);

Supported endpoints

  • /countries
  • /fixtures
  • /fixtures/rounds
  • /leagues
  • /leagues/seasons
  • /timezone

Todo

  • More endpoints
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.8 183 8/30/2023
1.0.7 310 12/21/2022