View Source Franklin.Articles.Commands.CreateArticle (Franklin v0.1.0)
A command to represent the user intent of creating a new Article entity.
Link to this section Summary
Functions
Attempts to return a CreateArticle command.
Link to this section Types
@type new_attrs() :: %{ :body => String.t(), optional(:id) => Ecto.UUID.t(), published_at: DateTime.t(), slug: String.t(), title: String.t() }
Attribute map type relative to the new/1 function.
attributes
Attributes
:body- A Markdown-flavored string value no more that 100 MBs in length.:id- (optional) AnEcto.UUIDvalue that will be used as the identity of this article. Will be generated if not provided.:published_at- ADateTimevalue representing the public-facing publication date of the article. Whennilthe article is considered unpublished.:slug- The URL fragment used to identify a single article.:title- A plain-text string value using 1 to 255 characters in length.
@type t() :: %Franklin.Articles.Commands.CreateArticle{ body: String.t(), id: Ecto.UUID.t(), published_at: DateTime.t() | nil, slug: String.t(), title: String.t() }
Link to this section Functions
@spec new(new_attrs()) :: {:ok, t()} | {:error, Franklin.ValidationErrorMap.t()}
Attempts to return a CreateArticle command.
If the attributes are valid, returns: {:ok, command}. If the attributes are
invalid, returns: {:error, validation_error_map}.