Skip to content

tryterra/terra-client-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub license test docs Maven Central

Terra Java Client Library

The official Terra Java client library.

Installation

Requirements

  • Java 11 or later

Gradle users

Add this dependency to your project's build file:

implementation "co.tryterra:terra-client:<version>"

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>co.tryterra</groupId>
    <artifactId>terra-client</artifactId>
    <version>${terra-client.version}</version>
</dependency>

Usage

TerraExample.java

import co.tryterra.terraclient.TerraClientFactory;
import co.tryterra.terraclient.api.TerraApiResponse;
import co.tryterra.terraclient.api.TerraClientV2;
import co.tryterra.terraclient.api.User;
import co.tryterra.terraclient.exceptions.TerraRuntimeException;
import co.tryterra.terraclient.models.Athlete;

public class TerraExample {
    public static void main(String[] args) {
        TerraClientV2 client = TerraClientFactory.getClientV2("YOUR_API_KEY", "YOUR_DEV_ID");

        try {
            User user = client.getUser("YOUR_USER_ID");
            TerraApiResponse<Athlete> response = client.getActivityForUser(user);
            System.out.println(response.getParsedData());
        } catch (TerraRuntimeException ex) {
            ex.printStackTrace();
        }
    }
}

Packages

No packages published

Contributors 9

Languages