docs: fix README examples for follow, vote, reaction jobs

- follow.follow requires payload dict, not username string
- vote.votecast uses 'vote' not 'voteType', and has parent structure
- reaction.reacttosomething uses 'reaction' and 'parent', not 'reactionType' and 'objectPK/SK'
- feed.following -> feed.followingfeed
- branch.listbyname doesn't take prefix parameter
This commit is contained in:
Jezza Hehn 2026-04-18 02:58:30 +00:00
parent 17d6ed69d1
commit 7e0244d49c

View file

@ -231,7 +231,15 @@ profile = API.run_job('userprofile.get', "username")
```python
# Follow a user
followed = API.run_job('follow.follow', "username-to-follow")
followed = API.run_job('follow.follow', {
"isFollowing": true,
"parent": {
"pk": "userprofile#username",
"sk": "userprofile#username"
},
"followType": "userprofile",
"parentSlug": "username"
})
```
#### Vote Operations
@ -239,9 +247,13 @@ followed = API.run_job('follow.follow', "username-to-follow")
```python
# Cast a vote
voted = API.run_job('vote.votecast', {
"parent": {
"pk": "post-id",
"sk": "post-id",
"voteType": "up" # or "down"
"slug": "post-slug",
"entity": "post"
},
"vote": "up" # or "down"
})
```
@ -250,10 +262,11 @@ voted = API.run_job('vote.votecast', {
```python
# React to something (post, comment, etc.)
reactions = API.run_job('reaction.reacttosomething', {
"objectPK": "post-id",
"objectSK": "post-id",
"objectType": "post",
"reactionType": "like" # various types supported
"parent": {
"pk": "post-id",
"sk": "post-id"
},
"reaction": "like" # various types supported
})
# Get reactions by parent
@ -296,8 +309,8 @@ trusts = API.run_job('trust.listbyuserhas', "username")
# Get a specific branch
branch = API.run_job('branch.get', "branch-name")
# List branches by name
branches = API.run_job('branch.listbyname', "prefix")
# List branches (all branches with pagination)
branches = API.run_job('branch.listbyname')
```
#### Feed Operations
@ -307,7 +320,7 @@ branches = API.run_job('branch.listbyname', "prefix")
feed = API.run_job('feed.cafefeed')
# Get following feed
following_feed = API.run_job('feed.following')
following_feed = API.run_job('feed.followingfeed')
```
#### Block Operations
@ -466,7 +479,15 @@ API = trustcafeapiwrapper.APIClient(
)
# Follow a user
follow = API.run_job('follow.follow', "philosopher-jon")
follow = API.run_job('follow.follow', {
"isFollowing": true,
"parent": {
"pk": "userprofile#philosopher-jon",
"sk": "userprofile#philosopher-jon"
},
"followType": "userprofile",
"parentSlug": "philosopher-jon"
})
print(f"Followed user: {follow}")
# Get their profile