Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

social state

Back to all declarations

PostID

type

NOTE: a PostID is relative to the userPosts.

Value

social.PostID

Reaction

type

Reaction is for the "enum" of ways to react to a post

Value

social.Reaction

Gnod

social.Reaction

Value

<zero>

MaxReaction

social.Reaction

Value

<zero>

Post

type

A Post is a "thread" or a "reply" depending on context. A thread is a Post of a UserPosts that holds other replies. This is similar to boards.Post except that this doesn't have a title.

Value

social.Post

newPost

func(userPosts *social.UserPosts, id social.PostID, creator .uverse.address, body string, threadID social.PostID, parentID social.PostID, repostUser .uverse.address) *social.Post
Open
OID
060f00…6547:3
newPost details

Inspect func

validateReaction

func(reaction social.Reaction)
Open
OID
060f00…6547:5
validateReaction details

Inspect func

getPosts

func(posts v0.BPTree, startIndex int, endIndex int) string
Open
OID
060f00…6547:6
getPosts details

Inspect func

UserAndPostID

type

Value

social.UserAndPostID

PostMessage

func(body string) social.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)

Open
OID
060f00…6547:7
PostMessage details

Inspect func

PostReply

func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, body string) social.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.)

Open
OID
060f00…6547:9
PostReply details

Inspect func

RepostThread

func(userPostsAddr .uverse.address, threadid social.PostID, comment string) social.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.)

Open
OID
060f00…6547:10
RepostThread details

Inspect func

GetJsonTopPostsByID

func(addrAndIDs []social.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.

Open
OID
060f00…6547:11
GetJsonTopPostsByID details

Inspect func

GetThreadPosts

func(userPostsAddr .uverse.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 GetJsonHomePosts.) The response is a JSON string.

Open
OID
060f00…6547:12
GetThreadPosts details

Inspect func

RefreshHomePosts

func(userPostsAddr .uverse.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)".

Open
OID
060f00…6547:13
RefreshHomePosts details

Inspect func

GetHomePostsCount

func(userPostsAddr .uverse.address) int

Get the number of posts which 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.

Open
OID
060f00…6547:14
GetHomePostsCount details

Inspect func

getHomePosts

func(userPostsAddr .uverse.address) *v0.BPTree

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 bptree.BPTree sorts by the post ID which is unique for every post and increases in time. This must not be exported. Another realm holding this pointer could mutate the tree (and the posts in it) with this realm's authority.

Open
OID
060f00…6547:15
getHomePosts details

Inspect func

GetJsonHomePosts

func(userPostsAddr .uverse.address, startIndex int, endIndex int) string

Get home posts for a user, 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.

Open
OID
060f00…6547:16
GetJsonHomePosts details

Inspect func

Follow

func(followedAddr .uverse.address) social.PostID

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

Open
OID
060f00…6547:17
Follow details

Inspect func

Unfollow

func(followedAddr .uverse.address)

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

Open
OID
060f00…6547:18
Unfollow details

Inspect func

AddReaction

func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, reaction social.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.

Open
OID
060f00…6547:19
AddReaction details

Inspect func

RemoveReaction

func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, reaction social.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.

Open
OID
060f00…6547:20
RemoveReaction details

Inspect func

GetJsonUserByAddress

func(addr .uverse.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.)

Open
OID
060f00…6547:21
GetJsonUserByAddress details

Inspect func

GetJsonUserByName

func(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.)

Open
OID
060f00…6547:22
GetJsonUserByName details

Inspect func

GetJsonUserPostsInfo

func(address .uverse.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.

Open
OID
060f00…6547:23
GetJsonUserPostsInfo details

Inspect func

GetJsonFollowers

func(address .uverse.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.

Open
OID
060f00…6547:24
GetJsonFollowers details

Inspect func

GetJsonFollowing

func(address .uverse.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.

Open
OID
060f00…6547:25
GetJsonFollowing details

Inspect func

ListUsersByPrefix

func(prefix string, maxResults int) []string

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

Open
OID
060f00…6547:26
ListUsersByPrefix details

Inspect func

ListJsonUsersByPrefix

func(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.

Open
OID
060f00…6547:27
ListJsonUsersByPrefix details

Inspect func

resolveAddr

func(nameOrAddr string) .uverse.address
Open
OID
060f00…6547:28
resolveAddr details

Inspect func

gUserPostsByAddress

v0.BPTree

// user's address -> \*UserPosts

Open
OID
060f00…6547:32
gUserPostsByAddress details

Inspect ref

gUserAddressByName

v0.BPTree

// user's username -> address

Open
OID
060f00…6547:34
gUserAddressByName details

Inspect ref

postsCtr

uint64

// increments Post.id globally

Value

2

gRealmPath

string

Value

"/r/berty/social"

FollowingInfo

type

Value

social.FollowingInfo

UserPosts

type

UserPosts is similar to boards.Board where each user has their own "board" for posts which come from the user. The list of posts is identified by the user's address . A user's "home feed" may contain other posts (from followed users, etc.) but this only has the top-level posts from the user (not replies to other user's posts).

Value

social.UserPosts

newUserPosts

func(url string, userAddr .uverse.address) *social.UserPosts

Create a new userPosts for the user. Panic if there is already a userPosts for the user.

Open
OID
060f00…6547:39
newUserPosts details

Inspect func

getUserPosts

func(userAddr .uverse.address) *social.UserPosts

Get the UserPosts for the user.

Open
OID
060f00…6547:41
getUserPosts details

Inspect func

getOrCreateUserPosts

func(userAddr .uverse.address, username string) *social.UserPosts

Get the UserPosts for the userAddr. If not found, add a new UserPosts to gUserPostsByAddress and update gUserAddressByName with the username. (The caller usually has already called usernameOf to get the username, but if it is "" then this will get it.)

Open
OID
060f00…6547:43
getOrCreateUserPosts details

Inspect func

padZero

func(u64 uint64, length int) string
Open
OID
060f00…6547:44
padZero details

Inspect func

postIDKey

func(pid social.PostID) string
Open
OID
060f00…6547:45
postIDKey details

Inspect func

reactionKey

func(reaction social.Reaction) string
Open
OID
060f00…6547:46
reactionKey details

Inspect func

getOrCreateReactionValue

func(reactions *v0.BPTree, reaction social.Reaction) *v0.BPTree

If reactions has an value for the given reaction, then return it. Otherwise, add the reaction key to reactions, set the value to an empty bptree.BPTree and return it.

Open
OID
060f00…6547:47
getOrCreateReactionValue details

Inspect func

listByteStringKeysByPrefix

func(tree v0.ITree, prefix string, maxResults int) []string

listByteStringKeysByPrefix returns up to maxResults keys from tree that start with the given prefix, treating keys as byte strings (not Unicode runes). Inlined from gno.land/p/jefft0/avlhelpers which is not yet deployed.

Open
OID
060f00…6547:48
listByteStringKeysByPrefix details

Inspect func

indentBody

func(indent string, body string) string
Open
OID
060f00…6547:49
indentBody details

Inspect func

summaryOf

func(str string, length int) string

NOTE: length must be greater than 3.

Open
OID
060f00…6547:50
summaryOf details

Inspect func

displayAddressMD

func(addr .uverse.address) string
Open
OID
060f00…6547:51
displayAddressMD details

Inspect func

usernameOf

func(addr .uverse.address) string
Open
OID
060f00…6547:52
usernameOf details

Inspect func

marshalJsonUser

func(user *users.UserData) string

Return the User info as a JSON string. (This is a temporary utility until gno.land supports returning structured data directly.)

Open
OID
060f00…6547:53
marshalJsonUser details

Inspect func
PostID : type =social.PostID
Reaction : type =social.Reaction
Gnod : social.Reaction =<zero>
MaxReaction : social.Reaction =<zero>
Post : type =social.Post
newPost : func(userPosts *social.UserPosts, id social.PostID, creator .uverse.address, body string, threadID social.PostID, parentID social.PostID, repostUser .uverse.address) *social.Post Inspect
validateReaction : func(reaction social.Reaction) Inspect
getPosts : func(posts v0.BPTree, startIndex int, endIndex int) string Inspect
UserAndPostID : type =social.UserAndPostID
PostMessage : func(body string) social.PostID Inspect
PostReply : func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, body string) social.PostID Inspect
RepostThread : func(userPostsAddr .uverse.address, threadid social.PostID, comment string) social.PostID Inspect
GetJsonTopPostsByID : func(addrAndIDs []social.UserAndPostID) string Inspect
GetThreadPosts : func(userPostsAddr .uverse.address, threadID int, replyID int, startIndex int, endIndex int) string Inspect
RefreshHomePosts : func(userPostsAddr .uverse.address) int Inspect
GetHomePostsCount : func(userPostsAddr .uverse.address) int Inspect
getHomePosts : func(userPostsAddr .uverse.address) *v0.BPTree Inspect
GetJsonHomePosts : func(userPostsAddr .uverse.address, startIndex int, endIndex int) string Inspect
Follow : func(followedAddr .uverse.address) social.PostID Inspect
Unfollow : func(followedAddr .uverse.address) Inspect
AddReaction : func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, reaction social.Reaction) bool Inspect
RemoveReaction : func(userPostsAddr .uverse.address, threadid social.PostID, postid social.PostID, reaction social.Reaction) bool Inspect
GetJsonUserByAddress : func(addr .uverse.address) string Inspect
GetJsonUserByName : func(name string) string Inspect
GetJsonUserPostsInfo : func(address .uverse.address) string Inspect
GetJsonFollowers : func(address .uverse.address, startIndex int, endIndex int) string Inspect
GetJsonFollowing : func(address .uverse.address, startIndex int, endIndex int) string Inspect
ListUsersByPrefix : func(prefix string, maxResults int) []string Inspect
ListJsonUsersByPrefix : func(prefix string, maxResults int) string Inspect
resolveAddr : func(nameOrAddr string) .uverse.address Inspect
Render : func(path string) string Inspect
gUserPostsByAddress : v0.BPTree Inspect
gUserAddressByName : v0.BPTree Inspect
postsCtr : uint64 =2
gRealmPath : string ="/r/berty/social"
init.35 : func() Inspect
FollowingInfo : type =social.FollowingInfo
UserPosts : type =social.UserPosts
newUserPosts : func(url string, userAddr .uverse.address) *social.UserPosts Inspect
getUserPosts : func(userAddr .uverse.address) *social.UserPosts Inspect
getOrCreateUserPosts : func(userAddr .uverse.address, username string) *social.UserPosts Inspect
padZero : func(u64 uint64, length int) string Inspect
postIDKey : func(pid social.PostID) string Inspect
reactionKey : func(reaction social.Reaction) string Inspect
getOrCreateReactionValue : func(reactions *v0.BPTree, reaction social.Reaction) *v0.BPTree Inspect
listByteStringKeysByPrefix : func(tree v0.ITree, prefix string, maxResults int) []string Inspect
indentBody : func(indent string, body string) string Inspect
summaryOf : func(str string, length int) string Inspect
displayAddressMD : func(addr .uverse.address) string Inspect
usernameOf : func(addr .uverse.address) string Inspect
marshalJsonUser : func(user *users.UserData) string Inspect