Documentation ¶
Index ¶
Constants ¶
View Source
const (
ModuleName = "posts"
)
Variables ¶
View Source
var (
Sha256RegEx = regexp.MustCompile(`^[a-fA-F0-9]{64}$`)
)
Functions ¶
This section is empty.
Types ¶
type GenesisState ¶
type GenesisState struct { Posts []Post `json:"posts"` UsersPollAnswers map[string][]UserAnswer `json:"users_poll_answers"` PostReactions map[string][]PostReaction `json:"post_reactions"` RegisteredReactions []Reaction `json:"registered_reactions"` }
GenesisState contains the data of a v0.4.0 genesis state for the posts module
type OptionalData ¶
OptionalData represents a Posts' optional data and allows for custom Amino and JSON serialization and deserialization.
type PollAnswer ¶
type PollAnswer struct { ID AnswerID `json:"id"` // Unique id inside the post, serialized as a string for Javascript compatibility Text string `json:"text"` // Text of the answer }
PollAnswer contains the data of a single poll answer inserted by the creator
type PollData ¶
type PollData struct { Question string `json:"question"` // Describes what poll is about ProvidedAnswers []PollAnswer `json:"provided_answers"` // Lists of answers provided by the creator EndDate time.Time `json:"end_date"` // RFC3339 date at which the poll will no longer accept new answers Open bool `json:"is_open"` // Tells if the poll is still accepting answers AllowsMultipleAnswers bool `json:"allows_multiple_answers"` // Tells if the poll is a single or multiple answers one AllowsAnswerEdits bool `json:"allows_answer_edits"` // Tells if the poll allows answer edits }
PollData contains the information of a poll that is associated to a post
type Post ¶
type Post struct { PostID PostID `json:"id"` // Unique id ParentID PostID `json:"parent_id"` // Post of which this one is a comment Message string `json:"message"` // Message contained inside the post Created time.Time `json:"created"` // RFC3339 date at which the post has been created LastEdited time.Time `json:"last_edited"` // RFC3339 date at which the post has been edited the last time AllowsComments bool `json:"allows_comments"` // Tells if users can reference this PostID as the parent Subspace string `json:"subspace"` // Identifies the application that has posted the message OptionalData OptionalData `json:"optional_data,omitempty"` // Arbitrary data that can be used from the developers Creator sdk.AccAddress `json:"creator"` // Creator of the Post Medias []PostMedia `json:"medias,omitempty"` // Contains all the medias that are shared with the post PollData *PollData `json:"poll_data,omitempty"` // Contains the poll details, if existing }
Post is a struct of a post
type PostReaction ¶
type PostReaction struct { Owner sdk.AccAddress `json:"owner"` // Creator that has created the reaction Value string `json:"value"` // PostReaction of the reaction }
PostReaction is a struct of a user reaction to a post
type Reaction ¶
type Reaction struct { ShortCode string `json:"shortcode" yaml:"shortcode"` Value string `json:"value" yaml:"value"` Subspace string `json:"subspace" yaml:"subspace"` Creator sdk.AccAddress `json:"creator" yaml:"creator"` }
Reaction represents a registered reaction that can be referenced by its shortCode inside post reactions
type UserAnswer ¶
type UserAnswer struct { Answers []AnswerID `json:"answers"` User sdk.AccAddress `json:"user"` }
UserAnswer contains the data of a user's answer submission to a post's poll
Click to show internal directories.
Click to hide internal directories.