-
Notifications
You must be signed in to change notification settings - Fork 2
/
post.go
38 lines (35 loc) · 1.2 KB
/
post.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package forum
import (
uos "github.com/lialvin/uos-go"
)
// NewPost is an action representing a simple message to be posted
// through the chain network.
func NewPost(poster uos.AccountName, postUUID, content string, replyToPoster uos.AccountName, replyToPostUUID string, certify bool, jsonMetadata string) *uos.Action {
a := &uos.Action{
Account: ForumAN,
Name: ActN("post"),
Authorization: []uos.PermissionLevel{
{Actor: poster, Permission: uos.PermissionName("active")},
},
ActionData: uos.NewActionData(Post{
Poster: poster,
PostUUID: postUUID,
Content: content,
ReplyToPoster: replyToPoster,
ReplyToPostUUID: replyToPostUUID,
Certify: certify,
JSONMetadata: jsonMetadata,
}),
}
return a
}
// Post represents the `uosio.forum::post` action.
type Post struct {
Poster uos.AccountName `json:"poster"`
PostUUID string `json:"post_uuid"`
Content string `json:"content"`
ReplyToPoster uos.AccountName `json:"reply_to_poster"`
ReplyToPostUUID string `json:"reply_to_post_uuid"`
Certify bool `json:"certify"`
JSONMetadata string `json:"json_metadata"`
}