Skip to content

Refines Rule Builders, Docs, and API Methods - #87

Merged
SergkeiM merged 1 commit into
masterfrom
feature/revamp-2
Aug 16, 2026
Merged

SergkeiM merged 1 commit into
masterfrom
feature/revamp-2

Conversation

@SergkeiM

Copy link
Copy Markdown
Owner

This pull request improves the developer experience by refining the Rules configuration builders, enhancing documentation, and standardizing API client method names.

Key Changes:

  • Refines Rules Configuration Helpers:
    • Updates Rule classes to accept action-specific parameters directly in constructors where required (e.g., BlockRule, ExecuteRule, ScoreRule, ServeErrorRule, ConfigRule, SkipRule).
    • Introduces setActionParameters() for all rules, allowing flexible, merged parameter definition for actions with dynamic or evolving parameters.
    • Adds setLogging() for consistent rule-level logging configuration.
  • Enhances Documentation:
    • Introduces dynamic linking in parameter tables, pointing to specific configuration helper documentation pages (e.g., Ruleset, PageRule) when a parameter accepts a configuration object.
    • Adds a new, comprehensive guide for working with Rule classes (/advanced/configurations/rules), detailing their shared methods and action-specific parameters.
    • Expands the Expression Builder documentation to cover wildcards, field-to-field comparisons, and how expressions integrate with rules.
    • Updates client API method examples across documentation to reflect new parameter usage and method renames.
    • Corrects several Cloudflare API Reference links.
  • Standardizes API Client Methods:
    • Renames update() methods to edit() for Iam/OauthClients, Iam/Sso, Rulesets/Rules, and User for better semantic alignment with PATCH operations.
    • Renames create() methods to update() for Workers/Settings and Workers/Subdomain to reflect PUT operations.
    • Adds a $params array argument to various list() methods (e.g., LoadBalancers/Pools, Rulesets, Workers/Scripts) to enable query parameters for filtering and pagination.
  • Improves Expression Builder Robustness:
    • Allows any field name to be used, enabling new Cloudflare fields without requiring library updates.
    • Correctly formats boolean values (true/false) and preserves falsy comparison values (e.g., 0, "").
    • Enables direct comparison between two fields (e.g., http.host eq http.request.uri.path).
  • Removes Deprecated Feature:
    • Removes the disableApps() method from the PageRule configuration helper.

…ers.

This commit introduces significant improvements across the client:
*   **Documentation:** Automatic linking for configuration helpers, clearer type labels, and a new dedicated page for rules provide a much richer developer experience. Query parameter support is also documented.
*   **API Client:** Renames `update()` to `edit()` for PATCH operations and `create()` to `update()` for PUT operations, aligning methods with REST semantics. Adds support for query parameters to `list()` methods for pagination and filtering.
*   **Configuration Helpers:** The `ExpressionBuilder` now fully supports Cloudflare's Rules language, including field-to-field comparisons and wildcards, and correctly handles boolean and falsy values. Rule classes are enhanced with `setActionParameters()` for full flexibility and `setLogging()` for universal logging control.
@SergkeiM
SergkeiM merged commit 49db5c4 into master Aug 16, 2026
11 checks passed
@SergkeiM
SergkeiM deleted the feature/revamp-2 branch August 16, 2026 16:49
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