Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/newca12/tmdb-async-client

Scala async wrapper for TMDb (The Movie Database) API
https://github.com/newca12/tmdb-async-client

api-client api-rest asynchronous movie-database scala tmdb

Last synced: about 3 hours ago
JSON representation

Scala async wrapper for TMDb (The Movie Database) API

Awesome Lists containing this project

README

        

# TMDb-async-client
[![Actions Status](https://github.com/newca12/TMDb-async-client/workflows/Scala%20CI/badge.svg?branch=without-X-RateLimit)](https://github.com/newca12/TMDb-async-client/actions)
[![codecov.io](https://img.shields.io/codecov/c/github/newca12/TMDb-async-client.svg)](https://codecov.io/github/newca12/TMDb-async-client?branch=master)
[![Maven Central](https://img.shields.io/maven-central/v/org.edla/tmdb-async-client_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/org.edla/tmdb-async-client_2.13)

### About ###
TMDb-async-client is a native Scala SDK that provides asynchronous access to [The Movie Database][1] (TMDb) API.
It is built heavily on [akka-http][2] for async non-blocking HTTP I/O and [spray-json][3] for parsing JSON responses into Scala case classes.
[akka-stream][4] is used to allow limitation of client request frequency and number of parallel requests in respect of TMDb policies.

TMDb-async-client is an EDLA project.

The purpose of [edla.org](http://www.edla.org) is to promote the state of the art in various domains.

### API Key ###
You will need an API key to The Movie Database to access the API. To obtain a key, follow these steps:

1. Register for and verify an [account](https://www.themoviedb.org/account/signup).
2. [Log](https://www.themoviedb.org/login) into your account
3. Select the API section on left side of your account page.
4. Click on the link to generate a new API key and follow the instructions.

### Usage ###

See [Usage.scala](https://github.com/newca12/TMDb-async-client/blob/master/src/main/scala/org/edla/tmdb/client/Usage.scala) for a runnable example.

Each function returns a `Future` of the response from the TMDb API, parsed into a convenient case class.

``` scala
val apiKey = "REPLACE_THIS_WITH_YOUR_OWN_API_KEY"

val tmdbClient = TmdbClient(apiKey)

val movie = tmdbClient.getMovie(54181)

val movies = tmdbClient.searchMovie("shark")

tmdbClient.downloadPoster(movie, Paths.get("/tmp/poster.jpg"))

tmdbClient.shutdown
```

### Developers ###

API Key need to be available as an environment variable named apiKey if you want to run sbt test

### Related Projects ###

[JavaFX client for TMDb (The Movie Database) ](https://github.com/newca12/TMDb-shelf)

### License ###
© 2014-2021 Olivier ROLAND. Distributed under the GPLv3 License.

[1]: http://www.themoviedb.org/
[2]: http://doc.akka.io/docs/akka-http/current/scala/http/index.html
[3]: http://doc.akka.io/docs/akka-http/current/scala/http/common/json-support.html
[4]: http://doc.akka.io/docs/akka/2.4/scala/stream/stream-cookbook.html#Globally_limiting_the_rate_of_a_set_of_streams