-
Notifications
You must be signed in to change notification settings - Fork 4
Overview
TBA-API-V3 is a Java implementation for the API found at https://www.thebluealliance.com/apidocs/v3. There doesn't appear to be any other APIs up yet, so here's the TBA-API-V3.
Project Structure
Where's all the getters and setters?!? They're magically appearing! Exactly. It's super great. This project uses
lombok, which means that by simply using the @Data annotation, all the getters and setters get automagically generated!
The API is organized to help you keep track of the plethora of API calls. If you look on the https://www.thebluealliance.com/apidocs/v3, you'll notice that all the API calls begin with /event(s)
, /team(s)
, /district(s)
, /match(s)
, or /status
. Each of these groups of API calls corresponds to a class in the requests
package such as EventRequest
or TeamRequest
. These are the fundamental classes that are used to interact with the API.
All of the models in Java form can be found in the package /models
, you'll find three more packages -- /other
, /simple
, and /standard
. /standard
stores the full models, /simple
stores simplified models (according to the new V3 specifications) and /other
stores various other models that are less frequently used, such as the Robot
model. Most of the packages within /other
should be self explanatory.
Within Utils
you'll find the IO
, Parser
, and Utils
classes, IO
manages the HTTPConnection
with thebluealliance, Parser
converts JSON
strings into the Java models, and Utils
has various helper methods. If the API contains a bug, this will most likely be in Parser
. If you do find a bug, let me know right away at [email protected]
and I'll have a fix up for you lickidy split.
Alright, now to the good stuff. The classes in /main
are the ones you'll be using the most. More specifically, TBA
and CTBA
will be the most frequently used classes. TBA
and CTBA
combine all requests found in /requests
into one class, to make it easier for you to use the API because you don't have to sift through multiple classes. TBA
has no global variable or parameter constructors, this means TBA
is useful if you plan on changing parameters a lot. For example, let's say you're pulling data for a list of teams - 1, 2, 3, 4 - you wouldn't want to create a new object each time to pull data, so TBA
makes that easier for you. TBA
is also the most consistent with the API documentation found on https://www.thebluealliance.com, and you'll find a Mirror of:
javadoc
comment above every method describing which method from the API it's calling. CTBA
allows you to set global variables with constructors & getters / setters. This is useful if you have parameters that aren't likely to change, but you need to make multiple calls for those parameters. For example, let's say you have team 1 and you need to get a list of events that team is in, the team's general info, and their OPRs, CTBA
would handle that nicely. It's really a matter of preference.