-
Notifications
You must be signed in to change notification settings - Fork 33
Switch Client to positional args #155
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
Merged
blowmage
merged 5 commits into
googleapis:master
from
blowmage:client-methods-positional
May 30, 2019
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
af73df2
Update Gax to development - REVERT THIS BEFORE MERGING
blowmage 96ecf67
Use positional arguments for client methods
blowmage 0d2d6d1
Add Optional to options documentation
blowmage 6c11b1a
Revert "Update Gax to development - REVERT THIS BEFORE MERGING"
blowmage a42b172
Add documentation of hash arguments
blowmage 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
8 changes: 1 addition & 7 deletions
8
gapic-generator/templates/default/service/client/method/def/_request_normal.erb
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 |
|---|---|---|
| @@ -1,10 +1,4 @@ | ||
| <%- assert_locals method -%> | ||
| if request.nil? && request_fields.empty? | ||
| raise ArgumentError, "request must be provided" | ||
| end | ||
| if !request.nil? && !request_fields.empty? | ||
| raise ArgumentError, "cannot pass both request object and named arguments" | ||
| end | ||
| raise ArgumentError, "request must be provided" if request.nil? | ||
|
|
||
| request ||= request_fields | ||
| request = Google::Gax::Protobuf.coerce request, to: <%= method.request_type %> |
6 changes: 0 additions & 6 deletions
6
gapic-generator/templates/default/service/client/method/def/_signature.erb
This file was deleted.
Oops, something went wrong.
25 changes: 7 additions & 18 deletions
25
gapic-generator/templates/default/service/client/method/docs/_request_normal.erb
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 |
|---|---|---|
| @@ -1,25 +1,14 @@ | ||
| <%- assert_locals method -%> | ||
| # @overload <%= method.name %>(request, options: nil) | ||
| # @param request [<%= method.request_type %> | Hash] | ||
| # @param request [<%= method.request_type %> | Hash] | ||
| <%- if method.doc_description -%> | ||
| <%= indent method.doc_description, "# " %> | ||
| <%= indent method.doc_description, "# " %> | ||
| <%- end -%> | ||
| # @param options [Google::Gax::ApiCall::Options, Hash] | ||
| # Overrides the default settings for this call, e.g, timeout, retries, etc. | ||
| # | ||
| <%- arg_list = method.arguments.map { |arg| "#{arg.name}: nil"}.join ", " -%> | ||
| # @overload <%= method.name %>(<%= arg_list %>, options: nil) | ||
| # When using a hash, the following fields are supported: | ||
| # | ||
| <%- method.arguments.each do |arg| -%> | ||
| # @param <%= arg.name %> [<%= arg.doc_types %>] | ||
| <%- if arg.doc_description -%> | ||
| # * `<%= arg.name %>` (`<%= arg.doc_types %>`)<%- if arg.doc_description -%>: | ||
| <%= indent arg.doc_description, "# " %> | ||
| <%- end -%> | ||
| <%- end -%> | ||
| # @param options [Google::Gax::ApiCall::Options, Hash] | ||
| # Overrides the default settings for this call, e.g, timeout, retries, etc. | ||
| <%- if method.arguments.find { |arg| arg.name == "options" } -%> | ||
| # | ||
| # If you want to provide a {<%= method.request_type %>#options} | ||
| # value you will need to pass all attributes in a Hash instead of using | ||
| # named arguments. | ||
| <%- end -%> | ||
| <%- end -%># @param options [Google::Gax::ApiCall::Options, Hash] | ||
| # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. | ||
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.
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.