View Source Mobilizon.Medias (Mobilizon v5.0.0-beta.1)

The Media context.

Summary

Functions

Creates a media.

Get all media by an URL.

Gets a single media.

Gets a single media. Raises Ecto.NoResultsError if the media does not exist.

Get a media by its URL.

Calculate the sum of media size used by the user

Calculate the sum of media size used by the user

List the paginated media for user

Functions

Link to this function

create_media(attrs \\ %{})

View Source
@spec create_media(map()) ::
  {:ok, Mobilizon.Medias.Media.t()} | {:error, Ecto.Changeset.t()}

Creates a media.

Link to this function

delete_media(media, opts \\ [])

View Source

Deletes a media.

Link to this function

delete_user_profile_media_by_url(url)

View Source
@spec delete_user_profile_media_by_url(String.t()) ::
  {:ok, String.t() | :ignored} | {:error, atom()}
Link to this function

find_media_to_clean(opts)

View Source
@spec find_media_to_clean(Keyword.t()) :: [[Mobilizon.Medias.Media.t()]]
Link to this function

get_all_media_by_url(url)

View Source
@spec get_all_media_by_url(String.t()) :: Mobilizon.Medias.Media.t() | nil

Get all media by an URL.

@spec get_media(integer() | String.t()) :: Mobilizon.Medias.Media.t() | nil

Gets a single media.

@spec get_media!(integer() | String.t()) :: Mobilizon.Medias.Media.t()

Gets a single media. Raises Ecto.NoResultsError if the media does not exist.

@spec get_media_by_url(String.t()) :: Mobilizon.Medias.Media.t() | nil

Get a media by its URL.

Link to this function

media_size_for_actor(actor_id)

View Source
@spec media_size_for_actor(integer() | String.t()) :: integer()

Calculate the sum of media size used by the user

Link to this function

media_size_for_user(user_id)

View Source
@spec media_size_for_user(integer() | String.t()) :: integer()

Calculate the sum of media size used by the user

Link to this function

medias_for_user(user_id, page, limit)

View Source
@spec medias_for_user(integer() | String.t(), integer() | nil, integer() | nil) ::
  Mobilizon.Storage.Page.t(Mobilizon.Medias.Media.t())

List the paginated media for user