Skip to content

feat: DeleteKey for DELETE /key - #5

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 Client.DeleteKey(DeleteKeyParams) (*DeleteKeyResponse, error), typed and implemented like BlockKey, and re-exported from the deprecated /src package.

Contract

DELETE /key with Authorization: Bearer <admin key> and JSON body { "productId", "licenseKey" }. The license key goes in the body, never the URL. 200 returns { "message": "Key deleted", "code": 0 }. 404 returns { "message": "Invalid license key", "code": 1 } as an *ApiError. Needs an admin key or the license:delete permission.

No HTTP helper change: handleRequest already sends a JSON body for any method.

Tests

  • New contract tests TestDeleteKey* (mock server) check the method, path, JSON body, that the key is not in the URL, the auth header, and that 200 and 404 both parse. Added to the CI -run filter.
  • The CI consumer build now compiles DeleteKey through both import paths.
  • The live test deletes the node-locked key, then checks that looking it up returns 404. Cleanup now deletes both created keys (best effort, retrying on 429) instead of blocking them, so the shared test workspace stops filling up.
  • Ran locally: gofmt -l . (clean), go vet ./..., go test ./... all pass. The live test skips without secrets.

Adds Client.DeleteKey (DeleteKeyParams/DeleteKeyResponse, re-exported from
/src). The license key goes in the JSON body, never the URL. The live test
now deletes the keys it creates instead of only blocking them.
@catsika
catsika merged commit 2d371ee 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