Skip to content

Latest commit

 

History

178 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn


The TVDB Logo
tvmaze.com

tvmaze-java-client

A client to access the TVMaze API
Maven Project Info - Javadoc
Report Bug - Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Recipes
  4. Contributing
  5. License
  6. Contact

About The Project

An easy-to-use java client to access the TVMaze API for programmatic access to TV show, episode and cast/crew information.

Getting Started

Include this package as a dependency in your project. Note: This package is published to both GitHub and Maven Central repositories.

<dependency>
    <groupId>com.amilesend</groupId>
    <artifactId>tvmaze-java-client</artifactId>
    <version>2.2.5</version>
</dependency>

Recipes

Instantiation

Default:

TvMaze client = new TvMaze();
SearchApi searchApi = client.getSearchApi();
List<ShowResult> results = searchApi.searchShows("friends");

With a RetryStrategy:

TvMaze client = new TvMaze(new DefaultConnectionBuilder()
        .httpClient(new OkHttpClient())
        .baseUrl(TvMaze.API_URL)
        .userAgent(TvMaze.USER_AGENT)
        .authManager(new NoOpAuthManager())
        .gsonFactory(new GsonFactory())
        .isGzipContentEncodingEnabled(true)
        // Options are ExponentialDelayRetryStrategy, FixedDelayRetryStrategy
        // or NoRetryStrategy (default).
        .retryStrategy(ExponentialDelayRetryStrategy.builder()
                .baseDelayMs(500L)
                .maxJitterMs(100L)
                .maxAttempts(3)
                .maxTotalDelayMs(2000L)
                .build())
        .build());

Customizing the HTTP client configuration

OkHttpClientBuilder example

If your use-case requires configuring the underlying OkHttpClient instance (e.g., configuring your own SSL cert verification, proxy, and/or connection timeouts), you can configure the client with the provided OkHttpClientBuilder, or alternatively with OkHttp's builder.

OkHttpClient httpClient = OkHttpClientBuilder.builder()
        .trustManager(myX509TrustManager) // Custom trust manager for self/internally signed SSL/TLS certs
        .hostnameVerifier(myHostnameVerifier) // Custom hostname verification for SSL/TLS endpoints
        .addInterceptor(myInterceptor) // Custom okhttp interceptor (e.g., logging)
        .proxy(myProxy, myProxyUsername, myProxyPassword) // Proxy config
        .connectTimeout(8000L) // connection timeout in milliseconds
        .readTimeout(5000L) // read timeout in milliseconds
        .writeTimeout(5000L) // write timeout in milliseconds
        .build();
Connection connection = Connection.builder()
        .httpClient(httpClient)
        .gsonFactory(GsonFactory.getInstance())
        .build();
TvMaze client = new TvMaze(connection);

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPLv3 license. See LICENSE for more information.

Contact

Andy Miles - andy.miles (at) amilesend.com

Project Link: https://github.com/andy-miles/tvmaze-java-client

About

A client to access the TVMaze API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages