/tvmaze-java

A Java wrapper for the TvMaze API

Primary LanguageJavaMIT LicenseMIT

tvmaze-java

CircleCI Download

A Java wrapper for the TvMaze API

Built with Retrofit2 and lombok

Code for the models is based on https://github.com/RNGuy/TVMaze

Usage

TvMaze is a singleton that you can retrieve with TvMaze.getInstance()

To get a list of all supported endpoints, look at TvMazeApi.java

  • To search for a show by name:

     try {
         Response<List<Result<Show>>> showsResponse = TvMaze.getInstance().searchShows(name).execute();
         if (showsResponse.isSuccessful()) {
             List<Result<Show>> shows = showsResponse.body();
             if (shows != null) {
                 return shows.stream().map(Result::getShow).collect(Collectors.toList());
             }
         }
     } catch (IOException e) {
         // Handle error
     }
  • To find a list of episodes in a show:

    try {
        Response<List<Episode>> response = TvMaze.getInstance().getEpisodes(id).execute();
        if (response.isSuccessful()) {
            return response.body();
        }
    } catch (IOException e) {
        // Handle error
    }

TODO

Not all endpoints are supported yet

  • Show Lookup
  • Schedule
  • Embeds