View Source Plausible.Sites (Plausible v0.0.1)
Summary
Functions
Invites a new team member to the given site. Returns a %Plausible.Auth.Invitation{} struct and sends the invitee an email to accept this invitation.
Returns the date of the first event of the given site, or nil
if the site
does not have stats yet.
Functions
get_for_user!(user_id, domain, roles \\ [:owner, :admin, :viewer])
View Source@spec invite(Plausible.Site.t(), Plausible.Auth.User.t(), String.t(), atom()) :: {:ok, Plausible.Auth.Invitation.t()} | {:error, Ecto.Changeset.t()} | {:error, :already_a_member} | {:error, {:over_limit, non_neg_integer()}} | {:error, :forbidden}
Invites a new team member to the given site. Returns a %Plausible.Auth.Invitation{} struct and sends the invitee an email to accept this invitation.
The inviter must have enough permissions to invite the new team member,
otherwise this function returns {:error, :forbidden}
.
If the new team member role is :owner
, this function handles the invitation
as an ownership transfer and requires the inviter to be the owner of the site.
@spec stats_start_date(Plausible.Site.t()) :: Date.t() | nil
Returns the date of the first event of the given site, or nil
if the site
does not have stats yet.
If this is the first time the function is called for the site, it queries Clickhouse and saves the date in the sites table.