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

@ -36,7 +36,10 @@ uv add trustcafeapiwrapper
```python
import trustcafeapiwrapper
print(trustcafeapiwrapper.__version__) # Should print the version
# Verify the module imported successfully
from trustcafeapiwrapper import APIClient
print("trustcafeapiwrapper installed successfully")
```
## API Credentials Setup
@ -120,7 +123,7 @@ The TrustCafé API wrapper supports two environments:
API = APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="alpha" # Alpha environment
environment="alpha" # Alpha environment
)
```
@ -134,7 +137,7 @@ API = APIClient(
API = APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="production" # Production environment
environment="production" # Production environment
)
```
@ -142,7 +145,7 @@ API = APIClient(
```python
# Initialize with alpha
API = APIClient(client_id="id", client_secret="secret", env="alpha")
API = APIClient(client_id="id", client_secret="secret", environment="alpha")
# Later, switch to production
API.set_environment("production")
@ -162,7 +165,7 @@ load_dotenv()
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("TRUSTCAFE_CLIENT_ID"),
client_secret=os.getenv("TRUSTCAFE_CLIENT_SECRET"),
env="alpha", # or "production"
environment="alpha", # or "production"
debug=True # Set to True to see request/response details
)
@ -307,7 +310,7 @@ Always test in alpha before production:
```python
# Test with alpha first
API = APIClient(client_id="test-id", client_secret="test-secret", env="alpha")
API = APIClient(client_id="test-id", client_secret="test-secret", environment="alpha")
# Verify token works
results = API.handle_token()
@ -317,7 +320,7 @@ print("Alpha environment works!")
API = APIClient(
client_id=os.getenv("PROD_CLIENT_ID"),
client_secret=os.getenv("PROD_CLIENT_SECRET"),
env="production"
environment="production"
)
```
@ -369,7 +372,7 @@ Use debug mode during development:
API = APIClient(
client_id="your-id",
client_secret="your-secret",
env="internal",
environment="alpha", # "alpha" or "production"
debug=True # Prints request/response details
)
```
@ -454,16 +457,16 @@ LOG_LEVEL=INFO
Now that you're set up:
1. **Read the API Reference**: Learn about all available jobs and wrappers
- [API Reference](api_reference.md)
- [API Reference](API_REFERENCE.md)
2. **Explore Wrappers**: Try the high-level wrappers for common tasks
- [Wrappers Guide](wrappers.md)
- [Wrappers Guide](WRAPPERS.md)
3. **Make Custom Requests**: Learn to make advanced API calls manually
- [Custom Requests Guide](custom_requests.md)
- [Custom Requests Guide](CUSTOM_REQUESTS.md)
4. **Handle Errors**: Learn about common errors and how to handle them
- [Troubleshooting Guide](troubleshooting.md)
- [Troubleshooting Guide](TROUBLESHOOTING.md)
5. **Contribute**: Help complete the wrapper with additional jobs
- [Development Guide](development.md)
- [Development Guide](../development.md)