Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(contact-center): migrate code from googleapis/nodejs-contact-center-insights #2817

Merged
merged 38 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b659911
feat: initial generation of templated files
sofisl Jun 26, 2021
71e5f5b
feat: add initial samples (#2)
sofisl Jul 1, 2021
8536ada
chore(deps): update dependency mocha to v9 (#3)
renovate-bot Jul 1, 2021
92289cc
chore: release 1.0.0 (#1)
release-please[bot] Jul 1, 2021
5904ed8
chore: release 1.0.1 (#12)
release-please[bot] Jul 12, 2021
10dd49b
chore: release 1.0.2 (#18)
release-please[bot] Jul 23, 2021
4edbd21
chore: release 1.1.0 (#21)
release-please[bot] Jul 30, 2021
a3021a9
chore: release 1.2.0 (#26)
release-please[bot] Aug 11, 2021
8582837
chore: release 1.2.1 (#29)
release-please[bot] Aug 17, 2021
65c8bee
chore: release 1.3.0 (#36)
release-please[bot] Aug 23, 2021
6951ead
chore: release 1.4.0 (#40)
release-please[bot] Aug 30, 2021
13466b6
samples: get operation (#52)
TrucHLe Sep 10, 2021
31d410a
samples: create conversation, create analysis, export data to BigQuer…
TrucHLe Sep 10, 2021
ad2fb2c
samples: enable pubsub notifications (#48)
TrucHLe Sep 13, 2021
fed96eb
samples: modify TTL in create conversation with TTL sample (#57)
TrucHLe Sep 17, 2021
ab4b34d
samples: create topic model (#49)
TrucHLe Sep 20, 2021
871090a
chore: release 1.5.0 (#58)
release-please[bot] Sep 20, 2021
c417f8d
samples: set project-level TTL (#51)
TrucHLe Sep 20, 2021
163873b
samples: create custom highlights (#53)
TrucHLe Sep 20, 2021
3d48cdb
chore: release 1.6.0 (#65)
release-please[bot] Sep 28, 2021
79dac6e
chore: release 1.7.0 (#69)
release-please[bot] Oct 13, 2021
867ec72
chore: release 1.8.0 (#75)
release-please[bot] Nov 8, 2021
f47beb9
chore: release 1.9.0 (#81)
release-please[bot] Dec 3, 2021
8352d78
chore(main): release 1.11.0 (#107)
release-please[bot] Mar 23, 2022
aefe463
build: add retries for flaky test (#109)
sofisl Mar 31, 2022
0a175ae
build!: update library to use Node 12 (#122)
sofisl May 12, 2022
bcbf9fd
chore(main): release 2.0.0 (#124)
release-please[bot] May 12, 2022
e7ec272
fix(deps): update dependency @google-cloud/bigquery to v6 (#127)
renovate-bot Jun 7, 2022
fbd1da9
fix(deps): update dependency @google-cloud/pubsub to v3 (#126)
renovate-bot Jun 7, 2022
46a506b
chore(main): release 2.0.1 (#129)
release-please[bot] Jun 7, 2022
3ce4084
chore(main): release 2.1.0 (#134)
release-please[bot] Jul 5, 2022
9bc17b1
chore(main): release 2.1.1 (#139)
release-please[bot] Sep 8, 2022
aa0266d
chore(deps): update dependency uuid to v9 (#142)
renovate-bot Sep 8, 2022
9ea4b3c
Merge remote-tracking branch 'migration/main' into nodejs-contact-cen…
telpirion Nov 9, 2022
b3f5164
add workflows
telpirion Nov 9, 2022
d7e9ced
test fix
telpirion Nov 9, 2022
f6e5c5f
codeowners
telpirion Nov 9, 2022
6a88e53
more codeowners
telpirion Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/contact-center-insights.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: contact-center-insights
on:
push:
branches:
- main
paths:
- 'contact-center-insights/**'
pull_request:
paths:
- 'contact-center-insights/**'
pull_request_target:
types: [labeled]
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: 'google-github-actions/[email protected]'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: '[email protected]'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: contact-center-insights
- run: npm test
working-directory: contact-center-insights
env:
MOCHA_REPORTER_SUITENAME: contact_center_insights
MOCHA_REPORTER_OUTPUT: contact_center_insights_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
3 changes: 2 additions & 1 deletion .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
"datacatalog/cloud-client",
"datacatalog/quickstart",
"datastore/functions",
"talent"
"talent",
"contact-center-insights"
]
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ composer @leahecole @sofisl @GoogleCloudPlatform/nodejs-samples-reviewers
healthcare @noerog @GoogleCloudPlatform/nodejs-samples-reviewers
monitoring/opencensus @GoogleCloudPlatform/nodejs-samples-reviewers

# Data & AI
contact-center-insights @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers
talent @GoogleCloudPlatform/dee-data-ai @GoogleCloudPlatform/nodejs-samples-reviewers
50 changes: 50 additions & 0 deletions contact-center-insights/createAnalysis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// 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
//
// 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';

function main(conversationName) {
// [START contactcenterinsights_create_analysis]
/**
* TODO(developer): Uncomment this variable before running the sample.
*/
// const conversationName = 'projects/my_project_id/locations/us-central1/conversations/my_conversation_id';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createAnalysis() {
const [operation] = await client.createAnalysis({
parent: conversationName,
});

// Wait for the operation to complete.
const [analysis] = await operation.promise();
console.info(`Created ${analysis.name}`);
}
createAnalysis();
// [END contactcenterinsights_create_analysis]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
62 changes: 62 additions & 0 deletions contact-center-insights/createConversation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// 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
//
// 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';

function main(
projectId,
transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json',
audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt'
) {
// [START contactcenterinsights_create_conversation]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my_project_id';
// const transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json';
// const audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createConversation() {
const [conversation] = await client.createConversation({
parent: client.locationPath(projectId, 'us-central1'),
conversation: {
dataSource: {
gcsSource: {
transcriptUri: transcriptUri,
audioUri: audioUri,
},
},
medium: 'CHAT',
},
});
console.info(`Created ${conversation.name}`);
}
createConversation();
// [END contactcenterinsights_create_conversation]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
65 changes: 65 additions & 0 deletions contact-center-insights/createConversationWithTtl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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
//
// 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';

function main(
projectId,
transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json',
audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt'
) {
// [START contactcenterinsights_create_conversation_with_ttl]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'my_project_id';
// const transcriptUri = 'gs://cloud-samples-data/ccai/chat_sample.json';
// const audioUri = 'gs://cloud-samples-data/ccai/voice_6912.txt';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createConversationWithTtl() {
const [conversation] = await client.createConversation({
parent: client.locationPath(projectId, 'us-central1'),
conversation: {
dataSource: {
gcsSource: {
transcriptUri: transcriptUri,
audioUri: audioUri,
},
},
medium: 'CHAT',
ttl: {
seconds: 86400,
},
},
});
console.info(`Created ${conversation.name}`);
}
createConversationWithTtl();
// [END contactcenterinsights_create_conversation_with_ttl]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
56 changes: 56 additions & 0 deletions contact-center-insights/createIssueModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// 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
//
// 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';

function main(projectId) {
// [START contactcenterinsights_create_issue_model]
/**
* TODO(developer): Uncomment this variable before running the sample.
*/
// const projectId = 'my_project_id';

// Imports the Contact Center Insights client.
const {
ContactCenterInsightsClient,
} = require('@google-cloud/contact-center-insights');

// Instantiates a client.
const client = new ContactCenterInsightsClient();

async function createIssueModel() {
const [operation] = await client.createIssueModel({
parent: client.locationPath(projectId, 'us-central1'),
issueModel: {
displayName: 'my-model',
inputDataConfig: {
filter: 'medium="CHAT"',
},
},
});

// Wait for the operation to complete.
const [issueModel] = await operation.promise();
console.info(`Created ${issueModel.name}`);
}
createIssueModel();
// [END contactcenterinsights_create_issue_model]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading