Skip to content

TBA-API/tba-api-client-csharp

Repository files navigation

TBAAPI.V3Client - the C# library for the The Blue Alliance API v3

Overview

Information and statistics about FIRST Robotics Competition teams and events.

Authentication

All endpoints require an Auth Key to be passed in the header X-TBA-Auth-Key. If you do not have an auth key yet, you can obtain one from your Account Page.

A User-Agent header may need to be set to prevent a 403 Unauthorized error.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 3.8.0
  • SDK version: 3.8.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using TBAAPI.V3Client.Api;
using TBAAPI.V3Client.Client;
using TBAAPI.V3Client.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out TBAAPI.V3Client.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using TBAAPI.V3Client.Api;
using TBAAPI.V3Client.Client;
using TBAAPI.V3Client.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration.Default.BasePath = "https://www.thebluealliance.com/api/v3";
            // Configure API key authorization: apiKey
            Configuration.Default.ApiKey.Add("X-TBA-Auth-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("X-TBA-Auth-Key", "Bearer");

            var apiInstance = new DistrictApi(Configuration.Default);
            var districtKey = districtKey_example;  // string | TBA District Key, eg `2016fim`
            var ifModifiedSince = ifModifiedSince_example;  // string | Value of the `Last-Modified` header in the most recently cached response by the client. (optional) 

            try
            {
                List<Event> result = apiInstance.GetDistrictEvents(districtKey, ifModifiedSince);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DistrictApi.GetDistrictEvents: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://www.thebluealliance.com/api/v3

Class Method HTTP request Description
DistrictApi GetDistrictEvents GET /district/{district_key}/events
DistrictApi GetDistrictEventsKeys GET /district/{district_key}/events/keys
DistrictApi GetDistrictEventsSimple GET /district/{district_key}/events/simple
DistrictApi GetDistrictRankings GET /district/{district_key}/rankings
DistrictApi GetDistrictTeams GET /district/{district_key}/teams
DistrictApi GetDistrictTeamsKeys GET /district/{district_key}/teams/keys
DistrictApi GetDistrictTeamsSimple GET /district/{district_key}/teams/simple
DistrictApi GetDistrictsByYear GET /districts/{year}
DistrictApi GetEventDistrictPoints GET /event/{event_key}/district_points
DistrictApi GetTeamDistricts GET /team/{team_key}/districts
EventApi GetDistrictEvents GET /district/{district_key}/events
EventApi GetDistrictEventsKeys GET /district/{district_key}/events/keys
EventApi GetDistrictEventsSimple GET /district/{district_key}/events/simple
EventApi GetEvent GET /event/{event_key}
EventApi GetEventAlliances GET /event/{event_key}/alliances
EventApi GetEventAwards GET /event/{event_key}/awards
EventApi GetEventDistrictPoints GET /event/{event_key}/district_points
EventApi GetEventInsights GET /event/{event_key}/insights
EventApi GetEventMatchTimeseries GET /event/{event_key}/matches/timeseries
EventApi GetEventMatches GET /event/{event_key}/matches
EventApi GetEventMatchesKeys GET /event/{event_key}/matches/keys
EventApi GetEventMatchesSimple GET /event/{event_key}/matches/simple
EventApi GetEventOPRs GET /event/{event_key}/oprs
EventApi GetEventPredictions GET /event/{event_key}/predictions
EventApi GetEventRankings GET /event/{event_key}/rankings
EventApi GetEventSimple GET /event/{event_key}/simple
EventApi GetEventTeams GET /event/{event_key}/teams
EventApi GetEventTeamsKeys GET /event/{event_key}/teams/keys
EventApi GetEventTeamsSimple GET /event/{event_key}/teams/simple
EventApi GetEventTeamsStatuses GET /event/{event_key}/teams/statuses
EventApi GetEventsByYear GET /events/{year}
EventApi GetEventsByYearKeys GET /events/{year}/keys
EventApi GetEventsByYearSimple GET /events/{year}/simple
EventApi GetTeamEventAwards GET /team/{team_key}/event/{event_key}/awards
EventApi GetTeamEventMatches GET /team/{team_key}/event/{event_key}/matches
EventApi GetTeamEventMatchesKeys GET /team/{team_key}/event/{event_key}/matches/keys
EventApi GetTeamEventMatchesSimple GET /team/{team_key}/event/{event_key}/matches/simple
EventApi GetTeamEventStatus GET /team/{team_key}/event/{event_key}/status
EventApi GetTeamEvents GET /team/{team_key}/events
EventApi GetTeamEventsByYear GET /team/{team_key}/events/{year}
EventApi GetTeamEventsByYearKeys GET /team/{team_key}/events/{year}/keys
EventApi GetTeamEventsByYearSimple GET /team/{team_key}/events/{year}/simple
EventApi GetTeamEventsKeys GET /team/{team_key}/events/keys
EventApi GetTeamEventsSimple GET /team/{team_key}/events/simple
EventApi GetTeamEventsStatusesByYear GET /team/{team_key}/events/{year}/statuses
ListApi GetDistrictEvents GET /district/{district_key}/events
ListApi GetDistrictEventsKeys GET /district/{district_key}/events/keys
ListApi GetDistrictEventsSimple GET /district/{district_key}/events/simple
ListApi GetDistrictRankings GET /district/{district_key}/rankings
ListApi GetDistrictTeams GET /district/{district_key}/teams
ListApi GetDistrictTeamsKeys GET /district/{district_key}/teams/keys
ListApi GetDistrictTeamsSimple GET /district/{district_key}/teams/simple
ListApi GetEventTeams GET /event/{event_key}/teams
ListApi GetEventTeamsKeys GET /event/{event_key}/teams/keys
ListApi GetEventTeamsSimple GET /event/{event_key}/teams/simple
ListApi GetEventTeamsStatuses GET /event/{event_key}/teams/statuses
ListApi GetEventsByYear GET /events/{year}
ListApi GetEventsByYearKeys GET /events/{year}/keys
ListApi GetEventsByYearSimple GET /events/{year}/simple
ListApi GetTeamEventsStatusesByYear GET /team/{team_key}/events/{year}/statuses
ListApi GetTeams GET /teams/{page_num}
ListApi GetTeamsByYear GET /teams/{year}/{page_num}
ListApi GetTeamsByYearKeys GET /teams/{year}/{page_num}/keys
ListApi GetTeamsByYearSimple GET /teams/{year}/{page_num}/simple
ListApi GetTeamsKeys GET /teams/{page_num}/keys
ListApi GetTeamsSimple GET /teams/{page_num}/simple
MatchApi GetEventMatchTimeseries GET /event/{event_key}/matches/timeseries
MatchApi GetEventMatches GET /event/{event_key}/matches
MatchApi GetEventMatchesKeys GET /event/{event_key}/matches/keys
MatchApi GetEventMatchesSimple GET /event/{event_key}/matches/simple
MatchApi GetMatch GET /match/{match_key}
MatchApi GetMatchSimple GET /match/{match_key}/simple
MatchApi GetMatchTimeseries GET /match/{match_key}/timeseries
MatchApi GetMatchZebra GET /match/{match_key}/zebra_motionworks
MatchApi GetTeamEventMatches GET /team/{team_key}/event/{event_key}/matches
MatchApi GetTeamEventMatchesKeys GET /team/{team_key}/event/{event_key}/matches/keys
MatchApi GetTeamEventMatchesSimple GET /team/{team_key}/event/{event_key}/matches/simple
MatchApi GetTeamMatchesByYear GET /team/{team_key}/matches/{year}
MatchApi GetTeamMatchesByYearKeys GET /team/{team_key}/matches/{year}/keys
MatchApi GetTeamMatchesByYearSimple GET /team/{team_key}/matches/{year}/simple
TBAApi GetStatus GET /status
TeamApi GetDistrictRankings GET /district/{district_key}/rankings
TeamApi GetDistrictTeams GET /district/{district_key}/teams
TeamApi GetDistrictTeamsKeys GET /district/{district_key}/teams/keys
TeamApi GetDistrictTeamsSimple GET /district/{district_key}/teams/simple
TeamApi GetEventTeams GET /event/{event_key}/teams
TeamApi GetEventTeamsKeys GET /event/{event_key}/teams/keys
TeamApi GetEventTeamsSimple GET /event/{event_key}/teams/simple
TeamApi GetEventTeamsStatuses GET /event/{event_key}/teams/statuses
TeamApi GetTeam GET /team/{team_key}
TeamApi GetTeamAwards GET /team/{team_key}/awards
TeamApi GetTeamAwardsByYear GET /team/{team_key}/awards/{year}
TeamApi GetTeamDistricts GET /team/{team_key}/districts
TeamApi GetTeamEventAwards GET /team/{team_key}/event/{event_key}/awards
TeamApi GetTeamEventMatches GET /team/{team_key}/event/{event_key}/matches
TeamApi GetTeamEventMatchesKeys GET /team/{team_key}/event/{event_key}/matches/keys
TeamApi GetTeamEventMatchesSimple GET /team/{team_key}/event/{event_key}/matches/simple
TeamApi GetTeamEventStatus GET /team/{team_key}/event/{event_key}/status
TeamApi GetTeamEvents GET /team/{team_key}/events
TeamApi GetTeamEventsByYear GET /team/{team_key}/events/{year}
TeamApi GetTeamEventsByYearKeys GET /team/{team_key}/events/{year}/keys
TeamApi GetTeamEventsByYearSimple GET /team/{team_key}/events/{year}/simple
TeamApi GetTeamEventsKeys GET /team/{team_key}/events/keys
TeamApi GetTeamEventsSimple GET /team/{team_key}/events/simple
TeamApi GetTeamEventsStatusesByYear GET /team/{team_key}/events/{year}/statuses
TeamApi GetTeamMatchesByYear GET /team/{team_key}/matches/{year}
TeamApi GetTeamMatchesByYearKeys GET /team/{team_key}/matches/{year}/keys
TeamApi GetTeamMatchesByYearSimple GET /team/{team_key}/matches/{year}/simple
TeamApi GetTeamMediaByTag GET /team/{team_key}/media/tag/{media_tag}
TeamApi GetTeamMediaByTagYear GET /team/{team_key}/media/tag/{media_tag}/{year}
TeamApi GetTeamMediaByYear GET /team/{team_key}/media/{year}
TeamApi GetTeamRobots GET /team/{team_key}/robots
TeamApi GetTeamSimple GET /team/{team_key}/simple
TeamApi GetTeamSocialMedia GET /team/{team_key}/social_media
TeamApi GetTeamYearsParticipated GET /team/{team_key}/years_participated
TeamApi GetTeams GET /teams/{page_num}
TeamApi GetTeamsByYear GET /teams/{year}/{page_num}
TeamApi GetTeamsByYearKeys GET /teams/{year}/{page_num}/keys
TeamApi GetTeamsByYearSimple GET /teams/{year}/{page_num}/simple
TeamApi GetTeamsKeys GET /teams/{page_num}/keys
TeamApi GetTeamsSimple GET /teams/{page_num}/simple

Documentation for Models

Documentation for Authorization

apiKey

  • Type: API key

  • API key parameter name: X-TBA-Auth-Key

  • Location: HTTP header

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages