FoPost.Communities (FoPost v0.1.0)

Copy Markdown View Source

The communities an account can post into.

Summary

Functions

Links a community to the account by its platform id.

The communities linked to an account.

Looks a community up on the platform without linking it.

Pulls the account's communities from the platform and stores them.

Functions

add(client, account_id, opts)

@spec add(FoPost.Client.t(), String.t(), keyword()) ::
  {:ok, FoPost.Community.t()} | {:error, FoPost.Error.t()}

Links a community to the account by its platform id.

For the case where neither search/3 nor sync/2 surfaces it. Required: :community_id. Optional: :name.

add!(client, account_id, opts)

Same as add/3, but raises FoPost.Error.

list(client, account_id)

@spec list(FoPost.Client.t(), String.t()) ::
  {:ok, [FoPost.Community.t()]} | {:error, FoPost.Error.t()}

The communities linked to an account.

list!(client, account_id)

Same as list/2, but raises FoPost.Error.

remove(client, account_id, community_id)

@spec remove(FoPost.Client.t(), String.t(), String.t() | integer()) ::
  {:ok, FoPost.Message.t()} | {:error, FoPost.Error.t()}

Unlinks a community.

community_id is the :id of a FoPost.Community, the local row id — not the platform's own community id.

remove!(client, account_id, community_id)

Same as remove/3, but raises FoPost.Error.

search(client, account_id, query)

@spec search(FoPost.Client.t(), String.t(), String.t()) ::
  {:ok, [FoPost.CommunitySearchResult.t()]} | {:error, FoPost.Error.t()}

Looks a community up on the platform without linking it.

search!(client, account_id, query)

Same as search/3, but raises FoPost.Error.

sync(client, account_id)

@spec sync(FoPost.Client.t(), String.t()) ::
  {:ok, [FoPost.Community.t()]} | {:error, FoPost.Error.t()}

Pulls the account's communities from the platform and stores them.

sync!(client, account_id)

Same as sync/2, but raises FoPost.Error.