simkl-client

API client for https://simkl.com show/movie progress tracker.

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

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

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

simkl-client
Последняя версия

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

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

simkl-client
API client for https://simkl.com show/movie progress tracker.
Ссылка на сайт

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

https://github.com/srgsf/simkl-client
Система контроля версий

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

https://github.com/srgsf/simkl-client

Скачать simkl-client

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

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.squareup.retrofit2 : retrofit jar 2.9.0
com.squareup.retrofit2 : converter-moshi jar 2.9.0

test (3)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp3 : logging-interceptor jar 3.12.0
com.squareup.okhttp3 : mockwebserver jar 3.12.0
org.junit.jupiter : junit-jupiter-engine jar 5.5.2

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

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

simkl-client

Tests License maven
A Java wrapper around https://simkl.com API using Retrofit2 and Moshi

Pull requests are welcome.

Usage

Add the following dependency to your Gradle project:

implementation 'com.github.srgsf:simkl-client:0.1'

Or for Maven:

<dependency>
  <groupId>com.github.srgsf</groupId>
  <artifactId>simkl-client</artifactId>
  <version>0.1</version>
</dependency>

Authorization

Some of SIMKL API methods can only be accessed via OAuth 2.0.

Current version supports Web Application flow and Limited Device flow. See SimklAuthClient for details.

Example of Web Application flow token request.

            HttpUrl url = SimklAuthClient.authorizationRequestUrl("<clientId>", 
                    "<redirectUrl>", 
                    "1234");
            
            // let user to sign in using url, then use <code> to get access token
            
            SimklAuthClient authClient = new SimklAuthClient.Builder()
                    .clientCredentials("<clientId>", "<clientSecret>", "<redirectUrl>")
                    .build();
            
            AccessToken token = authClient.accessToken(SimklAuthClient.GrantType.authorization_code, "<code>")
                    .body();

Example

Use like any other retrofit2 based service.
Optionally you can share OkHttp client and Retrofit instances to keep single request pooling, disk cache, routing logic, etc.

        Simkl simkl = new Simkl.Builder()
                .clientId("<clientId>")
                .tokenProvider(() -> "<token>")
                .build();
        Users usersApi = simkl.users();
        usersApi.info().enqueue(new Callback<UserInfo>() {
            @Override
            public void onResponse(Call<UserInfo> call, Response<UserInfo> response) {
                if(response.isSuccessful()) {
                    UserInfo info = response.body();
                    //use info
                }
            }

            @Override
            public void onFailure(Call<UserInfo> call, Throwable t) {
                //handle
            }
        });

See test cases in src/test/ for more examples.

Known API Issues

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

Версия
0.1