Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func PollAnswersStoreKey(id PostID) []byte
- func PostCommentsStoreKey(id PostID) []byte
- func PostReactionsStoreKey(id PostID) []byte
- func PostStoreKey(id PostID) []byte
- func ReactionsStoreKey(shortCode, subspace string) []byte
- func RegisterModelsCodec(cdc *codec.Codec)
- type AnswerID
- type KeyValue
- type OptionalData
- type PollAnswer
- type PollAnswers
- type PollAnswersQueryResponse
- type PollData
- type Post
- type PostID
- type PostIDs
- type PostMedia
- type PostMedias
- type PostQueryResponse
- type PostReaction
- type PostReactions
- type Posts
- type Reaction
- type Reactions
- type UserAnswer
- type UserAnswers
Constants ¶
const ( ModuleName = common.ModuleName RouterKey = common.RouterKey StoreKey = common.StoreKey MaxPostMessageLength = common.MaxPostMessageLength MaxOptionalDataFieldsNumber = common.MaxOptionalDataFieldsNumber MaxOptionalDataFieldValueLength = common.MaxOptionalDataFieldValueLength ActionCreatePost = common.ActionCreatePost ActionEditPost = common.ActionEditPost ActionAnswerPoll = common.ActionAnswerPoll ActionAddPostReaction = common.ActionAddPostReaction ActionRemovePostReaction = common.ActionRemovePostReaction ActionRegisterReaction = common.ActionRegisterReaction QuerierRoute = common.QuerierRoute QueryPost = common.QueryPost QueryPosts = common.QueryPosts QueryPollAnswers = common.QueryPollAnswers QueryRegisteredReactions = common.QueryRegisteredReactions PostSortByCreationDate = common.PostSortByCreationDate PostSortByID = common.PostSortByID PostSortOrderAscending = common.PostSortOrderAscending PostSortOrderDescending = common.PostSortOrderDescending )
Variables ¶
var ( // functions aliases NewPostReaction = reactions.NewPostReaction NewPostReactions = reactions.NewPostReactions NewReaction = reactions.NewReaction IsEmoji = reactions.IsEmoji NewReactions = reactions.NewReactions NewPostMedia = common.NewPostMedia ValidateURI = common.ValidateURI NewPostMedias = common.NewPostMedias GetEmojiByShortCodeOrValue = common.GetEmojiByShortCodeOrValue NewPollData = polls.NewPollData ArePollDataEquals = polls.ArePollDataEquals NewUserAnswer = polls.NewUserAnswer NewUserAnswers = polls.NewUserAnswers ParseAnswerID = polls.ParseAnswerID NewPollAnswer = polls.NewPollAnswer NewPollAnswers = polls.NewPollAnswers // variable aliases Sha256RegEx = common.Sha256RegEx HashtagRegEx = common.HashtagRegEx ShortCodeRegEx = common.ShortCodeRegEx URIRegEx = common.URIRegEx ModuleAddress = common.ModuleAddress PostStorePrefix = common.PostStorePrefix PostCommentsStorePrefix = common.PostCommentsStorePrefix PostReactionsStorePrefix = common.PostReactionsStorePrefix ReactionsStorePrefix = common.ReactionsStorePrefix PollAnswersStorePrefix = common.PollAnswersStorePrefix )
var ModelsCdc = codec.New()
ModelsCdc is the codec
Functions ¶
func PollAnswersStoreKey ¶
PollAnswersStoreKey turns an id to a key used to store a post's poll answers into the posts store nolint: interfacer
func PostCommentsStoreKey ¶
PostCommentsStoreKey turns an id to a key used to store a post's comments into the posts store nolint: interfacer
func PostReactionsStoreKey ¶
PostCommentsStoreKey turns an id to a key used to store a post's reactions into the posts store nolint: interfacer
func PostStoreKey ¶
PostStoreKey turns an id to a key used to store a post into the posts store nolint: interfacer
func ReactionsStoreKey ¶
ReactionsStoreKey turns the combination of shortCode and subspace to a key used to store a reaction into the reaction's store nolint: interfacer
func RegisterModelsCodec ¶
RegisterModelsCodec registers concrete types on the Amino codec
Types ¶
type OptionalData ¶
type OptionalData = common.OptionalData
type PollAnswer ¶
type PollAnswer = polls.PollAnswer
type PollAnswers ¶
type PollAnswers = polls.PollAnswers
type PollAnswersQueryResponse ¶
type PollAnswersQueryResponse struct { PostID PostID `json:"post_id" yaml:"post_id"` AnswersDetails UserAnswers `json:"answers_details" yaml:"answers_details"` }
PollAnswersQueryResponse represents the answers made to a post's poll that is returned to user upon a query
func (PollAnswersQueryResponse) String ¶
func (response PollAnswersQueryResponse) String() string
String implements fmt.Stringer
type Post ¶
type Post struct { PostID PostID `json:"id" yaml:"id" ` // Unique id ParentID PostID `json:"parent_id" yaml:"parent_id"` // Post of which this one is a comment Message string `json:"message" yaml:"message"` // Message contained inside the post Created time.Time `json:"created" yaml:"created"` // RFC3339 date at which the post has been created LastEdited time.Time `json:"last_edited" yaml:"last_edited"` // RFC3339 date at which the post has been edited the last time AllowsComments bool `json:"allows_comments" yaml:"allows_comments"` // Tells if users can reference this PostID as the parent Subspace string `json:"subspace" yaml:"subspace"` // Identifies the application that has posted the message OptionalData OptionalData `json:"optional_data,omitempty" yaml:"optional_data,omitempty"` // Arbitrary data that can be used from the developers Creator sdk.AccAddress `json:"creator" yaml:"creator"` // Creator of the Post Medias PostMedias `json:"medias,omitempty" yaml:"medias,omitempty"` // Contains all the medias that are shared with the post PollData *PollData `json:"poll_data,omitempty" yaml:"poll_data"` // Contains the poll details, if existing }
Post is a struct of a post
func (Post) ContentsEquals ¶
ContentsEquals returns true if and only if p and other contain the same data, without considering the ID
func (Post) GetPostHashtags ¶
GetPostHashtags returns all the post's hashtags without duplicates
func (Post) WithMedias ¶
func (p Post) WithMedias(medias PostMedias) Post
WithMedias allows to easily set the given medias as the multimedia files associated with the p Post
func (Post) WithPollData ¶
WithMedias allows to easily set the given data as the poll data files associated with the p Post
type PostID ¶
type PostID string
PostID represents a unique post id
func ComputeID ¶
ComputeID returns a sha256 hash of the given data concatenated together nolint: interfacer
func ParsePostID ¶
ParsePostID takes the given value and returns a PostID from it. If the given value cannot be parse, an error is returned instead.
type PostIDs ¶
type PostIDs []PostID
PostIDs represents a slice of PostID objects
func (PostIDs) AppendIfMissing ¶
AppendIfMissing appends the given postID to the ids slice if it does not exist inside it yet. It returns a new slice of PostIDs containing such ID and a boolean indicating whether or not the original slice has been modified.
type PostMedias ¶
type PostMedias = common.PostMedias
type PostQueryResponse ¶
type PostQueryResponse struct { Post PollAnswers []UserAnswer `json:"poll_answers,omitempty" yaml:"poll_answers,omitempty"` Reactions []PostReaction `json:"reactions" yaml:"reactions,omitempty"` Children PostIDs `json:"children" yaml:"children"` }
PostQueryResponse represents the data of a post that is returned to user upon a query
func NewPostResponse ¶
func NewPostResponse( post Post, pollAnswers []UserAnswer, reactions []PostReaction, children PostIDs, ) PostQueryResponse
func (PostQueryResponse) MarshalJSON ¶
func (response PostQueryResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler as Amino does not respect default json composition
func (PostQueryResponse) String ¶
func (response PostQueryResponse) String() string
String implements fmt.Stringer
func (*PostQueryResponse) UnmarshalJSON ¶
func (response *PostQueryResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler as Amino does not respect default json composition
type PostReaction ¶
type PostReaction = reactions.PostReaction
type PostReactions ¶
type PostReactions = reactions.PostReactions
type UserAnswer ¶
type UserAnswer = polls.UserAnswer
type UserAnswers ¶
type UserAnswers = polls.UserAnswers