No description
Find a file
Jeffrey Morris c914097dfd work on v2
2021-11-19 20:09:33 -06:00
src/main/java/com/github/daflamingfox work on v2 2021-11-19 20:09:33 -06:00
.gitignore work on v2 2021-11-19 20:09:33 -06:00
LICENSE Initial commit 2021-06-19 21:32:44 -05:00
pom.xml Initial Maven 2021-06-26 09:39:13 -05:00
README.md updated README 2021-06-27 10:30:49 -05:00

The Blue Alliance Java api wrapper

A simple, easy-to-use, api wrapper for TBA's api.



Getting started

This api wrapper is designed to be as simple as possible; to get started you need an api token from TBA. You can get one here, you can make a new key by scrolling down to where it says Read API Keys. Once you make a new key, copy the X-TBA-Auth-Key value, that's the important part.

The next step is to create an instance of TBAApi in your code, you are going to need your api key for this part; it should look as follows:

public class Main {
    public static void main(String[] args) {
        // Create a new instance of The Blue Alliance Api.
        TBAApi api = new TBAApi("your-api-read-key");
    }
}

Thats it; api instance created. All of the methods are within nested classes of the api (TBA, lists, team, event, match, and district), so for instance; to get the TBA status; you can do as follows:

// ...
// Gets an APIStatus object from the api.
APIStatus apiStatus = api.TBA.getStatus(); 
// ...

All info that the object contain are stored as public class attributes; so you can get the data from them without a method.

// ...
// All of the objects contain their data as attributes.
apiStatus.isDataFeedDown // -> false (returns true if FRC datafeed is down)
// ...

All of this is pretty simple, so it only takes two lines of code to get the data:

public class Main {
    public static void main(String[] args) {
        // Create a new instance of The Blue Alliance Api.
        TBAApi api = new TBAApi("your-api-read-key");
        System.out.println(api.TBA.getStatus().isDataFeedDown); // -> false
    }
}

If you have any issues or questions please create an issue; and we'll have a look at your problem.


Contributors

Project created by Jeffrey Morris (7125).


Powerd by The Blue Alliance