mobilizon/lib/mobilizon_web/api/comments.ex

32 lines
701 B
Elixir
Raw Normal View History

defmodule MobilizonWeb.API.Comments do
@moduledoc """
2019-09-22 16:26:23 +02:00
API for Comments.
"""
alias Mobilizon.Events.Comment
2020-01-22 02:14:42 +01:00
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Activity
@doc """
Create a comment
Creates a comment from an actor
"""
@spec create_comment(map()) ::
{:ok, Activity.t(), Comment.t()} | any()
def create_comment(args) do
ActivityPub.create(:comment, args, true)
end
@doc """
Deletes a comment
Deletes a comment from an actor
"""
@spec delete_comment(Comment.t()) ::
{:ok, Activity.t(), Comment.t()} | any()
def delete_comment(%Comment{} = comment) do
ActivityPub.delete(comment, true)
end
end