{"id":18419594,"url":"https://github.com/uwetrottmann/trakt-java","last_synced_at":"2025-05-16T15:07:56.726Z","repository":{"id":1978136,"uuid":"2909723","full_name":"UweTrottmann/trakt-java","owner":"UweTrottmann","description":"An (unofficial) Java library to use the Trakt v2 API built with retrofit 2","archived":false,"fork":false,"pushed_at":"2025-04-01T10:43:13.000Z","size":1699,"stargazers_count":99,"open_issues_count":4,"forks_count":41,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-16T15:07:50.412Z","etag":null,"topics":["java","retrofit2","trakt-api"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"JakeWharton/trakt-java","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UweTrottmann.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-12-04T10:43:04.000Z","updated_at":"2025-03-14T00:12:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"c051f741-174c-4590-ba00-2c85a793e14d","html_url":"https://github.com/UweTrottmann/trakt-java","commit_stats":{"total_commits":941,"total_committers":27,"mean_commits":"34.851851851851855","dds":0.5079702444208289,"last_synced_commit":"864cda2eac183dc3e7d8fa36c4ad1943f039ffe7"},"previous_names":[],"tags_count":71,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UweTrottmann%2Ftrakt-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UweTrottmann%2Ftrakt-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UweTrottmann%2Ftrakt-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UweTrottmann%2Ftrakt-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UweTrottmann","download_url":"https://codeload.github.com/UweTrottmann/trakt-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553958,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","retrofit2","trakt-api"],"created_at":"2024-11-06T04:17:31.990Z","updated_at":"2025-05-16T15:07:51.710Z","avatar_url":"https://github.com/UweTrottmann.png","language":"Java","readme":"# trakt-java\n\n**[Pull requests](CONTRIBUTING.md) (e.g. support for more API endpoints, bug fixes) are welcome!**\n\nAn (unofficial) Java library to use the [Trakt v2 API](https://trakt.docs.apiary.io/) built with [retrofit 2](https://square.github.io/retrofit/).\n\nTrakt API methods are grouped into [service objects](src/main/java/com/uwetrottmann/trakt5/services) \nwhich can be centrally managed by a [TraktV2](src/main/java/com/uwetrottmann/trakt5/TraktV2.java) instance.\nIt will act as a factory for all the services and will automatically initialize them with the given\nAPI key (OAuth client id) and optionally a given user access token.\n\n## Usage\n\n\u003ca href=\"https://central.sonatype.com/search?q=g:com.uwetrottmann.trakt5\"\u003eAvailable on Maven Central\u003c/a\u003e\n\n[Change Log](CHANGELOG.md)\n\nAdd the following dependency to your Gradle project:\n\n```kotlin\nimplementation(\"com.uwetrottmann.trakt5:trakt-java:6.16.0\")\n```\n\nOr for Maven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.uwetrottmann.trakt5\u003c/groupId\u003e\n  \u003cartifactId\u003etrakt-java\u003c/artifactId\u003e\n  \u003cversion\u003e6.16.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Android\n\nThis library ships Java 8 bytecode. This requires Android Gradle Plugin 3.2.x or newer.\n\nThis library depends on [threetenbp](https://github.com/ThreeTen/threetenbp). To avoid \n[issues on Android](https://github.com/JakeWharton/ThreeTenABP#why-not-use-threetenbp) exclude the \ndependency and include [ThreeTenABP](https://github.com/JakeWharton/ThreeTenABP) instead:\n\n```kotlin\nimplementation(\"com.uwetrottmann.trakt5:trakt-java:\u003clatest-version\u003e\") {\n  exclude(group = \"org.threeten\", module = \"threetenbp\") // using ThreeTenABP instead\n}\nimplementation(\"com.jakewharton.threetenabp:threetenabp:\u003clatest-version\u003e\")\n```\n\n### Example\n\nUse like any other retrofit2 based service. At least a Trakt API key, which for Trakt is currently the same as the \n[OAuth 2.0](https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2) client ID,\nhas to be supplied. Optionally, a user OAuth `accessToken(token)` can be supplied.\n\nSee the [TraktV2](src/main/java/com/uwetrottmann/trakt5/TraktV2.java) class for some helper methods to handle the OAuth flow.\n\n```java\nTraktV2 trakt = new TraktV2(\"api_key\");\nShows traktShows = trakt.shows();\ntry {\n    // Get trending shows\n    Response\u003cList\u003cTrendingShow\u003e\u003e response = traktShows.trending(1, null, Extended.FULL).execute();\n    if (response.isSuccessful()) {\n        List\u003cTrendingShow\u003e shows = response.body();\n        for (TrendingShow trending : shows) {\n            System.out.println(\"Title: \" + trending.show.title);\n        }\n    } else {\n        if (TraktV2.isUnauthorized(response)) {\n            // authorization required, supply a valid OAuth access token\n        } else {\n            // the request failed for some other reason\n        }\n    }\n} catch (Exception e) {\n    // see execute() API docs \n}\n```\n\n**For Kotlin**, to make a `Call` suspend use retrofit's `awaitResponse()` instead of `execute()`:\n\n```kotlin\ntry {\n    val response = traktShows.trending(1, null, Extended.FULL).awaitResponse()\n    if (response.isSuccessful) {\n        val shows = response.body()\n    }\n} catch (e: Exception) {\n    // see execute() API docs\n}\n```\n\nSee test cases in `src/test/` for more examples and the [retrofit website](https://square.github.io/retrofit/) for configuration options.\n\n## Proguard / R8\n\nIt is likely not every method in this library is used, so it is probably useful to strip unused ones with Proguard.\nApply the [Proguard rules for retrofit](https://square.github.io/retrofit/#download).\n\nThe specific rules for this library are [already bundled](src/main/resources/META-INF/proguard/trakt-java.pro) into the\nrelease which can be interpreted by R8 automatically, ProGuard users must manually add the rules.\n\n## License\n\nThis work by [Uwe Trottmann](https://uwetrottmann.com) is licensed under the [Apache License 2.0](LICENSE.txt).\n\n[Contributors](https://github.com/UweTrottmann/trakt-java/graphs/contributors) and changes are tracked by Git.\n\nDo not just copy, make it better.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwetrottmann%2Ftrakt-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuwetrottmann%2Ftrakt-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwetrottmann%2Ftrakt-java/lists"}