Skip to content

Community module

Andrei Schneider edited this page May 12, 2021 · 1 revision

Community

Categories

Value Description
1 World News
2 Travel & Tourism
3 Science & Technology
4 Strange World
5 Arts & Entertainment
6 Writers& Writing
7 Health & Fitness
8 Crypto & Blockchain
9 Sports

Likes weight

Value Description
1 Like
0 Delete
-1 Dislike

CLI

# Create post
decentrcli tx community create-post [text] --title [title] --preview-image [url to preview] --category 2 --from [account]

# Delete post
decentrcli tx community delete-post [postOwner] [postUUID] --from [account]

# Like post
decentrcli tx community like-post [postOwner] [postUUID] --weight [weight] --from [account]

# Get moderator accounts addresses
decentrcli query community moderators

# Get user's posts
decentrcli query community user-posts <account> [--from-uuid uuid] [--limit int]

# Get a single post
decentrcli query community post <owner> <uuid>

# Follow
decentrcli tx community follow [whom account] --from [who account]

# Unfollow
decentrcli tx community unfollow [whom account] --from [who account]

# Get followee
decentrcli query community followee [account]   

REST

# Create post, note category is a quoted number.
curl -XPOST -s http://localhost:1317/community/posts \
     -d '{"base_req":{"chain_id":"testnet", "from": "'$(decentrcli keys show jack -a)'"},"text": "my brand new text", "title":"my first post title", "imagePreview": "https://localhost/mypicture.jpg", "category": "2"}' > unsignedTx.json

# Delete post
curl -XPOST -s http://localhost:1317/community/posts/{postOwner}/{postUUID}/delete \
     -d '{"base_req":{"chain_id":"testnet", "from": "'$(decentrcli keys show jack -a)'"}}' > unsignedTx.json

# Get moderator accouns addresses
curl -s http://localhost:1317/community/moderators

# Like post
curl -XPOST -s http://localhost:1317/community/posts/{postOwner}/{postUUID}/like\
     -d '{"base_req":{"chain_id":"testnet", "from": "'$(decentrcli keys show jack -a)'"}, "weight": 1}' > unsignedTx.json

# Get a single post
curl -s "http://localhost:1317/community/post/{owner}/{uuid}"

# Get user's posts
curl -s "http://localhost:1317/community/posts/{account}?from={postUUID}&limit={limit}"


# Follow
curl -XPOST -s http://localhost:1317/community/followers/follow/{whom}\
     -d '{"base_req":{"chain_id":"testnet", "from": "'$(decentrcli keys show jack -a)'"}}' > unsignedTx.json

# Unfollow
curl -XPOST -s http://localhost:1317/community/followers/unfollow/{whom}\
     -d '{"base_req":{"chain_id":"testnet", "from": "'$(decentrcli keys show jack -a)'"}}' > unsignedTx.json

# Get followee
curl -s "http://localhost:1317/community/followers/{who}/followees"
Clone this wiki locally