diff --git a/packages/google-cloud-privatecatalog/.repo-metadata.json b/packages/google-cloud-privatecatalog/.repo-metadata.json index 01f058cb017..5888b3291c1 100644 --- a/packages/google-cloud-privatecatalog/.repo-metadata.json +++ b/packages/google-cloud-privatecatalog/.repo-metadata.json @@ -7,7 +7,7 @@ "release_level": "BETA", "language": "nodejs", "repo": "googleapis/nodejs-private-catalog", - "distribution_name": "", + "distribution_name": "@google-cloud/private-catalog", "api_id": "privatecatalog.googleapis.com", "default_version": "v1beta1", "requires_billing": true diff --git a/packages/google-cloud-privatecatalog/CHANGELOG.md b/packages/google-cloud-privatecatalog/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/google-cloud-privatecatalog/README.md b/packages/google-cloud-privatecatalog/README.md index 5a703f05aff..e05cfd8c7ef 100644 --- a/packages/google-cloud-privatecatalog/README.md +++ b/packages/google-cloud-privatecatalog/README.md @@ -5,7 +5,7 @@ # [Private Catalog: Node.js Client](https://github.com/googleapis/nodejs-private-catalog) [![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) -[![npm version](https://img.shields.io/npm/v/.svg)](https://www.npmjs.org/package/) +[![npm version](https://img.shields.io/npm/v/@google-cloud/private-catalog.svg)](https://www.npmjs.org/package/@google-cloud/private-catalog) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-private-catalog/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-private-catalog) @@ -32,8 +32,8 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. * [Quickstart](#quickstart) * [Before you begin](#before-you-begin) * [Installing the client library](#installing-the-client-library) - - + * [Using the client library](#using-the-client-library) +* [Samples](#samples) * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) @@ -51,11 +51,49 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. ### Installing the client library ```bash -npm install +npm install @google-cloud/private-catalog +``` + + +### Using the client library + +```javascript +// Imports the Google Cloud client library + +// remove this line after package is released +// eslint-disable-next-line node/no-missing-require +const {PrivateCatalogClient} = require(''); + +// TODO(developer): replace with your prefered project ID. +// const projectId = 'my-project' + +// Creates a client +// eslint-disable-next-line no-unused-vars +const client = new {PrivateCatalogClient}(); + +//TODO(library generator): write the actual function you will be testing +async function doSomething() { + console.log( + 'DPE! Change this code so that it shows how to use the library! See comments below on structure.' + ); + // const [thing] = await client.methodName({ + // }); + // console.info(thing); +} +doSomething(); + ``` +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-private-catalog/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-private-catalog/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-private-catalog&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | + The [Private Catalog Node.js Client API Reference][client-docs] documentation diff --git a/packages/google-cloud-privatecatalog/package.json b/packages/google-cloud-privatecatalog/package.json index 6d0addbcb05..5c2d09a16b7 100644 --- a/packages/google-cloud-privatecatalog/package.json +++ b/packages/google-cloud-privatecatalog/package.json @@ -1,8 +1,8 @@ { - "name": "undefined", + "name": "@google-cloud/private-catalog", "version": "0.1.0", "description": "cloudprivatecatalog client for Node.js", - "repository": "googleapis/googleapis/nodejs-private-catalog", + "repository": "googleapis/nodejs-private-catalog", "license": "Apache-2.0", "author": "Google LLC", "main": "build/src/index.js", diff --git a/packages/google-cloud-privatecatalog/protos/protos.d.ts b/packages/google-cloud-privatecatalog/protos/protos.d.ts index b30ecd6157d..ba966c150c3 100644 --- a/packages/google-cloud-privatecatalog/protos/protos.d.ts +++ b/packages/google-cloud-privatecatalog/protos/protos.d.ts @@ -1030,10 +1030,10 @@ export namespace google { public validationOperation?: (google.longrunning.IOperation|null); /** AssetReference asset. */ - public asset?: (string|null); + public asset: string; /** AssetReference gcsPath. */ - public gcsPath?: (string|null); + public gcsPath: string; /** AssetReference gitSource. */ public gitSource?: (google.cloud.privatecatalog.v1beta1.IGitSource|null); @@ -1362,13 +1362,13 @@ export namespace google { public dir: string; /** GitSource commit. */ - public commit?: (string|null); + public commit: string; /** GitSource branch. */ - public branch?: (string|null); + public branch: string; /** GitSource tag. */ - public tag?: (string|null); + public tag: string; /** GitSource ref. */ public ref?: ("commit"|"branch"|"tag"); @@ -1707,19 +1707,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get?: (string|null); + public get: string; /** HttpRule put. */ - public put?: (string|null); + public put: string; /** HttpRule post. */ - public post?: (string|null); + public post: string; /** HttpRule delete. */ - public delete?: (string|null); + public delete: string; /** HttpRule patch. */ - public patch?: (string|null); + public patch: string; /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); @@ -5773,16 +5773,16 @@ export namespace google { constructor(properties?: google.protobuf.IValue); /** Value nullValue. */ - public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + public nullValue: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue); /** Value numberValue. */ - public numberValue?: (number|null); + public numberValue: number; /** Value stringValue. */ - public stringValue?: (string|null); + public stringValue: string; /** Value boolValue. */ - public boolValue?: (boolean|null); + public boolValue: boolean; /** Value structValue. */ public structValue?: (google.protobuf.IStruct|null); diff --git a/packages/google-cloud-privatecatalog/protos/protos.js b/packages/google-cloud-privatecatalog/protos/protos.js index 1d29ed70d86..ad8ab14a798 100644 --- a/packages/google-cloud-privatecatalog/protos/protos.js +++ b/packages/google-cloud-privatecatalog/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots.undefined_protos || ($protobuf.roots.undefined_protos = {}); + var $root = $protobuf.roots._google_cloud_private_catalog_protos || ($protobuf.roots._google_cloud_private_catalog_protos = {}); $root.google = (function() { @@ -2375,19 +2375,19 @@ /** * AssetReference asset. - * @member {string|null|undefined} asset + * @member {string} asset * @memberof google.cloud.privatecatalog.v1beta1.AssetReference * @instance */ - AssetReference.prototype.asset = null; + AssetReference.prototype.asset = ""; /** * AssetReference gcsPath. - * @member {string|null|undefined} gcsPath + * @member {string} gcsPath * @memberof google.cloud.privatecatalog.v1beta1.AssetReference * @instance */ - AssetReference.prototype.gcsPath = null; + AssetReference.prototype.gcsPath = ""; /** * AssetReference gitSource. @@ -3320,27 +3320,27 @@ /** * GitSource commit. - * @member {string|null|undefined} commit + * @member {string} commit * @memberof google.cloud.privatecatalog.v1beta1.GitSource * @instance */ - GitSource.prototype.commit = null; + GitSource.prototype.commit = ""; /** * GitSource branch. - * @member {string|null|undefined} branch + * @member {string} branch * @memberof google.cloud.privatecatalog.v1beta1.GitSource * @instance */ - GitSource.prototype.branch = null; + GitSource.prototype.branch = ""; /** * GitSource tag. - * @member {string|null|undefined} tag + * @member {string} tag * @memberof google.cloud.privatecatalog.v1beta1.GitSource * @instance */ - GitSource.prototype.tag = null; + GitSource.prototype.tag = ""; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -4165,43 +4165,43 @@ /** * HttpRule get. - * @member {string|null|undefined} get + * @member {string} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = null; + HttpRule.prototype.get = ""; /** * HttpRule put. - * @member {string|null|undefined} put + * @member {string} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = null; + HttpRule.prototype.put = ""; /** * HttpRule post. - * @member {string|null|undefined} post + * @member {string} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = null; + HttpRule.prototype.post = ""; /** * HttpRule delete. - * @member {string|null|undefined} delete + * @member {string} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = null; + HttpRule.prototype["delete"] = ""; /** * HttpRule patch. - * @member {string|null|undefined} patch + * @member {string} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = null; + HttpRule.prototype.patch = ""; /** * HttpRule custom. @@ -15238,35 +15238,35 @@ /** * Value nullValue. - * @member {google.protobuf.NullValue|null|undefined} nullValue + * @member {google.protobuf.NullValue} nullValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.nullValue = null; + Value.prototype.nullValue = 0; /** * Value numberValue. - * @member {number|null|undefined} numberValue + * @member {number} numberValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.numberValue = null; + Value.prototype.numberValue = 0; /** * Value stringValue. - * @member {string|null|undefined} stringValue + * @member {string} stringValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.stringValue = null; + Value.prototype.stringValue = ""; /** * Value boolValue. - * @member {boolean|null|undefined} boolValue + * @member {boolean} boolValue * @memberof google.protobuf.Value * @instance */ - Value.prototype.boolValue = null; + Value.prototype.boolValue = false; /** * Value structValue. diff --git a/packages/google-cloud-privatecatalog/samples/README.md b/packages/google-cloud-privatecatalog/samples/README.md new file mode 100644 index 00000000000..96f21f79a2c --- /dev/null +++ b/packages/google-cloud-privatecatalog/samples/README.md @@ -0,0 +1,50 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Private Catalog: Node.js Samples](https://github.com/googleapis/nodejs-private-catalog) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Quickstart](#quickstart) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-private-catalog#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-private-catalog/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-private-catalog&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node samples/quickstart.js` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-private-catalog&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/private-catalog/ diff --git a/packages/google-cloud-privatecatalog/samples/package.json b/packages/google-cloud-privatecatalog/samples/package.json index 4b30b3aa5e3..8b234214abe 100644 --- a/packages/google-cloud-privatecatalog/samples/package.json +++ b/packages/google-cloud-privatecatalog/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "": "^0.1.0" + "@google-cloud/private-catalog": "^0.1.0" }, "devDependencies": { "c8": "^7.1.0", diff --git a/packages/google-cloud-privatecatalog/samples/quickstart.js b/packages/google-cloud-privatecatalog/samples/quickstart.js index 3d84bc3d089..3854afae6bd 100644 --- a/packages/google-cloud-privatecatalog/samples/quickstart.js +++ b/packages/google-cloud-privatecatalog/samples/quickstart.js @@ -14,7 +14,6 @@ 'use strict'; async function main() { - // [START nodejs_private_catalog_quickstart] // Imports the Google Cloud client library @@ -31,10 +30,12 @@ async function main() { //TODO(library generator): write the actual function you will be testing async function doSomething() { - console.log('DPE! Change this code so that it shows how to use the library! See comments below on structure.') - // const [thing] = await client.methodName({ - // }); - // console.info(thing); + console.log( + 'DPE! Change this code so that it shows how to use the library! See comments below on structure.' + ); + // const [thing] = await client.methodName({ + // }); + // console.info(thing); } doSomething(); // [END nodejs_private_catalog_quickstart] diff --git a/packages/google-cloud-privatecatalog/samples/test/quickstart.js b/packages/google-cloud-privatecatalog/samples/test/quickstart.js index 3ccd3948bb1..82db08ec142 100644 --- a/packages/google-cloud-privatecatalog/samples/test/quickstart.js +++ b/packages/google-cloud-privatecatalog/samples/test/quickstart.js @@ -32,7 +32,7 @@ const cwd = path.join(__dirname, '..'); const client = new {PrivateCatalogClient}(); describe('Quickstart', () => { - //TODO: remove this if not using the projectId + //TODO: remove this if not using the projectId // eslint-disable-next-line no-unused-vars let projectId; @@ -42,12 +42,9 @@ describe('Quickstart', () => { }); it('should run quickstart', async () => { - //TODO: remove this line - // eslint-disable-next-line no-unused-vars - const stdout = execSync( - `node ./quickstart.js`, - {cwd} - ); + //TODO: remove this line + // eslint-disable-next-line no-unused-vars + const stdout = execSync('node ./quickstart.js', {cwd}); //assert(stdout, stdout !== null); }); }); diff --git a/packages/google-cloud-privatecatalog/src/v1beta1/private_catalog_client.ts b/packages/google-cloud-privatecatalog/src/v1beta1/private_catalog_client.ts index 0fb4d25f1da..e59044cbf95 100644 --- a/packages/google-cloud-privatecatalog/src/v1beta1/private_catalog_client.ts +++ b/packages/google-cloud-privatecatalog/src/v1beta1/private_catalog_client.ts @@ -258,14 +258,13 @@ export class PrivateCatalogClient { ]; for (const methodName of privateCatalogStubMethods) { const callPromise = this.privateCatalogStub.then( - stub => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -439,10 +438,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.searchCatalogs(request, options, callback); } @@ -486,10 +486,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchCatalogs.createStream( @@ -544,16 +545,17 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchCatalogs.asyncIterate( this.innerApiCalls['searchCatalogs'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } @@ -659,10 +661,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.searchProducts(request, options, callback); } @@ -707,10 +710,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchProducts.createStream( @@ -766,16 +770,17 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchProducts.asyncIterate( this.innerApiCalls['searchProducts'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } @@ -881,10 +886,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.searchVersions(request, options, callback); } @@ -929,10 +935,11 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchVersions.createStream( @@ -988,16 +995,17 @@ export class PrivateCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.searchVersions.asyncIterate( this.innerApiCalls['searchVersions'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-privatecatalog/test/gapic_private_catalog_v1beta1.ts b/packages/google-cloud-privatecatalog/test/gapic_private_catalog_v1beta1.ts index bed7c503e0f..55fa50ca2c6 100644 --- a/packages/google-cloud-privatecatalog/test/gapic_private_catalog_v1beta1.ts +++ b/packages/google-cloud-privatecatalog/test/gapic_private_catalog_v1beta1.ts @@ -28,9 +28,10 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, {defaults: true}); + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -264,8 +265,9 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Catalog() ), ]; - client.innerApiCalls.searchCatalogs = - stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.searchCatalogs = stubSimpleCallWithCallback( + expectedResponse + ); const promise = new Promise((resolve, reject) => { client.searchCatalogs( request, @@ -345,12 +347,12 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Catalog() ), ]; - client.descriptors.page.searchCatalogs.createStream = - stubPageStreamingCall(expectedResponse); + client.descriptors.page.searchCatalogs.createStream = stubPageStreamingCall( + expectedResponse + ); const stream = client.searchCatalogsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Catalog[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Catalog[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Catalog) => { @@ -372,9 +374,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchCatalogs, request) ); assert.strictEqual( - ( - client.descriptors.page.searchCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -391,12 +394,13 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchCatalogs.createStream = - stubPageStreamingCall(undefined, expectedError); + client.descriptors.page.searchCatalogs.createStream = stubPageStreamingCall( + undefined, + expectedError + ); const stream = client.searchCatalogsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Catalog[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Catalog[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Catalog) => { @@ -417,9 +421,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchCatalogs, request) ); assert.strictEqual( - ( - client.descriptors.page.searchCatalogs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchCatalogs + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -446,25 +451,25 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Catalog() ), ]; - client.descriptors.page.searchCatalogs.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.privatecatalog.v1beta1.ICatalog[] = - []; + client.descriptors.page.searchCatalogs.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.privatecatalog.v1beta1.ICatalog[] = []; const iterable = client.searchCatalogsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - ( - client.descriptors.page.searchCatalogs.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -481,26 +486,27 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchCatalogs.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); + client.descriptors.page.searchCatalogs.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); const iterable = client.searchCatalogsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.privatecatalog.v1beta1.ICatalog[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.ICatalog[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - ( - client.descriptors.page.searchCatalogs.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchCatalogs + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchCatalogs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchCatalogs + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -575,8 +581,9 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Product() ), ]; - client.innerApiCalls.searchProducts = - stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.searchProducts = stubSimpleCallWithCallback( + expectedResponse + ); const promise = new Promise((resolve, reject) => { client.searchProducts( request, @@ -656,12 +663,12 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Product() ), ]; - client.descriptors.page.searchProducts.createStream = - stubPageStreamingCall(expectedResponse); + client.descriptors.page.searchProducts.createStream = stubPageStreamingCall( + expectedResponse + ); const stream = client.searchProductsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Product[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Product[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Product) => { @@ -683,9 +690,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchProducts, request) ); assert.strictEqual( - ( - client.descriptors.page.searchProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchProducts + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -702,12 +710,13 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchProducts.createStream = - stubPageStreamingCall(undefined, expectedError); + client.descriptors.page.searchProducts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); const stream = client.searchProductsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Product[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Product[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Product) => { @@ -728,9 +737,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchProducts, request) ); assert.strictEqual( - ( - client.descriptors.page.searchProducts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchProducts + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -757,25 +767,25 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Product() ), ]; - client.descriptors.page.searchProducts.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.privatecatalog.v1beta1.IProduct[] = - []; + client.descriptors.page.searchProducts.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.privatecatalog.v1beta1.IProduct[] = []; const iterable = client.searchProductsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - ( - client.descriptors.page.searchProducts.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchProducts + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchProducts + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -792,26 +802,27 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchProducts.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); + client.descriptors.page.searchProducts.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); const iterable = client.searchProductsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.privatecatalog.v1beta1.IProduct[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.IProduct[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - ( - client.descriptors.page.searchProducts.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchProducts + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchProducts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchProducts + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -886,8 +897,9 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Version() ), ]; - client.innerApiCalls.searchVersions = - stubSimpleCallWithCallback(expectedResponse); + client.innerApiCalls.searchVersions = stubSimpleCallWithCallback( + expectedResponse + ); const promise = new Promise((resolve, reject) => { client.searchVersions( request, @@ -967,12 +979,12 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Version() ), ]; - client.descriptors.page.searchVersions.createStream = - stubPageStreamingCall(expectedResponse); + client.descriptors.page.searchVersions.createStream = stubPageStreamingCall( + expectedResponse + ); const stream = client.searchVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Version[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Version[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Version) => { @@ -994,9 +1006,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchVersions, request) ); assert.strictEqual( - ( - client.descriptors.page.searchVersions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchVersions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -1013,12 +1026,13 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchVersions.createStream = - stubPageStreamingCall(undefined, expectedError); + client.descriptors.page.searchVersions.createStream = stubPageStreamingCall( + undefined, + expectedError + ); const stream = client.searchVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.privatecatalog.v1beta1.Version[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.Version[] = []; stream.on( 'data', (response: protos.google.cloud.privatecatalog.v1beta1.Version) => { @@ -1039,9 +1053,10 @@ describe('v1beta1.PrivateCatalogClient', () => { .calledWith(client.innerApiCalls.searchVersions, request) ); assert.strictEqual( - ( - client.descriptors.page.searchVersions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchVersions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -1068,25 +1083,25 @@ describe('v1beta1.PrivateCatalogClient', () => { new protos.google.cloud.privatecatalog.v1beta1.Version() ), ]; - client.descriptors.page.searchVersions.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.privatecatalog.v1beta1.IVersion[] = - []; + client.descriptors.page.searchVersions.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.privatecatalog.v1beta1.IVersion[] = []; const iterable = client.searchVersionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - ( - client.descriptors.page.searchVersions.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchVersions + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchVersions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchVersions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); }); @@ -1103,26 +1118,27 @@ describe('v1beta1.PrivateCatalogClient', () => { request.resource = ''; const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('expected'); - client.descriptors.page.searchVersions.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); + client.descriptors.page.searchVersions.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); const iterable = client.searchVersionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.privatecatalog.v1beta1.IVersion[] = - []; + const responses: protos.google.cloud.privatecatalog.v1beta1.IVersion[] = []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - ( - client.descriptors.page.searchVersions.asyncIterate as SinonStub - ).getCall(0).args[1], + (client.descriptors.page.searchVersions + .asyncIterate as SinonStub).getCall(0).args[1], request ); assert.strictEqual( - ( - client.descriptors.page.searchVersions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + (client.descriptors.page.searchVersions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], expectedHeaderRequestParams ); });