Skip to content

Commit

Permalink
feat: support paging method (#28)
Browse files Browse the repository at this point in the history
* init lro setup

* upgrade google-gax

* add dom to tsconfig for browser check

* copy protos to build/

* Revert "copy protos to build/"

This reverts commit 028eb20.

* copy protos/ to build/

* load protos from json file

* LRO methods & update baseline test

* gts fix

* paging methods init

* update gts version and fix back the format

* change path name & update baseline

* update baseline test

* fix test

* feedback
  • Loading branch information
xiaozhenliu-gg5 authored Oct 1, 2019
1 parent 65994f9 commit b445cdc
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
41 changes: 41 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,45 @@ 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 %}
}
39 changes: 39 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,43 @@ 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
]>;
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>,
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);
}
}

0 comments on commit b445cdc

Please sign in to comment.