🍿 @lorenzopant/tmdb

Add Favorite

Mark a movie or TV show as a favourite, or remove it.

Mark a movie or TV show as a favourite for a given account. Pass favorite: false to remove an existing favourite.

async add_favorite(params: AccountMutationParams, body: AccountAddFavoriteBody): Promise<AccountMutationResponse>

TMDB Reference: Add Favorite

Parameters

NameTypeRequiredDescription
account_idnumberThe TMDB account ID.
session_idstringSession ID for v3 session-based authentication.

Request Body

NameTypeRequiredDescription
media_type"movie" | "tv"The type of media to favourite.
media_idnumberThe TMDB ID of the movie or TV show.
favoritebooleantrue to add, false to remove.

Returns

AccountMutationResponse

Errors

Errors are thrown as TMDBError and are never part of the return type:

HTTPTMDB codeCause
4013Invalid or missing access token.
4017Invalid session_id.
40434Account or media item not found.
42247Malformed request body (e.g. invalid JSON, wrong types).

Example

import { TMDB } from "@lorenzopant/tmdb";

const tmdb = new TMDB("your-access-token");

// Add to favourites
await tmdb.account.add_favorite({ account_id: 123 }, { media_type: "movie", media_id: 550, favorite: true });

// Remove from favourites
await tmdb.account.add_favorite({ account_id: 123 }, { media_type: "movie", media_id: 550, favorite: false });

On this page