View Source Mobilizon.Posts (Mobilizon v4.1.0-alpha.1)

The Posts context.

Summary

Functions

Link to this function

create_post(attrs \\ %{})

View Source
@spec create_post(map()) ::
  {:ok, Mobilizon.Posts.Post.t()} | {:error, Ecto.Changeset.t()}

Creates a post.

@spec delete_post(Mobilizon.Posts.Post.t()) ::
  {:ok, Mobilizon.Posts.Post.t()} | {:error, Ecto.Changeset.t()}

Deletes a post

@spec get_post(integer() | String.t()) :: Mobilizon.Posts.Post.t() | nil

Get a post by it's ID

Link to this function

get_post_by_slug_with_preloads(slug)

View Source
@spec get_post_by_slug_with_preloads(String.t()) :: Mobilizon.Posts.Post.t() | nil
@spec get_post_by_url(String.t()) :: Mobilizon.Posts.Post.t() | nil

Get a post by it's URL

Link to this function

get_post_by_url_with_preloads(url)

View Source
@spec get_post_by_url_with_preloads(String.t()) :: Mobilizon.Posts.Post.t() | nil
Link to this function

get_post_with_preloads(id)

View Source
@spec get_post_with_preloads(integer() | String.t()) :: Mobilizon.Posts.Post.t() | nil
Link to this function

get_posts_for_group(actor, page \\ nil, limit \\ nil)

View Source
@spec get_posts_for_group(
  Mobilizon.Actors.Actor.t(),
  integer() | nil,
  integer() | nil
) ::
  Mobilizon.Storage.Page.t(Mobilizon.Posts.Post.t())

Returns the list of recent posts for a group

Link to this function

get_public_posts_for_group(actor, page \\ nil, limit \\ nil)

View Source
@spec get_public_posts_for_group(
  Mobilizon.Actors.Actor.t(),
  integer() | nil,
  integer() | nil
) ::
  Mobilizon.Storage.Page.t(Mobilizon.Posts.Post.t())
@spec list_posts_for_stream() :: Enum.t()
Link to this function

list_public_local_posts(page \\ nil, limit \\ nil, sort \\ nil, direction \\ nil)

View Source
@spec list_public_local_posts(
  integer() | nil,
  integer() | nil,
  atom() | nil,
  atom() | nil
) ::
  Mobilizon.Storage.Page.t(Mobilizon.Posts.Post.t())
Link to this function

list_tags_for_post(post_id)

View Source
@spec list_tags_for_post(integer() | String.t()) :: [Mobilizon.Events.Tag.t()]

Returns the list of tags for the post.

Link to this function

order_posts(query, sort, direction)

View Source
@spec order_posts(Ecto.Queryable.t(), atom() | nil, atom() | nil) ::
  Ecto.Queryable.t()
Link to this function

update_post(post, attrs)

View Source
@spec update_post(Mobilizon.Posts.Post.t(), map()) ::
  {:ok, Mobilizon.Posts.Post.t()} | {:error, Ecto.Changeset.t()}

Updates a post.