Skip to content

Add api types - #10

Merged
ahcodedev merged 2 commits into
mainfrom
add-api-types
Nov 9, 2026
Merged

ahcodedev merged 2 commits into
mainfrom
add-api-types

Conversation

@ahcodedev

@ahcodedev ahcodedev commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds Pydantic models for every PriceCharting API request and response, consolidates the enums into a single types module, and gives the clients shorter names.

Models (models.py)

  • PriceChartingModel base class. It maps snake_case fields to the API's kebab-case JSON keys

Requests (requests.py)

  • OfferPublishRequest for /api/offer-publish, validates at least one of product, upc, asin, epid or offer_id.

Responses (responses.py)

  • Prices API: ProductResponse with all product and price keys from the docs, and ProductsResponse.
  • Marketplace API: OffersResponse, OfferDetailsResponse, OfferPublishResponse, OfferFeedbackResponse, OfferShipResponse, OfferEndResponse and OfferRefundResponse.
  • Prices are int pennies, dates parse to datetime.date, and status is a required Status enum.

Types (types.py)

  • Adds OfferStatus, Rating and State (the "on" flag used by offer-publish).

Tests

  • JSON-to-model and model-to-JSON round trips for every model, built from the docs' sample payloads, plus tests for the new enums and the publish validator.

Tooling

  • Ruff target-version raised from py312 to py315, to match requires-python.

Type of Change

Feature

Checklist

  • just lint passes
  • just test passes
  • Tests added or updated for the change
  • README.md updated if needed
  • Release label added

@ahcodedev ahcodedev added the feature New feature (minor version bump) label Nov 9, 2026
@ahcodedev
ahcodedev merged commit b20eec0 into main Nov 9, 2026
9 checks passed
@ahcodedev
ahcodedev deleted the add-api-types branch November 9, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature (minor version bump)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant