thetvdb v1.2.0 TheTVDB.User

This module contains access to all user-scoped endpoints.

All functions allow the user to specify an optional username. If no username is specified, the last authenticated user will be used. See TheTVDB for more information.

Link to this section Summary

Link to this section Types

Link to this type

rating_type()

Specs

rating_type() :: :series | :episode | :image

Specs

t() :: %TheTVDB.User{
  favorites_displaymode: term(),
  language: term(),
  user_name: term()
}

Specs

username() :: String.t() | nil

Link to this section Functions

Link to this function

add_favorite(username \\ nil, series_id)

Specs

add_favorite(username(), integer()) :: :ok | {:error, term()}

Add a favorite series for a given user.

Link to this function

add_favorite!(username \\ nil, series_id)

Specs

add_favorite!(username(), integer()) :: :ok

See add_favorite/2.

Link to this function

add_rating(username \\ nil, type, item, rating)

Specs

add_rating(username(), rating_type(), integer(), integer()) ::
  :ok | {:error, term()}

Add a rating for a given user.

# Rate a series
TheTVDB.User.add_rating(:series, series_id, 10.0)
# => :ok

# Rate an episode
TheTVDB.User.add_rating(:episode, episode_id, 10.0)
# => :ok

# Rate an image
TheTVDB.User.add_rating(:image, image_id, 10.0)
# => :ok
Link to this function

add_rating!(username \\ nil, type, item, rating)

Specs

add_rating!(username(), rating_type(), integer(), integer()) :: :ok

See add_rating/4.

Link to this function

favorites(username \\ nil)

Specs

favorites(username()) :: {:ok, [binary()]} | {:error, term()}

Get a list of all favorited series for a given user.

Link to this function

favorites!(username \\ nil)

Specs

favorites!(username()) :: [binary()]

See favorites/1.

Link to this function

info(username \\ nil)

Specs

info(username()) :: {:ok, t()} | {:error, term()}

Get info about a user.

Link to this function

info!(username \\ nil)

Specs

info!(username()) :: t()

See info/1.

Link to this function

ratings(username \\ nil)

Specs

ratings(username()) :: {:ok, [TheTVDB.User.Rating.t()]}

Get a list of all ratings for a given user.

Link to this function

ratings!(username \\ nil)

Specs

ratings!(username()) :: [TheTVDB.User.Rating.t()]

See ratings/1.

Link to this function

remove_favorite(username \\ nil, series_id)

Specs

remove_favorite(username(), integer()) :: :ok | {:error, term()}

Remove a favorite series for a given user.

Link to this function

remove_favorite!(username \\ nil, series_id)

Specs

remove_favorite!(username(), integer()) :: :ok

See remove_favorite/2.

Link to this function

remove_rating(username \\ nil, type, item)

Specs

remove_rating(username(), rating_type(), integer()) :: :ok | {:error, term()}

Remove a rating for a given user.

Link to this function

remove_rating!(username, type, item)

Specs

remove_rating!(username(), rating_type(), integer()) :: :ok

See remove_rating/3.