Skip to content

Commit

Permalink
move duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhenliu-gg5 committed Mar 18, 2020
1 parent 60390f1 commit f543fda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,17 @@ export class LoggingServiceV2Client {
listLogs:
new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames')
};
// Some methods on this API support automatically batching
// requests; denote this.

// This API contains "long-running operations", which return a
// an Operation object that allows for tracking of the operation,
// rather than holding a request open.
const protoFilesRoot = opts.fallback?
this._gaxModule.protobuf.Root.fromJSON(require("../../protos/protos.json")) :
this._gaxModule.protobuf.loadSync(nodejsProtoPath);

// Some methods on this API support automatically batching
// requests; denote this.

this._descriptors.batching = {
WriteLogEntries: new this._gaxModule.BundleDescriptor(
'entries',
Expand Down
10 changes: 3 additions & 7 deletions templates/typescript_gapic/src/$version/$service_client.ts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ export class {{ service.name }}Client {
{%- endfor %}
};
{%- endif %}
{%- if (service.longRunning.length > 0) %}
{%- if (service.longRunning.length > 0) or (service.bundleConfigs.length > 0) %}

// This API contains "long-running operations", which return a

This comment has been minimized.

Copy link
@alexander-fenster

alexander-fenster Mar 18, 2020

Contributor

This is not perfect (will write the comment even if there are no long running operations :) ) but I guess we're fine here, no need to fix it.

This comment has been minimized.

Copy link
@xiaozhenliu-gg5

xiaozhenliu-gg5 Mar 18, 2020

Author Contributor

right! I was just trying to keep the existing libraries staying the same, or it will be changes over all client libs. but you are right, I may include this change (move the comments around) in the next mass PR (is there's any) Thank you!

// an Operation object that allows for tracking of the operation,
// rather than holding a request open.
const protoFilesRoot = opts.fallback?
this._gaxModule.protobuf.Root.fromJSON(require("../../protos/protos.json")) :
this._gaxModule.protobuf.loadSync(nodejsProtoPath);

{% endif %}
{%- if service.longRunning.length > 0 %}
this.operationsClient = this._gaxModule.lro({
auth: this.auth,
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
Expand Down Expand Up @@ -221,11 +222,6 @@ export class {{ service.name }}Client {
{%- if (service.bundleConfigs.length > 0) %}
// Some methods on this API support automatically batching
// requests; denote this.
{%- if (service.longRunning.length === 0) %}
const protoFilesRoot = opts.fallback?
this._gaxModule.protobuf.Root.fromJSON(require("../../protos/protos.json")) :
this._gaxModule.protobuf.loadSync(nodejsProtoPath);
{%- endif %}

this._descriptors.batching = {
{%- for method in service.bundleConfigsMethods %}
Expand Down

0 comments on commit f543fda

Please sign in to comment.