Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit c074f6c

Browse files
gcf-owl-bot[bot]Benjamin E. Coe
andauthored
feat: support regapic LRO
Source-Link: googleapis/googleapis@88fd18d Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Use gapic-generator-typescript v2.15.2. PiperOrigin-RevId: 458552034 Source-Link: googleapis/googleapis@ae65014 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b09ede435cce110446d4ab9f62a081b571d37e3f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjA5ZWRlNDM1Y2NlMTEwNDQ2ZDRhYjlmNjJhMDgxYjU3MWQzN2UzZiJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Benjamin E. Coe <[email protected]>
1 parent 9fb474b commit c074f6c

22 files changed

Lines changed: 380 additions & 186 deletions

src/v2/catalog_service_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class CatalogServiceClient {
7070
*
7171
* @param {object} [options] - The configuration object.
7272
* The options accepted by the constructor are described in detail
73-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
73+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7474
* The common options are:
7575
* @param {object} [options.credentials] - Credentials object.
7676
* @param {string} [options.credentials.client_email]
@@ -93,11 +93,10 @@ export class CatalogServiceClient {
9393
* API remote host.
9494
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9595
* Follows the structure of {@link gapicConfig}.
96-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
97-
* In fallback mode, a special browser-compatible transport implementation is used
98-
* instead of gRPC transport. In browser context (if the `window` object is defined)
99-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
100-
* if you need to override this behavior.
96+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
97+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
98+
* For more information, please check the
99+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
101100
*/
102101
constructor(opts?: ClientOptions) {
103102
// Ensure that options include all the required fields.

src/v2/completion_service_client.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
CallOptions,
2424
Descriptors,
2525
ClientOptions,
26+
GrpcClientOptions,
2627
LROperation,
2728
} from 'google-gax';
2829

@@ -71,7 +72,7 @@ export class CompletionServiceClient {
7172
*
7273
* @param {object} [options] - The configuration object.
7374
* The options accepted by the constructor are described in detail
74-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
75+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7576
* The common options are:
7677
* @param {object} [options.credentials] - Credentials object.
7778
* @param {string} [options.credentials.client_email]
@@ -94,11 +95,10 @@ export class CompletionServiceClient {
9495
* API remote host.
9596
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9697
* Follows the structure of {@link gapicConfig}.
97-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
98-
* In fallback mode, a special browser-compatible transport implementation is used
99-
* instead of gRPC transport. In browser context (if the `window` object is defined)
100-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
101-
* if you need to override this behavior.
98+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
99+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
100+
* For more information, please check the
101+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
102102
*/
103103
constructor(opts?: ClientOptions) {
104104
// Ensure that options include all the required fields.
@@ -174,16 +174,39 @@ export class CompletionServiceClient {
174174
};
175175

176176
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
177-
178177
// This API contains "long-running operations", which return a
179178
// an Operation object that allows for tracking of the operation,
180179
// rather than holding a request open.
181-
180+
const lroOptions: GrpcClientOptions = {
181+
auth: this.auth,
182+
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
183+
};
184+
if (opts.fallback === 'rest') {
185+
lroOptions.protoJson = protoFilesRoot;
186+
lroOptions.httpRules = [
187+
{
188+
selector: 'google.longrunning.Operations.GetOperation',
189+
get: '/v2/{name=projects/*/locations/*/operations/*}',
190+
additional_bindings: [
191+
{
192+
get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',
193+
},
194+
{get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'},
195+
{get: '/v2/{name=projects/*/operations/*}'},
196+
],
197+
},
198+
{
199+
selector: 'google.longrunning.Operations.ListOperations',
200+
get: '/v2/{name=projects/*/locations/*}/operations',
201+
additional_bindings: [
202+
{get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'},
203+
{get: '/v2/{name=projects/*}/operations'},
204+
],
205+
},
206+
];
207+
}
182208
this.operationsClient = this._gaxModule
183-
.lro({
184-
auth: this.auth,
185-
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
186-
})
209+
.lro(lroOptions)
187210
.operationsClient(opts);
188211
const importCompletionDataResponse = protoFilesRoot.lookup(
189212
'.google.cloud.retail.v2.ImportCompletionDataResponse'

src/v2/prediction_service_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class PredictionServiceClient {
6161
*
6262
* @param {object} [options] - The configuration object.
6363
* The options accepted by the constructor are described in detail
64-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
64+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
6565
* The common options are:
6666
* @param {object} [options.credentials] - Credentials object.
6767
* @param {string} [options.credentials.client_email]
@@ -84,11 +84,10 @@ export class PredictionServiceClient {
8484
* API remote host.
8585
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
8686
* Follows the structure of {@link gapicConfig}.
87-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
88-
* In fallback mode, a special browser-compatible transport implementation is used
89-
* instead of gRPC transport. In browser context (if the `window` object is defined)
90-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
91-
* if you need to override this behavior.
87+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
88+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
89+
* For more information, please check the
90+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
9291
*/
9392
constructor(opts?: ClientOptions) {
9493
// Ensure that options include all the required fields.

src/v2/product_service_client.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
CallOptions,
2424
Descriptors,
2525
ClientOptions,
26+
GrpcClientOptions,
2627
LROperation,
2728
PaginationCallback,
2829
GaxCall,
@@ -73,7 +74,7 @@ export class ProductServiceClient {
7374
*
7475
* @param {object} [options] - The configuration object.
7576
* The options accepted by the constructor are described in detail
76-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
77+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7778
* The common options are:
7879
* @param {object} [options.credentials] - Credentials object.
7980
* @param {string} [options.credentials.client_email]
@@ -96,11 +97,10 @@ export class ProductServiceClient {
9697
* API remote host.
9798
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9899
* Follows the structure of {@link gapicConfig}.
99-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
100-
* In fallback mode, a special browser-compatible transport implementation is used
101-
* instead of gRPC transport. In browser context (if the `window` object is defined)
102-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
103-
* if you need to override this behavior.
100+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
101+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102+
* For more information, please check the
103+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
104104
*/
105105
constructor(opts?: ClientOptions) {
106106
// Ensure that options include all the required fields.
@@ -190,16 +190,39 @@ export class ProductServiceClient {
190190
};
191191

192192
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
193-
194193
// This API contains "long-running operations", which return a
195194
// an Operation object that allows for tracking of the operation,
196195
// rather than holding a request open.
197-
196+
const lroOptions: GrpcClientOptions = {
197+
auth: this.auth,
198+
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
199+
};
200+
if (opts.fallback === 'rest') {
201+
lroOptions.protoJson = protoFilesRoot;
202+
lroOptions.httpRules = [
203+
{
204+
selector: 'google.longrunning.Operations.GetOperation',
205+
get: '/v2/{name=projects/*/locations/*/operations/*}',
206+
additional_bindings: [
207+
{
208+
get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',
209+
},
210+
{get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'},
211+
{get: '/v2/{name=projects/*/operations/*}'},
212+
],
213+
},
214+
{
215+
selector: 'google.longrunning.Operations.ListOperations',
216+
get: '/v2/{name=projects/*/locations/*}/operations',
217+
additional_bindings: [
218+
{get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'},
219+
{get: '/v2/{name=projects/*}/operations'},
220+
],
221+
},
222+
];
223+
}
198224
this.operationsClient = this._gaxModule
199-
.lro({
200-
auth: this.auth,
201-
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
202-
})
225+
.lro(lroOptions)
203226
.operationsClient(opts);
204227
const importProductsResponse = protoFilesRoot.lookup(
205228
'.google.cloud.retail.v2.ImportProductsResponse'

src/v2/search_service_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class SearchServiceClient {
7373
*
7474
* @param {object} [options] - The configuration object.
7575
* The options accepted by the constructor are described in detail
76-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
76+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7777
* The common options are:
7878
* @param {object} [options.credentials] - Credentials object.
7979
* @param {string} [options.credentials.client_email]
@@ -96,11 +96,10 @@ export class SearchServiceClient {
9696
* API remote host.
9797
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9898
* Follows the structure of {@link gapicConfig}.
99-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
100-
* In fallback mode, a special browser-compatible transport implementation is used
101-
* instead of gRPC transport. In browser context (if the `window` object is defined)
102-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
103-
* if you need to override this behavior.
99+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
100+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
101+
* For more information, please check the
102+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
104103
*/
105104
constructor(opts?: ClientOptions) {
106105
// Ensure that options include all the required fields.

src/v2/user_event_service_client.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
CallOptions,
2424
Descriptors,
2525
ClientOptions,
26+
GrpcClientOptions,
2627
LROperation,
2728
} from 'google-gax';
2829

@@ -68,7 +69,7 @@ export class UserEventServiceClient {
6869
*
6970
* @param {object} [options] - The configuration object.
7071
* The options accepted by the constructor are described in detail
71-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
72+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7273
* The common options are:
7374
* @param {object} [options.credentials] - Credentials object.
7475
* @param {string} [options.credentials.client_email]
@@ -91,11 +92,10 @@ export class UserEventServiceClient {
9192
* API remote host.
9293
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9394
* Follows the structure of {@link gapicConfig}.
94-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
95-
* In fallback mode, a special browser-compatible transport implementation is used
96-
* instead of gRPC transport. In browser context (if the `window` object is defined)
97-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
98-
* if you need to override this behavior.
95+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
96+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
97+
* For more information, please check the
98+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
9999
*/
100100
constructor(opts?: ClientOptions) {
101101
// Ensure that options include all the required fields.
@@ -171,16 +171,39 @@ export class UserEventServiceClient {
171171
};
172172

173173
const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
174-
175174
// This API contains "long-running operations", which return a
176175
// an Operation object that allows for tracking of the operation,
177176
// rather than holding a request open.
178-
177+
const lroOptions: GrpcClientOptions = {
178+
auth: this.auth,
179+
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
180+
};
181+
if (opts.fallback === 'rest') {
182+
lroOptions.protoJson = protoFilesRoot;
183+
lroOptions.httpRules = [
184+
{
185+
selector: 'google.longrunning.Operations.GetOperation',
186+
get: '/v2/{name=projects/*/locations/*/operations/*}',
187+
additional_bindings: [
188+
{
189+
get: '/v2/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',
190+
},
191+
{get: '/v2/{name=projects/*/locations/*/catalogs/*/operations/*}'},
192+
{get: '/v2/{name=projects/*/operations/*}'},
193+
],
194+
},
195+
{
196+
selector: 'google.longrunning.Operations.ListOperations',
197+
get: '/v2/{name=projects/*/locations/*}/operations',
198+
additional_bindings: [
199+
{get: '/v2/{name=projects/*/locations/*/catalogs/*}/operations'},
200+
{get: '/v2/{name=projects/*}/operations'},
201+
],
202+
},
203+
];
204+
}
179205
this.operationsClient = this._gaxModule
180-
.lro({
181-
auth: this.auth,
182-
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
183-
})
206+
.lro(lroOptions)
184207
.operationsClient(opts);
185208
const purgeUserEventsResponse = protoFilesRoot.lookup(
186209
'.google.cloud.retail.v2.PurgeUserEventsResponse'

src/v2alpha/catalog_service_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class CatalogServiceClient {
7070
*
7171
* @param {object} [options] - The configuration object.
7272
* The options accepted by the constructor are described in detail
73-
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
73+
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
7474
* The common options are:
7575
* @param {object} [options.credentials] - Credentials object.
7676
* @param {string} [options.credentials.client_email]
@@ -93,11 +93,10 @@ export class CatalogServiceClient {
9393
* API remote host.
9494
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9595
* Follows the structure of {@link gapicConfig}.
96-
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
97-
* In fallback mode, a special browser-compatible transport implementation is used
98-
* instead of gRPC transport. In browser context (if the `window` object is defined)
99-
* the fallback mode is enabled automatically; set `options.fallback` to `false`
100-
* if you need to override this behavior.
96+
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
97+
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
98+
* For more information, please check the
99+
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
101100
*/
102101
constructor(opts?: ClientOptions) {
103102
// Ensure that options include all the required fields.

0 commit comments

Comments
 (0)