Skip to content

feat: delete_key for DELETE /key - #4

Merged
catsika merged 2 commits into
mainfrom
feat/delete-key
Oct 26, 2026
Merged

catsika merged 2 commits into
mainfrom
feat/delete-key

Conversation

@catsika

@catsika catsika commented Oct 26, 2026

Copy link
Copy Markdown
Member

What

Adds delete_key(params, idempotency_key=None) with DeleteKeyParams / DeleteKeyResponse TypedDicts, a README table row and an Unreleased CHANGELOG entry. No version bump.

Contract

DELETE /key, Authorization: Bearer <admin key>, JSON body {"productId", "licenseKey"}. 200 {"message": "Key deleted", "code": 0}; 404 {"message": "Invalid license key", "code": 1} raises KeyMintApiError (status 404, code 1).

Request helper

_handle_request gains an optional delete_body argument. The DELETE branch sends json=delete_body only when it is given; otherwise it makes exactly the same requests.delete(url, params=..., headers=...) call as before, so delete_customer is unchanged. The license key never goes in the URL or query string.

Tests

Contract tests in tests/test_contracts.py: method, URL /key, JSON body with both fields, no query params, license key absent from the URL, auth and content-type headers, 200 parsing, 404 raises. Regression test: delete_customer still sends only params={"customerId": ...} and headers, no body. ruff check ., pytest -q tests (84 passed) and python -m build pass locally.

@catsika
catsika merged commit 4b7145f into main Oct 26, 2026
2 checks passed
@catsika
catsika deleted the feat/delete-key branch October 26, 2026 03:10
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