Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

mixer/beam-client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mixer-java Build Status

This is the official Java client for the mixer.com API. It currently supports v1 and is a work in progress.

Documentation

Confused about a method's intent? Not sure where to get a piece of information? Our Javadocs are the place to go! That link contains the most up-to-date docs for this API client.

Including beam-client-java in your Project

We use Maven to build Mixer's Java client. Once you have Maven installed, there are a few steps to getting the client in your classpath.

Our Maven Artifacts are published to GitHub's Package Registry, so you'll need to set that up.

First in your project, add the appropriate repository section to your pom.xml as a <repository> as follows:

<repositories>
  <repository>
    <id>github</id>
    <name>GitHub Mixer Client Java Apache Maven Packages</name>
    <url>https://maven.pkg.github.com/mixer/beam-client-java</url>
  </repository>
</repositories>

And secondly, add this project as a dependency in your pom.xml:

<dependencies>
  <dependency>
    <groupId>com.mixer</groupId>
    <artifactId>api</artifactId>
    <version>6.0.0</version>
  </dependency>
</dependencies>

The last thing you'll need to do is authenticate with GitHub's Package Registry as it currently does not support Anonymous Access. You can do this by adding some settings to your ~/.m2/settings.xml file:

  • USERNAME should be your GitHub Username
  • Token should be a personal access token with the read:packages scope.
<servers>
  <server>
    <id>github</id>
    <username>USERNAME</username>
    <password>TOKEN</password>
  </server>
</servers>

You can read more about this process on Github's Help page

Once these steps are completed, you should have the client on your classpath, and are set to get programming!

Example:

Here, an example of how to use the built-in Future callback system provided in Guava follows. In this example, we'll construct the Mixer API, and then get a list of all channel IDs.

// Construct an instance of the Mixer API such that we can query certain
// endpoints for data.
MixerAPI mixer = new MixerAPI();

// Invoke the `UsersService.class` in order to access the methods within
// that service.  Then, assign a callback using Guava's FutureCallback
// class so we can act on the response.
Futures.addCallback(mixer.use(UsersService.class).search("tta"), new ResponseHandler<UserSearchResponse>() {
    // Set up a handler for the response
    @Override public void onSuccess(UserSearchResponse response) {
        for (MixerUser user : response) {
            System.out.println(user.username);
        }
    }
});

Developing

Docs

To build and publish the docs run: mvn javadoc:javadoc scm-publish:publish-scm