Skip to content
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

feat: support paging method #28

Merged
merged 18 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions templates/typescript_gapic/src/$version/$service_client.ts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,42 @@ export class {{ service.name }}Client {
return this._innerApiCalls.{{ method.name.toCamelCase() }}(request, options, callback);
}
{%- endfor %}
{%- for method in service.paging %}
{{ method.name.toCamelCase() }}(
request: protosTypes{{ method.inputInterface }},
options?: gax.CallOptions):
Promise<[
protosTypes{{ method.outputInterface }},
protosTypes{{ method.inputInterface }}|undefined, {}|undefined
]>;
{{ method.name.toCamelCase() }}(
request: protosTypes{{ method.inputInterface }},
options: gax.CallOptions,
callback: Callback<
protosTypes{{ method.outputInterface }},
protosTypes{{ method.inputInterface }}|undefined,
{}|undefined>): void;
{{ method.name.toCamelCase() }}(
request: protosTypes{{ method.inputInterface }},
optionsOrCallback?: gax.CallOptions|Callback<
protosTypes{{ method.outputInterface }},
protosTypes{{ method.inputInterface }}|undefined, {}|undefined>,
callback?: Callback<
protosTypes{{ method.outputInterface }},
protosTypes{{ method.inputInterface }}|undefined,
{}|undefined>):
Promise<[
protosTypes{{ method.outputInterface }},
protosTypes{{ method.inputInterface }}|undefined, {}|undefined
]>|void {
request = request || {};
let options = optionsOrCallback;
if (typeof options === 'function' && callback === undefined) {
callback = options;
options = {};
}
options = options || {};
return this._innerApiCalls.{{ method.name.toCamelCase() }}(request, options, callback);
}
{%- endfor %}
}
36 changes: 36 additions & 0 deletions typescript/test/testdata/echo_client_baseline.ts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,40 @@ export class EchoClient {
options = options || {};
return this._innerApiCalls.wait(request, options, callback);
}
pagedExpand(
request: protosTypes.google.showcase.v1beta1.IPagedExpandRequest,
options?: gax.CallOptions):
Promise<[
protosTypes.google.showcase.v1beta1.IPagedExpandResponse,
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|undefined, {}|undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's add a new line before {}|undefined here and in the template.

]>;
pagedExpand(
request: protosTypes.google.showcase.v1beta1.IPagedExpandRequest,
options: gax.CallOptions,
callback: Callback<
protosTypes.google.showcase.v1beta1.IPagedExpandResponse,
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|undefined,
{}|undefined>): void;
pagedExpand(
request: protosTypes.google.showcase.v1beta1.IPagedExpandRequest,
optionsOrCallback?: gax.CallOptions|Callback<
protosTypes.google.showcase.v1beta1.IPagedExpandResponse,
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|undefined, {}|undefined>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

callback?: Callback<
protosTypes.google.showcase.v1beta1.IPagedExpandResponse,
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|undefined,
{}|undefined>):
Promise<[
protosTypes.google.showcase.v1beta1.IPagedExpandResponse,
protosTypes.google.showcase.v1beta1.IPagedExpandRequest|undefined, {}|undefined
]>|void {
request = request || {};
let options = optionsOrCallback;
if (typeof options === 'function' && callback === undefined) {
callback = options;
options = {};
}
options = options || {};
return this._innerApiCalls.pagedExpand(request, options, callback);
}
}