Skip to content

Add public API docstrings and error-handling clarity (step 17)#12

Merged
whitewalls86 merged 3 commits into
masterfrom
step-17-docstrings-error-polish
Jun 13, 2026
Merged

Add public API docstrings and error-handling clarity (step 17)#12
whitewalls86 merged 3 commits into
masterfrom
step-17-docstrings-error-polish

Conversation

@whitewalls86

Copy link
Copy Markdown
Owner

Summary

  • Client docstrings — added class and method docstrings to all public methods on AsyncVisorClient and VisorClient, covering one-page vs. paginate semantics, return types, important params, and the full raised-exception list. VisorClient class docstring notes the thread-safety caveat and context-manager usage.
  • Exception docstrings — expanded AuthError (401 = missing/invalid key), ForbiddenError (403 = valid key, no permission for resource), and RateLimitError (retry_after attribute: seconds or None, usage example).
  • 401/403 fallback messages — when the API returns a 401 or 403 with an empty body, message now falls back to a short actionable default instead of an empty string. API-provided messages are always preferred (api_message or fallback).
  • Tests — four new parametrized sync/async tests covering the empty-body fallback path.

Fixes in review

  • Removed incorrect paginate_listings/iter_listings with dealer_id hint (those helpers don't accept that parameter).
  • Corrected filter.pagefilter.offset in dealer_inventory docstrings (SDK uses offset-based pagination).

Test plan

  • pytest --cov=visor --cov-report=term-missing — 232 passed, 99% coverage
  • ruff check src/ tests/ — no issues
  • ruff format --check src/ tests/ — no issues
  • mypy src/ — no issues
  • python -m build — wheel and sdist built successfully
  • python -m twine check dist/* — both artifacts passed
  • visor/py.typed present in wheel
  • Excluded paths (Visor API Docs/, Design Docs/, .coverage) absent from sdist

🤖 Generated with Claude Code

whitewalls86 and others added 3 commits June 13, 2026 12:15
- AsyncVisorClient and VisorClient: class docstrings covering context-manager
  usage, thread-safety note (sync), and constructor args; method docstrings on
  all public methods documenting one-page semantics, pagination helper refs,
  return types, and raised exceptions
- exceptions.py: expanded AuthError (401 vs key issues), ForbiddenError
  (403 vs permissions), and RateLimitError (retry_after attribute semantics)
  docstrings
- _transport.py: fallback actionable messages for empty 401/403 response
  bodies; API-provided messages are always preferred
- tests/test_transport.py: parametrized sync and async tests for the new
  empty-body fallback paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous docstrings told users to call paginate_listings/iter_listings
with a dealer_id parameter that does not exist on those helpers. Replaced
with a correct manual-pagination note (advance filter.page in a loop).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The SDK uses ListingsFilter.offset for pagination, not .page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@whitewalls86
whitewalls86 merged commit dc4dfd4 into master Jun 13, 2026
12 checks passed
@whitewalls86
whitewalls86 deleted the step-17-docstrings-error-polish branch June 13, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant