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

Commit

Permalink
feat: add initial samples (#2)
Browse files Browse the repository at this point in the history
* feat: add initial samples

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
sofisl and gcf-owl-bot[bot] committed Jul 1, 2021
1 parent 17259ab commit 5e1fb71
Show file tree
Hide file tree
Showing 27 changed files with 197 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

docker:
digest: sha256:
digest: sha256:72a7e410f5a01056b96eafd31021ae45c59abcf9152aabe555377fb784e9c17e
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for stopping by to let us know something could be better!
This is the client library for . We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the [ Support page]() to reach the most relevant engineers.

2) Did someone already solve this?
- Search the issues already opened: https://github.com/googleapis/googleapis/issues
- Search the issues already opened: https://github.com/googleapis/nodejs-contact-center-insights/issues
- Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-node
- Search or ask on StackOverflow (engineers monitor these tags): http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- run: rm -rf node_modules
- run: npm install
- run: npm test
env:
MOCHA_THROW_DEPRECATION: false
windows:
runs-on: windows-latest
steps:
Expand All @@ -33,6 +35,8 @@ jobs:
node-version: 14
- run: npm install
- run: npm test
env:
MOCHA_THROW_DEPRECATION: false
lint:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .kokoro/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/continuous/node10/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node10/docs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/continuous/node12/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/lint.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/samples-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/continuous/node12/system-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/presubmit/node10/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/presubmit/node12/common.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/presubmit/node12/samples-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .kokoro/presubmit/node12/system-test.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/docs-devsite.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/docs.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .kokoro/release/publish.cfg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .kokoro/test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -55,6 +55,42 @@ npm install @google-cloud/contact-center-insights
```


### 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 {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// TODO(developer): replace with your prefered project ID.
// const projectId = 'my-project'

const client = new ContactCenterInsightsClient();

//TODO(library generator): write the actual function you will be testing
async function listConversations() {
const conversations = await client.listConversations({
parent: `projects/${projectId}/locations/${location}`,
});
console.info(conversations);
}
listConversations();

```



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/nodejs-contact-center-insights/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-contact-center-insights/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-contact-center-insights&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |



Expand Down
13 changes: 12 additions & 1 deletion linkinator.config.json
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":10}
{
"recurse": true,
"skip": [
"https://github.com/googleapis/nodejs-contact-center-insights/blob/master/CHANGELOG.md",
"https://cloud.google.com/dialogflow/priv/docs/insights/",
"https://codecov.io/gh/googleapis/",
"www.googleapis.com",
"img.shields.io"
],
"silent": true,
"concurrency": 10
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@google-cloud/contact-center-insights",
"version": "0.1.0",
"description": "contactcenterinsights client for Node.js",
"repository": "googleapis/googleapis/nodejs-contact-center-insights",
"repository": "googleapis/nodejs-contact-center-insights",
"license": "Apache-2.0",
"author": "Google LLC",
"main": "build/src/index.js",
Expand Down
50 changes: 50 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -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`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# [Contact Center AI Insights API: Node.js Samples](https://github.com/googleapis/nodejs-contact-center-insights)

[![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-contact-center-insights#using-the-client-library).

`cd samples`

`npm install`

`cd ..`

## Samples



### Quickstart

View the [source code](https://github.com/googleapis/nodejs-contact-center-insights/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-contact-center-insights&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-contact-center-insights&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/dialogflow/priv/docs/insights/
23 changes: 11 additions & 12 deletions samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,29 @@

'use strict';

async function main() {

async function main(projectId, location) {
// [START nodejs_contact_center_insights_quickstart]
// Imports the Google Cloud client library

// remove this line after package is released
// eslint-disable-next-line node/no-missing-require
const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights');
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// 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 {ContactCenterInsightsClient}();
const client = new ContactCenterInsightsClient();

//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);
async function listConversations() {
const conversations = await client.listConversations({
parent: `projects/${projectId}/locations/${location}`,
});
console.info(conversations);
}
doSomething();
listConversations();
// [END nodejs_contact_center_insights_quickstart]
}

Expand Down
Loading

0 comments on commit 5e1fb71

Please sign in to comment.