FoPost.Accounts (FoPost v0.1.0)

Copy Markdown View Source

Connected social accounts — what a post is actually delivered to.

Accounts on platforms that use OAuth are connected in the FoPost dashboard; create/2 is for the platforms where you already hold the credentials.

Summary

Functions

An account's stored follower snapshots, newest first.

Connects an account from credentials you already hold.

Disconnects an account.

One account.

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

One account's health.

Every reachable account's health, optionally narrowed with :workspace_id.

The connected accounts the key can reach, optionally narrowed with :workspace_id.

Renews an account's OAuth token ahead of its expiry.

Makes this the account that leads its platform in the workspace.

Checks an account's stored credentials against the platform.

Functions

analytics(client, id, opts \\ [])

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

An account's stored follower snapshots, newest first.

:limit caps how many come back; leaving it out keeps the API's own default.

analytics!(client, id, opts \\ [])

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

create(client, opts)

@spec create(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Account.t()} | {:error, FoPost.Error.t()}

Connects an account from credentials you already hold.

Required: :workspace_id, :platform, :username, :name. Optional: :avatar, :credentials — a map of the platform's own fields.

create!(client, opts)

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

delete(client, id)

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

Disconnects an account.

delete!(client, id)

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

get(client, id)

@spec get(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.Account.t()} | {:error, FoPost.Error.t()}

One account.

get!(client, id)

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

health(client, id, opts \\ [])

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

One account's health.

Pass refresh: true to check it live rather than reading the last stored result.

health!(client, id, opts \\ [])

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

health_summary(client, opts \\ [])

@spec health_summary(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.HealthSummary.t()} | {:error, FoPost.Error.t()}

Every reachable account's health, optionally narrowed with :workspace_id.

health_summary!(client, opts \\ [])

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

list(client, opts \\ [])

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

The connected accounts the key can reach, optionally narrowed with :workspace_id.

list!(client, opts \\ [])

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

refresh_token(client, id)

@spec refresh_token(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.TokenRefresh.t()} | {:error, FoPost.Error.t()}

Renews an account's OAuth token ahead of its expiry.

refresh_token!(client, id)

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

set_primary(client, id)

@spec set_primary(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.Account.t()} | {:error, FoPost.Error.t()}

Makes this the account that leads its platform in the workspace.

set_primary!(client, id)

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

validate(client, id)

@spec validate(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.ValidationResult.t()} | {:error, FoPost.Error.t()}

Checks an account's stored credentials against the platform.

validate!(client, id)

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