Skip to content

feat(eng-12000): add metadata API client and client test#287

Merged
BartoszBlizniak merged 3 commits intomasterfrom
eng-12000-cli-metadata-api-client-module-coreapimetadatapy
Apr 30, 2026
Merged

feat(eng-12000): add metadata API client and client test#287
BartoszBlizniak merged 3 commits intomasterfrom
eng-12000-cli-metadata-api-client-module-coreapimetadatapy

Conversation

@BartoszBlizniak
Copy link
Copy Markdown
Member

@BartoszBlizniak BartoszBlizniak commented Apr 30, 2026

Description

Adds a v2 API client for package-metadata endpoints.

Endpoints added

All under https://api.cloudsmith.io/v2/:

Method Path Function
GET /packages/{package_slug_perm}/metadata/ list_metadata
GET /packages/{package_slug_perm}/metadata/{metadata_slug_perm}/ get_metadata
POST /packages/{package_slug_perm}/metadata/ create_metadata
PATCH /packages/{package_slug_perm}/metadata/{metadata_slug_perm}/ update_metadata
DELETE /packages/{package_slug_perm}/metadata/{metadata_slug_perm}/ delete_metadata

source_kind and classification filter args accept either the integer (matching cloudsmith/package/enums.py) or the enum name (case-insensitive, hyphen/underscore tolerant); both are normalised to ints before the request.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

N/A

Copilot AI review requested due to automatic review settings April 30, 2026 14:49
@BartoszBlizniak BartoszBlizniak requested a review from a team as a code owner April 30, 2026 14:49
@BartoszBlizniak BartoszBlizniak changed the title feat(eng-120000): add metadata API client and client test feat(eng-12000): add metadata API client and client test Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a lightweight v2 API client for package metadata endpoints (not yet present in cloudsmith_api) plus a dedicated pytest suite to validate request/response handling and enum/filter normalization.

Changes:

  • Introduces cloudsmith_cli/core/api/metadata.py implementing list/create/update/delete calls against /v2/packages/{package_slug_perm}/metadata/.
  • Adds normalization helpers for source_kind and classification filter arguments (string/int → int).
  • Adds cloudsmith_cli/core/tests/test_metadata.py covering happy paths, error translation, pagination header parsing, and auth precedence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cloudsmith_cli/core/api/metadata.py New v2 metadata client with request building, auth header construction, enum normalization, and pagination parsing.
cloudsmith_cli/core/tests/test_metadata.py New tests for normalization, CRUD calls, error handling, and header behavior using httpretty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith_cli/core/api/metadata.py
Comment thread cloudsmith_cli/core/api/metadata.py
Comment thread cloudsmith_cli/core/tests/test_metadata.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith_cli/core/api/metadata.py
Comment thread cloudsmith_cli/core/tests/test_metadata.py
Comment thread cloudsmith_cli/core/tests/test_metadata.py
Comment thread cloudsmith_cli/core/api/metadata.py
Comment thread cloudsmith_cli/core/api/metadata.py
@BartoszBlizniak BartoszBlizniak merged commit 133a983 into master Apr 30, 2026
40 checks passed
@BartoszBlizniak BartoszBlizniak deleted the eng-12000-cli-metadata-api-client-module-coreapimetadatapy branch April 30, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants