-
-
Notifications
You must be signed in to change notification settings - Fork 9
Enable request overrides at the *Builder level and HyperClient method calls #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
michaelborn
wants to merge
15
commits into
development
Choose a base branch
from
feat/allow-dynamic-override-connection-timeout
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5a6be06
Enable request overrides at the *Builder level and on individual Hype…
michaelborn f7509bb
Apply cfformat changes
michaelborn b6caa22
Tweaks to support withHeader() method
michaelborn afe22fe
Document request overrides
michaelborn 800408c
Apply cfformat changes
michaelborn f9bcc49
Tweaks per Copilot review
michaelborn 873b0df
More tweaks per copilot review
michaelborn b0dfbd8
More tweaks per Copilot
michaelborn 6a2f683
Apply cfformat changes
michaelborn e9ab26d
Fix getMappings() call when passing request overrides
michaelborn 834dfcc
Drop incorrect 5th argument in applyMapping()
michaelborn e692ea6
Fix parameter validation error in ACF
michaelborn d0ee22c
Move init method out of property declarations
michaelborn 61c7ed0
Fix method name argument for ACF
michaelborn 87ce5b7
Fix dynamic arguments in onMissingMethod
michaelborn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * | ||
| * Base Model for Fluent Request Overrides | ||
| * | ||
| * Provides a foundation for builder and model objects to support per-request | ||
| * configuration overrides via fluent method chaining. All builder classes | ||
| * (IndexBuilder, SearchBuilder, AliasBuilder, Document, Pipeline, etc.) extend | ||
| * this component to inherit request override capabilities. | ||
| * | ||
| * @package cbElasticsearch.models | ||
| * @author Jon Clausen <jclausen@ortussolutions.com> | ||
| * @license Apache v2.0 <http: // www.apache.org / licenses/> | ||
| * | ||
| */ | ||
| component accessors="true" { | ||
|
|
||
| property name="requestOverrides" type="struct"; | ||
|
|
||
| public BaseModel function init(){ | ||
| variables.requestOverrides = {}; | ||
| return this; | ||
| } | ||
|
|
||
| public BaseModel function withRequestOverrides( struct overrides ){ | ||
| setRequestOverrides( arguments.overrides ); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Handles any missing methods that start with "with" and adds the value to the requestOverrides struct for request configuration | ||
| * Example: withTimeout( 1000 ) would set a default timeout of 1000ms on all requests created by this model | ||
| * | ||
| * @param methodName the name of the method being called | ||
| * @param arguments the arguments passed to the method, where arguments[1] is expected to be the value to set for the default | ||
| * @return returns the model instance for chaining | ||
| */ | ||
| public BaseModel function onMissingMethod( string missingMethodName, struct missingMethodArguments ){ | ||
| if ( left( missingMethodName, 4 ) == "with" ) { | ||
| var args = []; | ||
| if ( !isNull( missingMethodArguments ) ) { | ||
| args = missingMethodArguments.reduce( function( acc, key, val ){ | ||
| acc.append( val ); | ||
| return acc; | ||
| }, [] ); | ||
| } | ||
| variables.requestOverrides[ lCase( replace( missingMethodName, "with", "" ) ) ] = args; | ||
| return this; | ||
| } | ||
| // For all other missing methods, raise a proper missing-method exception | ||
| throw( | ||
| type = "MissingMethodException", | ||
| message = "No such method found for #missingMethodName# on #getMetadata( this ).name#.", | ||
| detail = "Use with#missingMethodName# to set default values for request overrides on this model." | ||
| ); | ||
| } | ||
|
|
||
| } | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.