-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tests and samples to library (#5)
* feat: add tests and samples to library * 🦉 Updates from OwlBot 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>
- Loading branch information
1 parent
b612610
commit 58dffce
Showing
6 changed files
with
74 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
{"recurse":true,"skip":["https://codecov.io/gh/googleapis/","www.googleapis.com","img.shields.io"],"silent":true,"concurrency":5} | ||
{ | ||
"recurse": true, | ||
"skip": [ | ||
"https://codecov.io/gh/googleapis/", | ||
"www.googleapis.com", | ||
"img.shields.io", | ||
"https://github.com/googleapis/nodejs-ids/blob/master/CHANGELOG.md", | ||
"https://github.com/googleapis/nodejs-ids/blob/addSamples/CHANGELOG.md" | ||
], | ||
"silent": true, | ||
"concurrency": 5 | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,76 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
'use strict'; | ||
|
||
async function main() { | ||
function main(parent) { | ||
// [START nodejs-ids-quickstart] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent, which owns this collection of endpoints. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Optional. The maximum number of endpoints to return. The service may return fewer | ||
* than this value. | ||
*/ | ||
// const pageSize = 1234 | ||
/** | ||
* Optional. A page token, received from a previous `ListEndpoints` call. | ||
* Provide this to retrieve the subsequent page. | ||
* When paginating, all other parameters provided to `ListEndpoints` must | ||
* match the call that provided the page token. | ||
*/ | ||
// const pageToken = 'abc123' | ||
/** | ||
* Optional. The filter expression, following the syntax outlined in | ||
* https://google.aip.dev/160. | ||
*/ | ||
// const filter = 'abc123' | ||
/** | ||
* Optional. One or more fields to compare and use to sort the output. | ||
* See https://google.aip.dev/132#ordering. | ||
*/ | ||
// const orderBy = 'abc123' | ||
|
||
// [START nodejs_ids_quickstart] | ||
// Imports the Google Cloud client library | ||
// Imports the Ids library | ||
const {IDSClient} = require('@google-cloud/ids').v1; | ||
|
||
// remove this line after package is released | ||
// eslint-disable-next-line node/no-missing-require | ||
const {IDSClient} = require('@google-cloud/ids'); | ||
// Instantiates a client | ||
const idsClient = new IDSClient(); | ||
|
||
// TODO(developer): replace with your prefered project ID. | ||
// const projectId = 'my-project' | ||
async function callListEndpoints() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
}; | ||
|
||
// Creates a client | ||
// eslint-disable-next-line no-unused-vars | ||
const client = new {IDSClient}(); | ||
|
||
//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); | ||
// Run request | ||
const iterable = await idsClient.listEndpointsAsync(request); | ||
for await (const response of iterable) { | ||
console.log(response); | ||
} | ||
} | ||
doSomething(); | ||
// [END nodejs_ids_quickstart] | ||
|
||
callListEndpoints(); | ||
// [END nodejs-ids-quickstart] | ||
} | ||
|
||
main(...process.argv.slice(2)).catch(err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters