doc: audit pass — fix env= bug, params, pagination, missing wrappers, broken examples

- env= -> environment= across all docs (Pydantic silently ignores env=)
- Remove __version__ check (doesn't exist in module)
- Fix APIClient(debug=True) missing required client_id/secret
- Fix post.listremoved usage (takes no postId, just lists removed posts)
- Fix JS true/false -> Python True/False in code blocks
- Fix parameter names: branchName->branch_slug, username->user_slug, postId->post_id
- Add missing lastEvaluatedKey param docs for list jobs
- Note post.listpublic as unauthenticated endpoint
- Fix pagination examples (LastEvaluatedKey, not ExclusiveStartKey dict)
- Remove non-existent headers param from make_request example
- Fix branch.listbyname example (takes no name arg)
- Add 4 missing wrapper docs: follow, react, trust, votecast
- Fix broken internal links (case-sensitive filenames)
- Fix <environment>_handle_token template artifact
- Add CODE_BUGS.md documenting 4 code bugs found during audit
This commit is contained in:
BarnacleBoy 2026-04-18 22:58:33 +00:00
parent c8611a7b88
commit a223bcb27a
9 changed files with 552 additions and 247 deletions

View file

@ -64,13 +64,13 @@ import os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="alpha", # Options: "alpha" or "production"
environment="alpha", # Options: "alpha" or "production"
debug=False
)
# Authenticate and get user profile
API.handle_token()
profile = API.run_job('userprofile.get', "your-username")
profile = API.run_job('userprofile.get', "your-user-slug")
print(profile)
```
@ -112,7 +112,7 @@ def saveMyToken(token_data):
API = APIClient(
client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
env="production",
environment="production",
debug=False
)
@ -144,7 +144,7 @@ The wrapper supports two environments:
API = APIClient(
client_id="your-client-id",
client_secret="your-client-secret",
env="alpha",
environment="alpha",
debug=False
)
@ -152,7 +152,7 @@ API = APIClient(
API = APIClient(
client_id="your-client-id",
client_secret="your-client-secret",
env="production",
environment="production",
debug=False
)
@ -200,8 +200,8 @@ updated_post = API.run_job('post.update', {
"newPostText": "Updated text"
})
# Delete a post
deleted = API.run_job('post.listremoved', "post-id")
# List removed posts
removed = API.run_job('post.listremoved')
```
#### Comment Operations
@ -224,7 +224,7 @@ comments = API.run_job('comment.listtbypostid', "post-id")
```python
# Get user profile
profile = API.run_job('userprofile.get', "username")
profile = API.run_job('userprofile.get', "user-slug")
```
#### Follow Operations
@ -232,7 +232,7 @@ profile = API.run_job('userprofile.get', "username")
```python
# Follow a user
followed = API.run_job('follow.follow', {
"isFollowing": true,
"isFollowing": True,
"parent": {
"pk": "userprofile#username",
"sk": "userprofile#username"
@ -427,7 +427,7 @@ Enable debug mode to see all API requests and responses:
API = APIClient(
client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
env="production",
environment="production",
debug=True # Enable debug mode
)
@ -447,7 +447,7 @@ import os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="alpha",
environment="alpha",
debug=False
)
@ -475,12 +475,12 @@ import os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="production"
environment="production"
)
# Follow a user
follow = API.run_job('follow.follow', {
"isFollowing": true,
"isFollowing": True,
"parent": {
"pk": "userprofile#philosopher-jon",
"sk": "userprofile#philosopher-jon"
@ -504,7 +504,7 @@ import os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="production"
environment="production"
)
API.handle_token()
@ -527,7 +527,7 @@ import os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="production"
environment="production"
)
API.handle_token()