Repository navigation
Refines Rule Builders, Docs, and API Methods - #87
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the developer experience by refining the Rules configuration builders, enhancing documentation, and standardizing API client method names.
Key Changes:
Ruleclasses to accept action-specific parameters directly in constructors where required (e.g.,BlockRule,ExecuteRule,ScoreRule,ServeErrorRule,ConfigRule,SkipRule).setActionParameters()for all rules, allowing flexible, merged parameter definition for actions with dynamic or evolving parameters.setLogging()for consistent rule-level logging configuration.Ruleset,PageRule) when a parameter accepts a configuration object.Ruleclasses (/advanced/configurations/rules), detailing their shared methods and action-specific parameters.update()methods toedit()forIam/OauthClients,Iam/Sso,Rulesets/Rules, andUserfor better semantic alignment with PATCH operations.create()methods toupdate()forWorkers/SettingsandWorkers/Subdomainto reflect PUT operations.$paramsarray argument to variouslist()methods (e.g.,LoadBalancers/Pools,Rulesets,Workers/Scripts) to enable query parameters for filtering and pagination.true/false) and preserves falsy comparison values (e.g.,0,"").http.host eq http.request.uri.path).disableApps()method from thePageRuleconfiguration helper.