Skip to content

A simple java implementation of The Blue Alliance APIv2 using Retrofit

License

Notifications You must be signed in to change notification settings

phil-lopreiato/tba-apiv2-java

Repository files navigation

tba-apiv2-java

Build Status Coverage Status

A simple java implementation of The Blue Alliance APIv2 using Retrofit. Supports returning both synchronous data and rxjava Observables

Downloading

gradle

the jcenter() shortcut requires at least gradle 1.7

repositories {
    jcenter()
}

dependencies {
    compile 'com.plnyyanks.thebluealliance:apiv2:+'
}

maven

<repository>
    <id>jcenter</id>
    <url>https://jcenter.bintray.com/</url>
</repository>
<dependency>
    <groupId>com.plnyyanks.thebluealliance</groupId>
    <artifactId>apiv2</artifactId>
    <version>...</version>
</dependency>

Examples

It's pretty straightforward. Check the interface to see what API calls are available. Make sure you set your App Id with APIv2Helper.setAppId()

import com.plnyyanks.tba.apiv2.APIv2Helper;
import com.plnyyanks.tba.apiv2.interfaces.APIv2;
import com.plnyyanks.tba.apiv2.models.Team;

...
APIv2Helper.setAppId("plnyyanks:apitest:v0.1");
APIv2 api = APIv2Helper.getAPI();
Team uberbots = api.fetchTeam("frc1124", null); // Add 'If-Modified-Since' header (String) as the second parameter
System.out.println("Got team with key: "+team.getKey());

If you instead want to have an Observable returned, the syntax is very similar.

import com.plnyyanks.tba.apiv2.APIv2Helper;
import com.plnyyanks.tba.apiv2.interfaces.ObservableAPIv2;
import com.plnyyanks.tba.apiv2.models.Team;

...
APIv2Helper.setAppId("plnyyanks:apitest:v0.1");
APIv2 api = APIv2Helper.getObservableAPI();
api.fetchTeamObservable("frc1124", null).subscribe(new Action1<Team>() {
            @Override
            public void call(Team team) {
                System.out.println("Got team with key: "+team.getKey());
            }
        });

License

This library is released under the MIT License. See LICENSE.md for full details

About

A simple java implementation of The Blue Alliance APIv2 using Retrofit

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages