trakt-java

A Java wrapper around the trakt v2 API using retrofit.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

com.uwetrottmann
Идентификатор

Идентификатор

trakt-java
Последняя версия

Последняя версия

4.6.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

trakt-java
A Java wrapper around the trakt v2 API using retrofit.
Ссылка на сайт

Ссылка на сайт

https://github.com/UweTrottmann/trakt-java/
Система контроля версий

Система контроля версий

https://github.com/UweTrottmann/trakt-java

Скачать trakt-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.uwetrottmann/trakt-java/ -->
<dependency>
    <groupId>com.uwetrottmann</groupId>
    <artifactId>trakt-java</artifactId>
    <version>4.6.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.uwetrottmann/trakt-java/
implementation 'com.uwetrottmann:trakt-java:4.6.2'
// https://jarcasting.com/artifacts/com.uwetrottmann/trakt-java/
implementation ("com.uwetrottmann:trakt-java:4.6.2")
'com.uwetrottmann:trakt-java:jar:4.6.2'
<dependency org="com.uwetrottmann" name="trakt-java" rev="4.6.2">
  <artifact name="trakt-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.uwetrottmann', module='trakt-java', version='4.6.2')
)
libraryDependencies += "com.uwetrottmann" % "trakt-java" % "4.6.2"
[com.uwetrottmann/trakt-java "4.6.2"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit : retrofit jar 1.9.0
com.jakewharton.retrofit : retrofit1-okhttp3-client jar 1.1.0
org.apache.oltu.oauth2 : org.apache.oltu.oauth2.client jar 1.0.0
joda-time : joda-time jar 2.9.1

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 1.7.1
org.assertj : assertj-joda-time jar 1.1.0

Модули Проекта

Данный проект не имеет модулей.

trakt-java

A Java wrapper around the Trakt v2 API using retrofit 2.

Pull requests are welcome.

Trakt methods are grouped into service objects which can be centrally managed by a TraktV2 instance. It will act as a factory for all of the services and will automatically initialize them with your API key (OAuth client id) and optionally a given user access token.

Usage

Available on Maven Central

Add the following dependency to your Gradle project:

implementation 'com.uwetrottmann.trakt5:trakt-java:6.8.0'

Or for Maven:

<dependency>
  <groupId>com.uwetrottmann.trakt5</groupId>
  <artifactId>trakt-java</artifactId>
  <version>6.8.0</version>
</dependency>

Android

This library ships Java 8 bytecode. This requires Android Gradle Plugin 3.2.x or newer.

This library depends on threetenbp. To avoid issues on Android you should exclude this dependency and include ThreeTenABP instead:

implementation ('com.uwetrottmann.trakt5:trakt-java:<latest-version>') {
  exclude group: 'org.threeten', module: 'threetenbp'
}
implementation 'com.jakewharton.threetenabp:threetenabp:<latest-version>'

Example

Use like any other retrofit2 based service. You only need to supply your OAuth 2.0 credentials and optional user OAuth access token obtained from Trakt.

TraktV2 provides some helper methods to handle the OAuth 2.0 flow.

TraktV2 trakt = new TraktV2("api_key");
Shows traktShows = trakt.shows();
try {
    // Get trending shows
    Response<List<TrendingShow>> response = traktShows.trending(1, null, Extended.FULL).execute();
    if (response.isSuccessful()) {
        List<TrendingShow> shows = response.body();
        for (TrendingShow trending : shows) {
            System.out.println("Title: " + trending.show.title);
        }
    } else {
        if (response.code() == 401) {
            // authorization required, supply a valid OAuth access token
        } else {
            // the request failed for some other reason
        }
    }
} catch (Exception e) {
    // see execute() javadoc 
}

See test cases in src/test/ for more examples and the retrofit website for configuration options.

Use Proguard, R8!

It is likely not every method in this library is used, so it is probably useful to strip unused ones with Proguard. Apply the Proguard rules for retrofit.

Due to R8 being very eager in stripping unused fields even if they are set by a constructor, prevent entities from getting optimized. Obviously they also should not be obfuscated.

-keep class com.uwetrottmann.trakt5.entities.** { *; }
-keep class com.uwetrottmann.trakt5.enums.** { *; }

License

This work by Uwe Trottmann is licensed under the Apache License 2.0.

Contributors and changes are tracked by Git.

Do not just copy, make it better.

Версии библиотеки

Версия
4.6.2
4.6.1
4.6.0
4.5.4
4.5.3
4.5.2
4.5.1
4.5.0
4.4.0
4.3.1
4.3.0
4.2.1
4.2.0
4.1.0
4.0.3
4.0.2
4.0.1
4.0.0
3.4.0
3.3.1
3.3.0
3.2.1
3.2.0
3.1.0