Trakt.NET 1.3.0

dotnet add package Trakt.NET --version 1.3.0
NuGet\Install-Package Trakt.NET -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Trakt.NET" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Trakt.NET --version 1.3.0
#r "nuget: Trakt.NET, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Trakt.NET as a Cake Addin
#addin nuget:?package=Trakt.NET&version=1.3.0

// Install Trakt.NET as a Cake Tool
#tool nuget:?package=Trakt.NET&version=1.3.0

alternate text is missing from this package README image <sup>Example output (rendered in console with Spectre.Console)</sup>

Trakt.NET

This is a .NET wrapper library for the Trakt.tv API.

NuGet Package

Project Status License PRs Welcome

Development CI-Build Release CI-Build

Code Scan Static Analysis Quality Gate Status

Features

  • Full Trakt.tv API Coverage
  • Authentication Support (OAuth 2.0 and Device)
  • Completely asynchronous
  • API Environments (Production and Sandbox)
  • Serialization Service
  • Language Service

Supported Platforms

  • .NET >= 5
  • .Net Core >= 2.0
  • .Net Framework >= 4.6.1
  • Xamarin.iOS >= 10.14
  • Xamarin.Mac >= 3.8
  • Xamarin.Android >= 8.0
  • Windows UWP >= 10.0.16299
  • Mono >= 5.4

Discussions and Issues

Do you have a question or suggestion? Start a discussion

Or do you want to report a bug? Create an issue

Contributions are welcome

Do want to contribute? See how you can contribute

Documentation


Installation

Install the latest release by running the following NuGet command

PM> Install-Package Trakt.NET

or with the NuGet Package Management in Visual Studio and search for "trakt".

Each release will also be published in Releases.


Packages

You can also get the latest built packages here: https://github.com/henrikfroehling/Trakt.NET/packages

There are three types of packages:

  • with suffix release.preview.{latest-build-number}: Latest package preview of the next upcoming planned version.
  • with suffix developer.preview.{latest-build-number}: Latest package with the latest library changes. These might not be stable.
  • without suffix: Actual released version packages.

Examples

Examples can be found here: https://github.com/henrikfroehling/Trakt.NET/tree/develop/Source/Examples


<details> <summary>Basic Usage</summary>

Create a new Trakt.NET Client

// Client ID is sufficient for usage without OAuth
var client = new TraktClient("Your Trakt Client ID");

// Both Client ID and Client Secret are required, if you need to authenticate your application
var client = new TraktClient("Your Trakt Client ID", "Your Trakt Client Secret");

// Both Client ID and Access Token are required, if you want to use requests, that require authorization
var client = new TraktClient("Your Trakt Client ID")
{
    Authorization = TraktAuthorization.CreateWith("Trakt Access Token")
};

Use your existing tokens

var client = new TraktClient("Your Trakt Client ID");

// Only access token
client.Authorization = TraktAuthorization.CreateWith("Your Access Token");

// Access Token and Refresh Token
client.Authorization = TraktAuthorization.CreateWith("Your Access Token", "Your Refresh Token");

Serialize and deserialize authorization information

ITraktAuthorization authorization = client.Authorization;

// Get JSON string from current authorization
string json = await TraktSerializationService.SerializeAsync(authorization);

// Get TraktAuthorization from JSON string
ITraktAuthorization deserializedAuthorization = await TraktSerializationService.DeserializeAsync(json);

client.Authorization = deserializedAuthorization;

// authorization == deserializedAuthorization

Configure the client

client.ClientId = "Your Trakt Client ID";
client.ClientSecret = "Your Trakt Client Secret";

client.Configuration.ApiVersion = 2; // Set by default

// Set this to true, to use Trakt API staging environment
// This is disabled by default
client.Configuration.UseSandboxEnvironment = true;

// Force authorization for requests, where authorization is optional
// This is disabled by default
client.Configuration.ForceAuthorization = true;

Get the top 10 trending shows including full information

TraktPagedResponse<ITraktTrendingShow> trendingShowsTop10 = await client.Shows.GetTrendingShowsAsync(new TraktExtendedInfo().SetFull(), null, 10);
// or
TraktPagedResponse<ITraktTrendingShow> trendingShowsTop10 = await client.Shows.GetTrendingShowsAsync(new TraktExtendedInfo() { Full = true }, 1, 10);

if (trendingShowsTop10)
{
    foreach (ITraktTrendingShow trendingShow in trendingShowsTop10)
    {
        Console.WriteLine($"Show: {trendingShow.Title} / Watchers: {trendingShow.Watchers}");
    }
}

alternate text is missing from this package README image <sup>Example output (rendered in console with Spectre.Console)</sup>


Get the top 10 trending movies including full information

var extendedInfo = new TraktExtendedInfo() { Full = true };

TraktPagedResponse<ITraktTrendingMovie> trendingMoviesTop10 = await client.Movies.GetTrendingMoviesAsync(extendedInfo, null, 10);
// or
TraktPagedResponse<ITraktTrendingMovie> trendingMoviesTop10 = await client.Movies.GetTrendingMoviesAsync(extendedInfo, 1, 10);

if (trendingMoviesTop10)
{
    foreach (ITraktTrendingMovie trendingMovie in trendingMoviesTop10)
    {
        Console.WriteLine($"Movie: {trendingMovie.Title} / Watchers: {trendingMovie.Watchers}");
    }
}

alternate text is missing from this package README image <sup>Example output (rendered in console with Spectre.Console)</sup>


Get the show 'Game of Thrones'

TraktResponse<ITraktShow> gameOfThrones = await client.Shows.GetShowAsync("game-of-thrones", new TraktExtendedInfo().SetFull());

if (gameOfThrones)
{
    ITraktShow show = gameOfThrones.Value;
    Console.WriteLine($"Title: {show.Title} / Year: {show.Year}");
    Console.WriteLine(show.Overview);
}

Get the movie 'The Martian'

TraktResponse<ITraktMovie> theMartian = await client.Movies.GetMovieAsync("the-martian-2015", new TraktExtendedInfo().SetFull());

if (theMartian)
{
    ITraktMovie movie = theMartian.Value;
    Console.WriteLine($"Title: {movie.Title} / Year: {movie.Year}");
    Console.WriteLine(show.Overview);
}

</details>


License

The MIT License (MIT)

Copyright © 2016 - 2022 Henrik Fröhling et al.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Trakt.NET:

Repository Stars
TheUltimateC0der/listrr
listrr.pro creates and maintains lists on trakt.tv completely automated based on your filters.
Version Downloads Last updated
1.3.0 2,020 11/8/2022
1.2.0 1,146 4/24/2022
1.1.1 1,785 3/16/2021
1.1.0 1,051 10/23/2020
1.0.2 925 8/18/2020
1.0.1 851 7/9/2020
1.0.0 778 6/3/2020