Search Apps Documentation Source Content File Folder Download Copy Actions Download

social package

Functions

AddReaction

func AddReaction(_ realm, userPostsAddr address, threadid, postid PostID, reaction Reaction) bool

Add the reaction by the caller to the post of userPostsAddr, where threadid is the ID returned by the original call to PostMessage. If postid == threadid then add the reaction to a top-level post for the threadid, otherwise add the reaction to the postid "sub reply". (This function's arguments are similar to PostReply.) The caller must already be registered with /r/gnoland/users/v1 Register. Return a boolean indicating whether the userAddr was added. See Post.AddReaction.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "AddReaction" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "AddReaction" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

GetHomePosts

func GetHomePosts(userPostsAddr address) *avl.Tree

Get home posts for a user, which are the user's top-level posts plus all posts of all users being followed. The response is a map of postID -> \*Post. The avl.Tree sorts by the post ID which is unique for every post and increases in time. If you just want the total count, use GetHomePostsCount. This returns the current state of the home posts (without need to pay gas). To include the latest followed posts, call RefreshHomePosts.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetHomePosts()"

Result

GetHomePostsCount

func GetHomePostsCount(userPostsAddr address) int

Get the number of posts which GetHomePosts or GetJsonHomePosts will return. The result is something like "(12 int)". This returns the current count of the home posts (without need to pay gas). To include the latest followed posts, call RefreshHomePosts.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetHomePostsCount()"

Result

GetJsonFollowers

func GetJsonFollowers(address address, startIndex int, endIndex int) string

Get the UserPosts for the user with the given address, and return the list of followers. If the user address is not found, return "". Limit the response to entries from startIndex up to (not including) endIndex. The response is a JSON string.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonFollowers(,,)"

Result

GetJsonFollowing

func GetJsonFollowing(address address, startIndex int, endIndex int) string

Get the UserPosts for the user with the given address, and return the list of other users that this user is following. If the user address is not found, return "". Limit the response to entries from startIndex up to (not including) endIndex. The response is a JSON string.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonFollowing(,,)"

Result

GetJsonHomePosts

func GetJsonHomePosts(userPostsAddr address, startIndex int, endIndex int) string

Get home posts for a user (using GetHomePosts), which are the user's top-level posts plus all posts of all users being followed. Limit the response to posts from startIndex up to (not including) endIndex within the home posts. If you just want the total count, use GetHomePostsCount. The response is a JSON string. This returns the current state of the home posts (without need to pay gas). To include the latest posts, call RefreshHomePosts.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonHomePosts(,,)"

Result

GetJsonTopPostsByID

func GetJsonTopPostsByID(addrAndIDs []UserAndPostID) string

For each address/PostID in addrAndIDs, get the thread post. The Post ID must be for a a top-level thread (not a reply; to get reply posts, use GetThreadPosts). If the Post ID is not found, set the result for that Post ID to {}. The response is a JSON string.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonTopPostsByID()"

Result

GetJsonUserByAddress

func GetJsonUserByAddress(addr address) string

Call users.ResolveAddress and return the result as JSON, or "" if not found. (This is a temporary utility until gno.land supports returning structured data directly.)

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonUserByAddress()"

Result

GetJsonUserByName

func GetJsonUserByName(name string) string

Call users.ResolveName and return the result as JSON, or "" if not found. (This is a temporary utility until gno.land supports returning structured data directly.)

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonUserByName()"

Result

GetJsonUserPostsInfo

func GetJsonUserPostsInfo(address address) string

Get the UserPosts info for the user with the given address, including url, n\_threads, n\_followers and n\_following. If the user address is not found, return "". The name of this function has "Info" because it just returns the number of items, not the items themselves. To get the items, see GetJsonFollowers, etc. The response is a JSON string.

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetJsonUserPostsInfo()"

Result

GetThreadPosts

func GetThreadPosts(userPostsAddr address, threadID int, replyID int, startIndex int, endIndex int) string

Get posts in a thread for a user. A thread is the sequence of posts without replies. While each post has an an arbitrary id, it also has an index within the thread starting from 0. Limit the response to posts from startIndex up to (not including) endIndex within the thread. If you just want the total count, set startIndex and endIndex to 0 and see the response "n\_threads". If threadID is 0 then return the user's top-level posts. (Like render args "user".) If threadID is X and replyID is 0, then return the posts (without replies) in that thread. (Like render args "user/2".) If threadID is X and replyID is Y, then return the posts in the thread starting with replyID. (Like render args "user/2/5".) The response includes reposts by this user (only if threadID is 0), but not messages of other users that are being followed. (See GetHomePosts.) The response is a JSON string.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.GetThreadPosts(,,,,)"

Result

ListJsonUsersByPrefix

func ListJsonUsersByPrefix(prefix string, maxResults int) string

Get a list of user names starting from the given prefix. Limit the number of results to maxResults. The response is a JSON string.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.ListJsonUsersByPrefix(,)"

Result

ListUsersByPrefix

func ListUsersByPrefix(prefix string, maxResults int) []string

Get a list of user names starting from the given prefix. Limit the number of results to maxResults.

Params

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.ListUsersByPrefix(,)"

Result

RefreshHomePosts

func RefreshHomePosts(_ realm, userPostsAddr address) int

Update the home posts by scanning all posts from all followed users and adding the followed posts since the last call to RefreshHomePosts (or since started following the user). Return the new count of home posts. The result is something like "(12 int)".

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RefreshHomePosts" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RefreshHomePosts" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

RemoveReaction

func RemoveReaction(_ realm, userPostsAddr address, threadid, postid PostID, reaction Reaction) bool

Remove the reaction by the caller to the post of userPostsAddr, where threadid is the ID returned by the original call to PostMessage. If postid == threadid then remove the reaction from a top-level post for the threadid, otherwise remove the reaction from the postid "sub reply". (This function's arguments are similar to PostReply.) The caller must already be registered with /r/gnoland/users/v1 Register. Return a boolean indicating whether the userAddr was removed. See Post.RemoveReaction.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RemoveReaction" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RemoveReaction" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

Render

func Render(path string) string

Param

Command

gnokey query vm/qeval -remote "https://api.gno.berty.io:443" -data "gno.land/r/berty/social.Render()"

Result

Unfollow

func Unfollow(_ realm, followedAddr address)

Update the caller to unfollow the user with followedAddr. See UserPosts.Unfollow.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "Unfollow" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "Unfollow" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

Follow

func Follow(_ realm, followedAddr address) PostID

Update the caller to follow the user with followedAddr. See UserPosts.Follow.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "Follow" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "Follow" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

PostMessage

func PostMessage(_ realm, body string) PostID

Post a message to the caller's main user posts. The caller must already be registered with /r/gnoland/users/v1 Register. Return the "thread ID" of the new post. (This is similar to boards.CreateThread, but no message title)

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "PostMessage" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "PostMessage" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

PostReply

func PostReply(_ realm, userPostsAddr address, threadid, postid PostID, body string) PostID

Post a reply to the user posts of userPostsAddr where threadid is the ID returned by the original call to PostMessage. If postid == threadid then create another top-level post for the threadid, otherwise post a reply to the postid "sub reply". The caller must already be registered with /r/gnoland/users/v1 Register. Return the new post ID. (This is similar to boards.CreateReply.)

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "PostReply" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "PostReply" -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx
  

RepostThread

func RepostThread(_ realm, userPostsAddr address, threadid PostID, comment string) PostID

Repost the message from the user posts of userPostsAddr where threadid is the ID returned by the original call to PostMessage. This must be a top-level thread (not a reply). Return the new post ID. (This is similar to boards.CreateRepost.)

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RepostThread" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "dev" -remote "https://api.gno.berty.io:443" ADDRESSgnokey query -remote "https://api.gno.berty.io:443" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/berty/social" -func "RepostThread" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "dev" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://api.gno.berty.io:443" call.tx