Skip to content

feat: Standardize API client endpoint structure and method naming - #55

Merged
SergkeiM merged 1 commit into
masterfrom
feature/cloudfalre-sdk-alignment
Jul 28, 2026
Merged

feat: Standardize API client endpoint structure and method naming#55
SergkeiM merged 1 commit into
masterfrom
feature/cloudfalre-sdk-alignment

Conversation

@SergkeiM

Copy link
Copy Markdown
Owner

This commit introduces a significant refactoring of the API client to enhance consistency and improve developer experience.

Key changes include:

  • Flattened Endpoint Hierarchy: Many endpoints previously nested under accounts() or zones() (e.g., pageRules, firewallRules, R2 related services, loadBalancers, dns, dnssec) are now accessible directly from the Client object, simplifying access and discovery.
  • Consistent Method Naming:
    • details() methods are renamed to get().
    • update() methods for partial resource updates are renamed to edit().
    • overwrite() methods for full resource replacements are renamed to update().
    • get() methods used for listing collections are renamed to list().
  • Helper Methods: Added scopePath() to AbstractEndpoint for consistent handling of account- or zone-scoped resources, and jurisdictionHeader() for R2-specific requests.
  • Updated documentation, examples, and tests to reflect the new structure and method names.

This refactoring aims to make the Cloudflare SDK more intuitive and aligned with common RESTful API client conventions.

This commit introduces a significant refactoring of the API client to enhance consistency and improve developer experience.

Key changes include:
*   **Flattened Endpoint Hierarchy**: Many endpoints previously nested under `accounts()` or `zones()` (e.g., `pageRules`, `firewallRules`, `R2` related services, `loadBalancers`, `dns`, `dnssec`) are now accessible directly from the `Client` object, simplifying access and discovery.
*   **Consistent Method Naming**:
    *   `details()` methods are renamed to `get()`.
    *   `update()` methods for partial resource updates are renamed to `edit()`.
    *   `overwrite()` methods for full resource replacements are renamed to `update()`.
    *   `get()` methods used for listing collections are renamed to `list()`.
*   **Helper Methods**: Added `scopePath()` to `AbstractEndpoint` for consistent handling of account- or zone-scoped resources, and `jurisdictionHeader()` for R2-specific requests.
*   Updated documentation, examples, and tests to reflect the new structure and method names.

This refactoring aims to make the Cloudflare SDK more intuitive and aligned with common RESTful API client conventions.
@SergkeiM
SergkeiM merged commit 794f896 into master Jul 28, 2026
8 checks passed
@SergkeiM
SergkeiM deleted the feature/cloudfalre-sdk-alignment branch July 28, 2026 13:41
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