From 6a94b5e1d45120cad0900a701481c43c9761d53e Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Mon, 20 Sep 2021 19:31:40 -0400 Subject: [PATCH 01/10] samples: create custom highlights (#15) --- .../snippets/create_phrase_matcher_all_of.py | 74 +++++++++++++++++++ .../snippets/create_phrase_matcher_any_of.py | 58 +++++++++++++++ samples/snippets/noxfile.py | 44 ++++++----- samples/snippets/requirements-test.txt | 2 +- samples/snippets/requirements.txt | 2 +- .../test_create_phrase_matcher_all_of.py | 50 +++++++++++++ .../test_create_phrase_matcher_any_of.py | 50 +++++++++++++ 7 files changed, 259 insertions(+), 21 deletions(-) create mode 100644 samples/snippets/create_phrase_matcher_all_of.py create mode 100644 samples/snippets/create_phrase_matcher_any_of.py create mode 100644 samples/snippets/test_create_phrase_matcher_all_of.py create mode 100644 samples/snippets/test_create_phrase_matcher_any_of.py diff --git a/samples/snippets/create_phrase_matcher_all_of.py b/samples/snippets/create_phrase_matcher_all_of.py new file mode 100644 index 0000000..0824bc8 --- /dev/null +++ b/samples/snippets/create_phrase_matcher_all_of.py @@ -0,0 +1,74 @@ +# 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 +# +# 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. +# +# [START contactcenterinsights_create_phrase_matcher_all_of] +from google.cloud import contact_center_insights_v1 + + +def create_phrase_matcher_all_of( + project_id: str, +) -> contact_center_insights_v1.PhraseMatcher: + # Construct a parent resource. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + # Construct a phrase matcher that matches all of its rule groups. + phrase_matcher = contact_center_insights_v1.PhraseMatcher() + phrase_matcher.display_name = "NON_SHIPPING_PHONE_SERVICE" + phrase_matcher.type_ = ( + contact_center_insights_v1.PhraseMatcher.PhraseMatcherType.ALL_OF + ) + phrase_matcher.active = True + + # Construct a rule group to match the word "PHONE" or "CELLPHONE", ignoring case sensitivity. + rule_group_phone_or_cellphone = contact_center_insights_v1.PhraseMatchRuleGroup() + rule_group_phone_or_cellphone.type_ = ( + contact_center_insights_v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType.ANY_OF + ) + + for word in ["PHONE", "CELLPHONE"]: + rule = contact_center_insights_v1.PhraseMatchRule() + rule.query = word + rule.config.exact_match_config = contact_center_insights_v1.ExactMatchConfig() + rule_group_phone_or_cellphone.phrase_match_rules.append(rule) + phrase_matcher.phrase_match_rule_groups.append(rule_group_phone_or_cellphone) + + # Construct another rule group to not match the word "SHIPPING" or "DELIVERY", ignoring case sensitivity. + rule_group_not_shipping_or_delivery = ( + contact_center_insights_v1.PhraseMatchRuleGroup() + ) + rule_group_not_shipping_or_delivery.type_ = ( + contact_center_insights_v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType.ALL_OF + ) + + for word in ["SHIPPING", "DELIVERY"]: + rule = contact_center_insights_v1.PhraseMatchRule() + rule.query = word + rule.negated = True + rule.config.exact_match_config = contact_center_insights_v1.ExactMatchConfig() + rule_group_not_shipping_or_delivery.phrase_match_rules.append(rule) + phrase_matcher.phrase_match_rule_groups.append(rule_group_not_shipping_or_delivery) + + # Call the Insights client to create a phrase matcher. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + phrase_matcher = insights_client.create_phrase_matcher( + parent=parent, phrase_matcher=phrase_matcher + ) + + print(f"Created {phrase_matcher.name}") + return phrase_matcher + + +# [END contactcenterinsights_create_phrase_matcher_all_of] diff --git a/samples/snippets/create_phrase_matcher_any_of.py b/samples/snippets/create_phrase_matcher_any_of.py new file mode 100644 index 0000000..33de08b --- /dev/null +++ b/samples/snippets/create_phrase_matcher_any_of.py @@ -0,0 +1,58 @@ +# 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 +# +# 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. +# +# [START contactcenterinsights_create_phrase_matcher_any_of] +from google.cloud import contact_center_insights_v1 + + +def create_phrase_matcher_any_of( + project_id: str, +) -> contact_center_insights_v1.PhraseMatcher: + # Construct a parent resource. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + # Construct a phrase matcher that matches any of its rule groups. + phrase_matcher = contact_center_insights_v1.PhraseMatcher() + phrase_matcher.display_name = "PHONE_SERVICE" + phrase_matcher.type_ = ( + contact_center_insights_v1.PhraseMatcher.PhraseMatcherType.ANY_OF + ) + phrase_matcher.active = True + + # Construct a rule group to match the word "PHONE" or "CELLPHONE", ignoring case sensitivity. + rule_group = contact_center_insights_v1.PhraseMatchRuleGroup() + rule_group.type_ = ( + contact_center_insights_v1.PhraseMatchRuleGroup.PhraseMatchRuleGroupType.ANY_OF + ) + + for word in ["PHONE", "CELLPHONE"]: + rule = contact_center_insights_v1.PhraseMatchRule() + rule.query = word + rule.config.exact_match_config = contact_center_insights_v1.ExactMatchConfig() + rule_group.phrase_match_rules.append(rule) + phrase_matcher.phrase_match_rule_groups.append(rule_group) + + # Call the Insights client to create a phrase matcher. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + phrase_matcher = insights_client.create_phrase_matcher( + parent=parent, phrase_matcher=phrase_matcher + ) + + print(f"Created {phrase_matcher.name}") + return phrase_matcher + + +# [END contactcenterinsights_create_phrase_matcher_any_of] diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index e73436a..b008613 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -39,17 +39,15 @@ TEST_CONFIG = { # You can opt out from the test for specific Python versions. - 'ignored_versions': [], - + "ignored_versions": [], # Old samples are opted out of enforcing Python type hints # All new samples should feature them - 'enforce_type_hints': False, - + "enforce_type_hints": False, # An envvar key for determining the project id to use. Change it # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a # build specific Cloud project. You can also use your own string # to use your own Cloud project. - 'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT', + "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', # If you need to use a specific version of pip, # change pip_version_override to the string representation @@ -57,13 +55,13 @@ "pip_version_override": None, # A dictionary you want to inject into your test. Don't put any # secrets here. These values will override predefined values. - 'envs': {}, + "envs": {}, } try: # Ensure we can import noxfile_config in the project's directory. - sys.path.append('.') + sys.path.append(".") from noxfile_config import TEST_CONFIG_OVERRIDE except ImportError as e: print("No user noxfile_config found: detail: {}".format(e)) @@ -78,12 +76,12 @@ def get_pytest_env_vars() -> Dict[str, str]: ret = {} # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG['gcloud_project_env'] + env_key = TEST_CONFIG["gcloud_project_env"] # This should error out if not set. - ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key] + ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] # Apply user supplied envs. - ret.update(TEST_CONFIG['envs']) + ret.update(TEST_CONFIG["envs"]) return ret @@ -92,11 +90,14 @@ def get_pytest_env_vars() -> Dict[str, str]: ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. -IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] +IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true") +INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( + "True", + "true", +) # # Style Checks # @@ -141,7 +142,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]: @nox.session def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG['enforce_type_hints']: + if not TEST_CONFIG["enforce_type_hints"]: session.install("flake8", "flake8-import-order") else: session.install("flake8", "flake8-import-order", "flake8-annotations") @@ -150,9 +151,11 @@ def lint(session: nox.sessions.Session) -> None: args = FLAKE8_COMMON_ARGS + [ "--application-import-names", ",".join(local_names), - "." + ".", ] session.run("flake8", *args) + + # # Black # @@ -165,6 +168,7 @@ def blacken(session: nox.sessions.Session) -> None: session.run("black", *python_files) + # # Sample Tests # @@ -173,7 +177,9 @@ def blacken(session: nox.sessions.Session) -> None: PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] -def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: +def _session_tests( + session: nox.sessions.Session, post_install: Callable = None +) -> None: if TEST_CONFIG["pip_version_override"]: pip_version = TEST_CONFIG["pip_version_override"] session.install(f"pip=={pip_version}") @@ -203,7 +209,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None) # on travis where slow and flaky tests are excluded. # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html success_codes=[0, 5], - env=get_pytest_env_vars() + env=get_pytest_env_vars(), ) @@ -213,9 +219,9 @@ def py(session: nox.sessions.Session) -> None: if session.python in TESTED_VERSIONS: _session_tests(session) else: - session.skip("SKIPPED: {} tests are disabled for this sample.".format( - session.python - )) + session.skip( + "SKIPPED: {} tests are disabled for this sample.".format(session.python) + ) # diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 50c7358..63777ec 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,4 +1,4 @@ google-auth==2.0.2 google-cloud-pubsub==2.8.0 protobuf==3.17.3 -pytest==6.2.5 +pytest==6.2.5 \ No newline at end of file diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index b9e6105..9eaeba8 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ google-api-core==2.0.1 google-cloud-bigquery==2.26.0 -google-cloud-contact-center-insights==0.2.0 +google-cloud-contact-center-insights==0.2.0 \ No newline at end of file diff --git a/samples/snippets/test_create_phrase_matcher_all_of.py b/samples/snippets/test_create_phrase_matcher_all_of.py new file mode 100644 index 0000000..888d959 --- /dev/null +++ b/samples/snippets/test_create_phrase_matcher_all_of.py @@ -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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_phrase_matcher_all_of + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def insights_client(): + return contact_center_insights_v1.ContactCenterInsightsClient() + + +@pytest.fixture +def phrase_matcher_all_of(project_id, insights_client): + # Create a phrase matcher. + phrase_matcher = create_phrase_matcher_all_of.create_phrase_matcher_all_of( + project_id + ) + yield phrase_matcher + + # Delete the phrase matcher. + insights_client.delete_phrase_matcher(name=phrase_matcher.name) + + +def test_create_phrase_matcher_all_of(capsys, phrase_matcher_all_of): + phrase_matcher = phrase_matcher_all_of + out, err = capsys.readouterr() + assert f"Created {phrase_matcher.name}" in out diff --git a/samples/snippets/test_create_phrase_matcher_any_of.py b/samples/snippets/test_create_phrase_matcher_any_of.py new file mode 100644 index 0000000..0e0f199 --- /dev/null +++ b/samples/snippets/test_create_phrase_matcher_any_of.py @@ -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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_phrase_matcher_any_of + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def insights_client(): + return contact_center_insights_v1.ContactCenterInsightsClient() + + +@pytest.fixture +def phrase_matcher_any_of(project_id, insights_client): + # Create a phrase matcher. + phrase_matcher = create_phrase_matcher_any_of.create_phrase_matcher_any_of( + project_id + ) + yield phrase_matcher + + # Delete the phrase matcher. + insights_client.delete_phrase_matcher(name=phrase_matcher.name) + + +def test_create_phrase_matcher_any_of(capsys, phrase_matcher_any_of): + phrase_matcher = phrase_matcher_any_of + out, err = capsys.readouterr() + assert f"Created {phrase_matcher.name}" in out From 3b96c23ba0378b9c30c11673e9b2dcfdb1917015 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Tue, 21 Sep 2021 12:40:34 -0700 Subject: [PATCH 02/10] chore: relocate owl bot post processor (#50) chore: relocate owl bot post processor --- .github/.OwlBot.lock.yaml | 4 ++-- .github/.OwlBot.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index c07f148..2567653 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest + digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 9e8fa6f..69c8030 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -13,7 +13,7 @@ # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest deep-remove-regex: - /owl-bot-staging From bb2729ca5ecad67dacdfe854aa013a5b64c01aa0 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:02:54 -0400 Subject: [PATCH 03/10] samples: set project-level TTL (#23) --- samples/snippets/requirements.txt | 3 +- samples/snippets/set_project_ttl.py | 53 ++++++++++++++++++++++++ samples/snippets/test_set_project_ttl.py | 49 ++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 samples/snippets/set_project_ttl.py create mode 100644 samples/snippets/test_set_project_ttl.py diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 9eaeba8..e3aa4be 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,4 @@ google-api-core==2.0.1 google-cloud-bigquery==2.26.0 -google-cloud-contact-center-insights==0.2.0 \ No newline at end of file +google-cloud-contact-center-insights==0.2.0 +protobuf==3.17.3 \ No newline at end of file diff --git a/samples/snippets/set_project_ttl.py b/samples/snippets/set_project_ttl.py new file mode 100644 index 0000000..f3a98fe --- /dev/null +++ b/samples/snippets/set_project_ttl.py @@ -0,0 +1,53 @@ +# 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 +# +# 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. +# +# Set a project-level TTL for all incoming conversations. +# [START contactcenterinsights_set_project_ttl] +from google.api_core import protobuf_helpers +from google.cloud import contact_center_insights_v1 +from google.protobuf import duration_pb2 + + +def set_project_ttl(project_id: str) -> None: + # Construct a settings resource. + settings = contact_center_insights_v1.Settings() + settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path( + project_id, "us-central1" + ) + + conversation_ttl = duration_pb2.Duration() + conversation_ttl.seconds = 86400 + settings.conversation_ttl = conversation_ttl + + # Construct an update mask to only update the fields that are set on the settings resource. + update_mask = protobuf_helpers.field_mask(None, type(settings).pb(settings)) + + # Construct an Insights client that will authenticate via Application Default Credentials. + # See authentication details at https://cloud.google.com/docs/authentication/production. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + + # Call the Insights client to set a project-level TTL. + insights_client.update_settings(settings=settings, update_mask=update_mask) + + # Call the Insights client to get the project-level TTL to confirm that it was set. + new_conversation_ttl = insights_client.get_settings( + name=settings.name + ).conversation_ttl + print( + "Set TTL for all incoming conversations to {} day".format( + new_conversation_ttl.days + ) + ) + +# [END contactcenterinsights_set_project_ttl] diff --git a/samples/snippets/test_set_project_ttl.py b/samples/snippets/test_set_project_ttl.py new file mode 100644 index 0000000..50605b5 --- /dev/null +++ b/samples/snippets/test_set_project_ttl.py @@ -0,0 +1,49 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 +from google.protobuf import field_mask_pb2 + +import pytest + +import set_project_ttl + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def clear_project_ttl(project_id): + yield + settings = contact_center_insights_v1.Settings() + settings.name = contact_center_insights_v1.ContactCenterInsightsClient.settings_path( + project_id, "us-central1" + ) + settings.conversation_ttl = None + update_mask = field_mask_pb2.FieldMask() + update_mask.paths.append("conversation_ttl") + + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + insights_client.update_settings(settings=settings, update_mask=update_mask) + + +def test_set_project_ttl(capsys, project_id, clear_project_ttl): + set_project_ttl.set_project_ttl(project_id) + out, err = capsys.readouterr() + assert "Set TTL for all incoming conversations to 1 day" in out From 75d646eded2f2eef59bd7b67125c9189361ad483 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:14:36 -0400 Subject: [PATCH 04/10] samples: create topic model (#28) --- samples/snippets/create_issue_model.py | 41 ++++++++++++ samples/snippets/test_create_issue_model.py | 70 +++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 samples/snippets/create_issue_model.py create mode 100644 samples/snippets/test_create_issue_model.py diff --git a/samples/snippets/create_issue_model.py b/samples/snippets/create_issue_model.py new file mode 100644 index 0000000..4568cc4 --- /dev/null +++ b/samples/snippets/create_issue_model.py @@ -0,0 +1,41 @@ +# 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 +# +# 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. +# +# [START contactcenterinsights_create_issue_model] +from google.cloud import contact_center_insights_v1 + + +def create_issue_model(project_id: str) -> contact_center_insights_v1.IssueModel: + # Construct a parent resource. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + # Construct an issue model. + issue_model = contact_center_insights_v1.IssueModel() + issue_model.display_name = "my-model" + issue_model.input_data_config.filter = "medium=\"CHAT\"" + + # Call the Insights client to create an issue model. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + issue_model_operation = insights_client.create_issue_model( + parent=parent, issue_model=issue_model + ) + + issue_model = issue_model_operation.result(timeout=86400) + print(f"Created an issue model named {issue_model.name}") + return issue_model + + +# [END contactcenterinsights_create_issue_model] diff --git a/samples/snippets/test_create_issue_model.py b/samples/snippets/test_create_issue_model.py new file mode 100644 index 0000000..ffa60e4 --- /dev/null +++ b/samples/snippets/test_create_issue_model.py @@ -0,0 +1,70 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_issue_model + +MIN_CONVERSATION_COUNT = 10000 + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def insights_client(): + return contact_center_insights_v1.ContactCenterInsightsClient() + + +@pytest.fixture +def count_conversations(project_id, insights_client): + # Check if the project has the minimum number of conversations required to create an issue model. + # See https://cloud.google.com/contact-center/insights/docs/topic-model. + list_request = contact_center_insights_v1.ListConversationsRequest() + list_request.page_size = 1000 + list_request.parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + conversations = insights_client.list_conversations(request=list_request) + conversation_count = len(list(conversations)) + + yield conversation_count + + +@pytest.fixture +def issue_model_resource(project_id, insights_client, count_conversations): + conversation_count = count_conversations + if conversation_count >= MIN_CONVERSATION_COUNT: + # Create an issue model. + issue_model = create_issue_model.create_issue_model(project_id) + yield issue_model + + # Delete the issue model. + insights_client.delete_issue_model(name=issue_model.name) + else: + yield None + + +def test_create_issue_model(capsys, issue_model_resource): + issue_model = issue_model_resource + if issue_model: + out, err = capsys.readouterr() + assert "Created {}".format(issue_model.name) in out From 8ae8c94ab1f31bd2e8eb11703aec6e355a3fe5b6 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:46:20 -0400 Subject: [PATCH 05/10] samples: create conversation (#42) --- samples/snippets/create_conversation.py | 45 ++++++++++++++++++++ samples/snippets/test_create_conversation.py | 44 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 samples/snippets/create_conversation.py create mode 100644 samples/snippets/test_create_conversation.py diff --git a/samples/snippets/create_conversation.py b/samples/snippets/create_conversation.py new file mode 100644 index 0000000..d7fa5a0 --- /dev/null +++ b/samples/snippets/create_conversation.py @@ -0,0 +1,45 @@ +# 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 +# +# 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. +# +# [START contactcenterinsights_create_conversation] +from google.cloud import contact_center_insights_v1 + + +def create_conversation( + project_id: str, + transcript_uri: str = "gs://cloud-samples-data/ccai/chat_sample.json", + audio_uri: str = "gs://cloud-samples-data/ccai/voice_6912.txt", +) -> contact_center_insights_v1.Conversation: + # Construct a parent resource. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + # Construct a conversation. + conversation = contact_center_insights_v1.Conversation() + conversation.data_source.gcs_source.transcript_uri = transcript_uri + conversation.data_source.gcs_source.audio_uri = audio_uri + conversation.medium = contact_center_insights_v1.Conversation.Medium.CHAT + + # Call the Insights client to create a conversation. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + conversation = insights_client.create_conversation( + parent=parent, conversation=conversation + ) + + print(f"Created {conversation.name}") + return conversation + + +# [END contactcenterinsights_create_conversation] diff --git a/samples/snippets/test_create_conversation.py b/samples/snippets/test_create_conversation.py new file mode 100644 index 0000000..1553ff8 --- /dev/null +++ b/samples/snippets/test_create_conversation.py @@ -0,0 +1,44 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_conversation + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def conversation_resource(project_id): + # Create a conversation + conversation = create_conversation.create_conversation(project_id) + yield conversation + + # Delete the conversation. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + insights_client.delete_conversation(name=conversation.name) + + +def test_create_conversation(capsys, conversation_resource): + conversation = conversation_resource + out, err = capsys.readouterr() + assert "Created {}".format(conversation.name) in out From 04ae533f7bd66411f532633b1aa06155b6cc9da2 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Thu, 23 Sep 2021 15:06:49 -0400 Subject: [PATCH 06/10] samples: create analysis (#44) --- samples/snippets/create_analysis.py | 33 ++++++++++++ samples/snippets/test_create_analysis.py | 68 ++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 samples/snippets/create_analysis.py create mode 100644 samples/snippets/test_create_analysis.py diff --git a/samples/snippets/create_analysis.py b/samples/snippets/create_analysis.py new file mode 100644 index 0000000..c334737 --- /dev/null +++ b/samples/snippets/create_analysis.py @@ -0,0 +1,33 @@ +# 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 +# +# 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. +# +# [START contactcenterinsights_create_analysis] +from google.cloud import contact_center_insights_v1 + + +def create_analysis(conversation_name: str) -> contact_center_insights_v1.Analysis: + # Construct an analysis. + analysis = contact_center_insights_v1.Analysis() + + # Call the Insights client to create an analysis. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + analysis_operation = insights_client.create_analysis( + parent=conversation_name, analysis=analysis + ) + analysis = analysis_operation.result(timeout=86400) + print(f"Created {analysis.name}") + return analysis + + +# [END contactcenterinsights_create_analysis] diff --git a/samples/snippets/test_create_analysis.py b/samples/snippets/test_create_analysis.py new file mode 100644 index 0000000..df41dbd --- /dev/null +++ b/samples/snippets/test_create_analysis.py @@ -0,0 +1,68 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_analysis + +TRANSCRIPT_URI = "gs://cloud-samples-data/ccai/chat_sample.json" +AUDIO_URI = "gs://cloud-samples-data/ccai/voice_6912.txt" + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def conversation_resource(project_id): + # Create a conversation. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + conversation = contact_center_insights_v1.Conversation() + conversation.data_source.gcs_source.transcript_uri = TRANSCRIPT_URI + conversation.data_source.gcs_source.audio_uri = AUDIO_URI + conversation.medium = contact_center_insights_v1.Conversation.Medium.CHAT + + conversation = insights_client.create_conversation( + parent=parent, conversation=conversation + ) + yield conversation + + # Delete the conversation. + delete_request = contact_center_insights_v1.DeleteConversationRequest() + delete_request.name = conversation.name + delete_request.force = True + insights_client.delete_conversation(request=delete_request) + + +@pytest.fixture +def analysis_resource(conversation_resource): + conversation_name = conversation_resource.name + yield create_analysis.create_analysis(conversation_name) + + +def test_create_analysis(capsys, analysis_resource): + analysis = analysis_resource + out, err = capsys.readouterr() + assert "Created {}".format(analysis.name) in out From 94e64acc866eeed789768c2e216dad3f561c81e3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 15:14:18 +0000 Subject: [PATCH 07/10] chore: use gapic-generator-python 0.51.2 (#51) - [ ] Regenerate this pull request now. fix: add 'dict' annotation type to 'request' Committer: @busunkim96 PiperOrigin-RevId: 398509016 Source-Link: https://github.com/googleapis/googleapis/commit/b224dfa52642a733ea64849d4e06d15c274bc08f Source-Link: https://github.com/googleapis/googleapis-gen/commit/63a1db7a38d74b9639592f521ed1daaf7299ad9a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjNhMWRiN2EzOGQ3NGI5NjM5NTkyZjUyMWVkMWRhYWY3Mjk5YWQ5YSJ9 --- .../contact_center_insights/client.py | 116 +++++++++--------- .../transports/base.py | 2 +- .../transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- ...xup_contact_center_insights_v1_keywords.py | 58 ++++----- 5 files changed, 95 insertions(+), 93 deletions(-) diff --git a/google/cloud/contact_center_insights_v1/services/contact_center_insights/client.py b/google/cloud/contact_center_insights_v1/services/contact_center_insights/client.py index 258ebf3..a6722e2 100644 --- a/google/cloud/contact_center_insights_v1/services/contact_center_insights/client.py +++ b/google/cloud/contact_center_insights_v1/services/contact_center_insights/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -465,7 +465,7 @@ def __init__( def create_conversation( self, - request: contact_center_insights.CreateConversationRequest = None, + request: Union[contact_center_insights.CreateConversationRequest, dict] = None, *, parent: str = None, conversation: resources.Conversation = None, @@ -477,7 +477,7 @@ def create_conversation( r"""Creates a conversation. Args: - request (google.cloud.contact_center_insights_v1.types.CreateConversationRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CreateConversationRequest, dict]): The request object. Request to create a conversation. parent (str): Required. The parent resource of the @@ -559,7 +559,7 @@ def create_conversation( def update_conversation( self, - request: contact_center_insights.UpdateConversationRequest = None, + request: Union[contact_center_insights.UpdateConversationRequest, dict] = None, *, conversation: resources.Conversation = None, update_mask: field_mask_pb2.FieldMask = None, @@ -570,7 +570,7 @@ def update_conversation( r"""Updates a conversation. Args: - request (google.cloud.contact_center_insights_v1.types.UpdateConversationRequest): + request (Union[google.cloud.contact_center_insights_v1.types.UpdateConversationRequest, dict]): The request object. The request to update a conversation. conversation (google.cloud.contact_center_insights_v1.types.Conversation): @@ -638,7 +638,7 @@ def update_conversation( def get_conversation( self, - request: contact_center_insights.GetConversationRequest = None, + request: Union[contact_center_insights.GetConversationRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -648,7 +648,7 @@ def get_conversation( r"""Gets a conversation. Args: - request (google.cloud.contact_center_insights_v1.types.GetConversationRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetConversationRequest, dict]): The request object. The request to get a conversation. name (str): Required. The name of the @@ -706,7 +706,7 @@ def get_conversation( def list_conversations( self, - request: contact_center_insights.ListConversationsRequest = None, + request: Union[contact_center_insights.ListConversationsRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -716,7 +716,7 @@ def list_conversations( r"""Lists conversations. Args: - request (google.cloud.contact_center_insights_v1.types.ListConversationsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ListConversationsRequest, dict]): The request object. Request to list conversations. parent (str): Required. The parent resource of the @@ -785,7 +785,7 @@ def list_conversations( def delete_conversation( self, - request: contact_center_insights.DeleteConversationRequest = None, + request: Union[contact_center_insights.DeleteConversationRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -795,7 +795,7 @@ def delete_conversation( r"""Deletes a conversation. Args: - request (google.cloud.contact_center_insights_v1.types.DeleteConversationRequest): + request (Union[google.cloud.contact_center_insights_v1.types.DeleteConversationRequest, dict]): The request object. The request to delete a conversation. name (str): @@ -849,7 +849,7 @@ def delete_conversation( def create_analysis( self, - request: contact_center_insights.CreateAnalysisRequest = None, + request: Union[contact_center_insights.CreateAnalysisRequest, dict] = None, *, parent: str = None, analysis: resources.Analysis = None, @@ -861,7 +861,7 @@ def create_analysis( done when the analysis has completed. Args: - request (google.cloud.contact_center_insights_v1.types.CreateAnalysisRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CreateAnalysisRequest, dict]): The request object. The request to create an analysis. parent (str): Required. The parent resource of the @@ -939,7 +939,7 @@ def create_analysis( def get_analysis( self, - request: contact_center_insights.GetAnalysisRequest = None, + request: Union[contact_center_insights.GetAnalysisRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -949,7 +949,7 @@ def get_analysis( r"""Gets an analysis. Args: - request (google.cloud.contact_center_insights_v1.types.GetAnalysisRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetAnalysisRequest, dict]): The request object. The request to get an analysis. name (str): Required. The name of the analysis to @@ -1007,7 +1007,7 @@ def get_analysis( def list_analyses( self, - request: contact_center_insights.ListAnalysesRequest = None, + request: Union[contact_center_insights.ListAnalysesRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1017,7 +1017,7 @@ def list_analyses( r"""Lists analyses. Args: - request (google.cloud.contact_center_insights_v1.types.ListAnalysesRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ListAnalysesRequest, dict]): The request object. The request to list analyses. parent (str): Required. The parent resource of the @@ -1085,7 +1085,7 @@ def list_analyses( def delete_analysis( self, - request: contact_center_insights.DeleteAnalysisRequest = None, + request: Union[contact_center_insights.DeleteAnalysisRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1095,7 +1095,7 @@ def delete_analysis( r"""Deletes an analysis. Args: - request (google.cloud.contact_center_insights_v1.types.DeleteAnalysisRequest): + request (Union[google.cloud.contact_center_insights_v1.types.DeleteAnalysisRequest, dict]): The request object. The request to delete an analysis. name (str): Required. The name of the analysis to @@ -1148,7 +1148,7 @@ def delete_analysis( def export_insights_data( self, - request: contact_center_insights.ExportInsightsDataRequest = None, + request: Union[contact_center_insights.ExportInsightsDataRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1159,7 +1159,7 @@ def export_insights_data( request body. Args: - request (google.cloud.contact_center_insights_v1.types.ExportInsightsDataRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ExportInsightsDataRequest, dict]): The request object. The request to export insights. parent (str): Required. The parent resource to @@ -1230,7 +1230,7 @@ def export_insights_data( def create_issue_model( self, - request: contact_center_insights.CreateIssueModelRequest = None, + request: Union[contact_center_insights.CreateIssueModelRequest, dict] = None, *, parent: str = None, issue_model: resources.IssueModel = None, @@ -1241,7 +1241,7 @@ def create_issue_model( r"""Creates an issue model. Args: - request (google.cloud.contact_center_insights_v1.types.CreateIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CreateIssueModelRequest, dict]): The request object. The request to create an issue model. parent (str): @@ -1320,7 +1320,7 @@ def create_issue_model( def update_issue_model( self, - request: contact_center_insights.UpdateIssueModelRequest = None, + request: Union[contact_center_insights.UpdateIssueModelRequest, dict] = None, *, issue_model: resources.IssueModel = None, update_mask: field_mask_pb2.FieldMask = None, @@ -1331,7 +1331,7 @@ def update_issue_model( r"""Updates an issue model. Args: - request (google.cloud.contact_center_insights_v1.types.UpdateIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.UpdateIssueModelRequest, dict]): The request object. The request to update an issue model. issue_model (google.cloud.contact_center_insights_v1.types.IssueModel): @@ -1399,7 +1399,7 @@ def update_issue_model( def get_issue_model( self, - request: contact_center_insights.GetIssueModelRequest = None, + request: Union[contact_center_insights.GetIssueModelRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1409,7 +1409,7 @@ def get_issue_model( r"""Gets an issue model. Args: - request (google.cloud.contact_center_insights_v1.types.GetIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetIssueModelRequest, dict]): The request object. The request to get an issue model. name (str): Required. The name of the issue model @@ -1467,7 +1467,7 @@ def get_issue_model( def list_issue_models( self, - request: contact_center_insights.ListIssueModelsRequest = None, + request: Union[contact_center_insights.ListIssueModelsRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1477,7 +1477,7 @@ def list_issue_models( r"""Lists issue models. Args: - request (google.cloud.contact_center_insights_v1.types.ListIssueModelsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ListIssueModelsRequest, dict]): The request object. Request to list issue models. parent (str): Required. The parent resource of the @@ -1535,7 +1535,7 @@ def list_issue_models( def delete_issue_model( self, - request: contact_center_insights.DeleteIssueModelRequest = None, + request: Union[contact_center_insights.DeleteIssueModelRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1545,7 +1545,7 @@ def delete_issue_model( r"""Deletes an issue model. Args: - request (google.cloud.contact_center_insights_v1.types.DeleteIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.DeleteIssueModelRequest, dict]): The request object. The request to delete an issue model. name (str): @@ -1627,7 +1627,7 @@ def delete_issue_model( def deploy_issue_model( self, - request: contact_center_insights.DeployIssueModelRequest = None, + request: Union[contact_center_insights.DeployIssueModelRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1639,7 +1639,7 @@ def deploy_issue_model( analysis after it has been deployed. Args: - request (google.cloud.contact_center_insights_v1.types.DeployIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.DeployIssueModelRequest, dict]): The request object. The request to deploy an issue model. name (str): @@ -1709,7 +1709,7 @@ def deploy_issue_model( def undeploy_issue_model( self, - request: contact_center_insights.UndeployIssueModelRequest = None, + request: Union[contact_center_insights.UndeployIssueModelRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1721,7 +1721,7 @@ def undeploy_issue_model( been undeployed. Args: - request (google.cloud.contact_center_insights_v1.types.UndeployIssueModelRequest): + request (Union[google.cloud.contact_center_insights_v1.types.UndeployIssueModelRequest, dict]): The request object. The request to undeploy an issue model. name (str): @@ -1793,7 +1793,7 @@ def undeploy_issue_model( def get_issue( self, - request: contact_center_insights.GetIssueRequest = None, + request: Union[contact_center_insights.GetIssueRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1803,7 +1803,7 @@ def get_issue( r"""Gets an issue. Args: - request (google.cloud.contact_center_insights_v1.types.GetIssueRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetIssueRequest, dict]): The request object. The request to get an issue. name (str): Required. The name of the issue to @@ -1861,7 +1861,7 @@ def get_issue( def list_issues( self, - request: contact_center_insights.ListIssuesRequest = None, + request: Union[contact_center_insights.ListIssuesRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -1871,7 +1871,7 @@ def list_issues( r"""Lists issues. Args: - request (google.cloud.contact_center_insights_v1.types.ListIssuesRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ListIssuesRequest, dict]): The request object. Request to list issues. parent (str): Required. The parent resource of the @@ -1929,7 +1929,7 @@ def list_issues( def update_issue( self, - request: contact_center_insights.UpdateIssueRequest = None, + request: Union[contact_center_insights.UpdateIssueRequest, dict] = None, *, issue: resources.Issue = None, update_mask: field_mask_pb2.FieldMask = None, @@ -1940,7 +1940,7 @@ def update_issue( r"""Updates an issue. Args: - request (google.cloud.contact_center_insights_v1.types.UpdateIssueRequest): + request (Union[google.cloud.contact_center_insights_v1.types.UpdateIssueRequest, dict]): The request object. The request to update an issue. issue (google.cloud.contact_center_insights_v1.types.Issue): Required. The new values for the @@ -2007,7 +2007,9 @@ def update_issue( def calculate_issue_model_stats( self, - request: contact_center_insights.CalculateIssueModelStatsRequest = None, + request: Union[ + contact_center_insights.CalculateIssueModelStatsRequest, dict + ] = None, *, issue_model: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2017,7 +2019,7 @@ def calculate_issue_model_stats( r"""Gets an issue model's statistics. Args: - request (google.cloud.contact_center_insights_v1.types.CalculateIssueModelStatsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CalculateIssueModelStatsRequest, dict]): The request object. Request to get statistics of an issue model. issue_model (str): @@ -2084,7 +2086,7 @@ def calculate_issue_model_stats( def create_phrase_matcher( self, - request: contact_center_insights.CreatePhraseMatcherRequest = None, + request: Union[contact_center_insights.CreatePhraseMatcherRequest, dict] = None, *, parent: str = None, phrase_matcher: resources.PhraseMatcher = None, @@ -2095,7 +2097,7 @@ def create_phrase_matcher( r"""Creates a phrase matcher. Args: - request (google.cloud.contact_center_insights_v1.types.CreatePhraseMatcherRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CreatePhraseMatcherRequest, dict]): The request object. Request to create a phrase matcher. parent (str): Required. The parent resource of the phrase matcher. @@ -2165,7 +2167,7 @@ def create_phrase_matcher( def get_phrase_matcher( self, - request: contact_center_insights.GetPhraseMatcherRequest = None, + request: Union[contact_center_insights.GetPhraseMatcherRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2175,7 +2177,7 @@ def get_phrase_matcher( r"""Gets a phrase matcher. Args: - request (google.cloud.contact_center_insights_v1.types.GetPhraseMatcherRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetPhraseMatcherRequest, dict]): The request object. The request to get a a phrase matcher. name (str): @@ -2234,7 +2236,7 @@ def get_phrase_matcher( def list_phrase_matchers( self, - request: contact_center_insights.ListPhraseMatchersRequest = None, + request: Union[contact_center_insights.ListPhraseMatchersRequest, dict] = None, *, parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2244,7 +2246,7 @@ def list_phrase_matchers( r"""Lists phrase matchers. Args: - request (google.cloud.contact_center_insights_v1.types.ListPhraseMatchersRequest): + request (Union[google.cloud.contact_center_insights_v1.types.ListPhraseMatchersRequest, dict]): The request object. Request to list phrase matchers. parent (str): Required. The parent resource of the @@ -2313,7 +2315,7 @@ def list_phrase_matchers( def delete_phrase_matcher( self, - request: contact_center_insights.DeletePhraseMatcherRequest = None, + request: Union[contact_center_insights.DeletePhraseMatcherRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2323,7 +2325,7 @@ def delete_phrase_matcher( r"""Deletes a phrase matcher. Args: - request (google.cloud.contact_center_insights_v1.types.DeletePhraseMatcherRequest): + request (Union[google.cloud.contact_center_insights_v1.types.DeletePhraseMatcherRequest, dict]): The request object. The request to delete a phrase matcher. name (str): @@ -2377,7 +2379,7 @@ def delete_phrase_matcher( def calculate_stats( self, - request: contact_center_insights.CalculateStatsRequest = None, + request: Union[contact_center_insights.CalculateStatsRequest, dict] = None, *, location: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2387,7 +2389,7 @@ def calculate_stats( r"""Gets conversation statistics. Args: - request (google.cloud.contact_center_insights_v1.types.CalculateStatsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.CalculateStatsRequest, dict]): The request object. The request for calculating conversation statistics. location (str): @@ -2448,7 +2450,7 @@ def calculate_stats( def get_settings( self, - request: contact_center_insights.GetSettingsRequest = None, + request: Union[contact_center_insights.GetSettingsRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -2458,7 +2460,7 @@ def get_settings( r"""Gets project-level settings. Args: - request (google.cloud.contact_center_insights_v1.types.GetSettingsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.GetSettingsRequest, dict]): The request object. The request to get project-level settings. name (str): @@ -2517,7 +2519,7 @@ def get_settings( def update_settings( self, - request: contact_center_insights.UpdateSettingsRequest = None, + request: Union[contact_center_insights.UpdateSettingsRequest, dict] = None, *, settings: resources.Settings = None, update_mask: field_mask_pb2.FieldMask = None, @@ -2528,7 +2530,7 @@ def update_settings( r"""Updates project-level settings. Args: - request (google.cloud.contact_center_insights_v1.types.UpdateSettingsRequest): + request (Union[google.cloud.contact_center_insights_v1.types.UpdateSettingsRequest, dict]): The request object. The request to update project-level settings. settings (google.cloud.contact_center_insights_v1.types.Settings): diff --git a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/base.py b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/base.py index 1c91d8a..41c98c8 100644 --- a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/base.py +++ b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/base.py @@ -121,7 +121,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # If the credentials are service account credentials, then always try to use self signed JWT. if ( always_use_jwt_access and isinstance(credentials, service_account.Credentials) diff --git a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc.py b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc.py index 75856fe..65182b9 100644 --- a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc.py +++ b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc.py @@ -85,16 +85,16 @@ def __init__( api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. + ``client_cert_source`` or application default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. + for the grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure mutual TLS channel. It is + both in PEM format. It is used to configure a mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. diff --git a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc_asyncio.py b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc_asyncio.py index 4714cd8..e924a0d 100644 --- a/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc_asyncio.py +++ b/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/grpc_asyncio.py @@ -132,16 +132,16 @@ def __init__( api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. + ``client_cert_source`` or application default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. + for the grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure mutual TLS channel. It is + both in PEM format. It is used to configure a mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. diff --git a/scripts/fixup_contact_center_insights_v1_keywords.py b/scripts/fixup_contact_center_insights_v1_keywords.py index 017402a..c02c0b1 100644 --- a/scripts/fixup_contact_center_insights_v1_keywords.py +++ b/scripts/fixup_contact_center_insights_v1_keywords.py @@ -39,34 +39,34 @@ def partition( class contact_center_insightsCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'calculate_issue_model_stats': ('issue_model', ), - 'calculate_stats': ('location', 'filter', ), - 'create_analysis': ('parent', 'analysis', ), - 'create_conversation': ('parent', 'conversation', 'conversation_id', ), - 'create_issue_model': ('parent', 'issue_model', ), - 'create_phrase_matcher': ('parent', 'phrase_matcher', ), - 'delete_analysis': ('name', ), - 'delete_conversation': ('name', 'force', ), - 'delete_issue_model': ('name', ), - 'delete_phrase_matcher': ('name', ), - 'deploy_issue_model': ('name', ), - 'export_insights_data': ('parent', 'big_query_destination', 'filter', 'kms_key', ), - 'get_analysis': ('name', ), - 'get_conversation': ('name', 'view', ), - 'get_issue': ('name', ), - 'get_issue_model': ('name', ), - 'get_phrase_matcher': ('name', ), - 'get_settings': ('name', ), - 'list_analyses': ('parent', 'page_size', 'page_token', 'filter', ), - 'list_conversations': ('parent', 'page_size', 'page_token', 'filter', 'view', ), - 'list_issue_models': ('parent', ), - 'list_issues': ('parent', ), - 'list_phrase_matchers': ('parent', 'page_size', 'page_token', 'filter', ), - 'undeploy_issue_model': ('name', ), - 'update_conversation': ('conversation', 'update_mask', ), - 'update_issue': ('issue', 'update_mask', ), - 'update_issue_model': ('issue_model', 'update_mask', ), - 'update_settings': ('settings', 'update_mask', ), + 'calculate_issue_model_stats': ('issue_model', ), + 'calculate_stats': ('location', 'filter', ), + 'create_analysis': ('parent', 'analysis', ), + 'create_conversation': ('parent', 'conversation', 'conversation_id', ), + 'create_issue_model': ('parent', 'issue_model', ), + 'create_phrase_matcher': ('parent', 'phrase_matcher', ), + 'delete_analysis': ('name', ), + 'delete_conversation': ('name', 'force', ), + 'delete_issue_model': ('name', ), + 'delete_phrase_matcher': ('name', ), + 'deploy_issue_model': ('name', ), + 'export_insights_data': ('parent', 'big_query_destination', 'filter', 'kms_key', ), + 'get_analysis': ('name', ), + 'get_conversation': ('name', 'view', ), + 'get_issue': ('name', ), + 'get_issue_model': ('name', ), + 'get_phrase_matcher': ('name', ), + 'get_settings': ('name', ), + 'list_analyses': ('parent', 'page_size', 'page_token', 'filter', ), + 'list_conversations': ('parent', 'page_size', 'page_token', 'filter', 'view', ), + 'list_issue_models': ('parent', ), + 'list_issues': ('parent', ), + 'list_phrase_matchers': ('parent', 'page_size', 'page_token', 'filter', ), + 'undeploy_issue_model': ('name', ), + 'update_conversation': ('conversation', 'update_mask', ), + 'update_issue': ('issue', 'update_mask', ), + 'update_issue_model': ('issue_model', 'update_mask', ), + 'update_settings': ('settings', 'update_mask', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -85,7 +85,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: return updated kwargs, ctrl_kwargs = partition( - lambda a: not a.keyword.value in self.CTRL_PARAMS, + lambda a: a.keyword.value not in self.CTRL_PARAMS, kwargs ) From 2181a3dbdb30946823b15d9b77e6440b36fd3c47 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Fri, 24 Sep 2021 14:02:16 -0400 Subject: [PATCH 08/10] samples: create conversation with TTL (#43) --- .../snippets/create_conversation_with_ttl.py | 52 +++++++++++++++++++ samples/snippets/create_issue_model.py | 2 +- samples/snippets/noxfile.py | 2 +- samples/snippets/set_project_ttl.py | 1 + .../test_create_conversation_with_ttl.py | 44 ++++++++++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 samples/snippets/create_conversation_with_ttl.py create mode 100644 samples/snippets/test_create_conversation_with_ttl.py diff --git a/samples/snippets/create_conversation_with_ttl.py b/samples/snippets/create_conversation_with_ttl.py new file mode 100644 index 0000000..267c71d --- /dev/null +++ b/samples/snippets/create_conversation_with_ttl.py @@ -0,0 +1,52 @@ +# 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 +# +# 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. +# +# Create a conversation with a TTL. +# [START contactcenterinsights_create_conversation_with_ttl] +from google.cloud import contact_center_insights_v1 +from google.protobuf import duration_pb2 + + +def create_conversation_with_ttl( + project_id: str, + transcript_uri: str = "gs://cloud-samples-data/ccai/chat_sample.json", + audio_uri: str = "gs://cloud-samples-data/ccai/voice_6912.txt", +) -> contact_center_insights_v1.Conversation: + # Construct a parent resource. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + # Construct a conversation. + conversation = contact_center_insights_v1.Conversation() + conversation.data_source.gcs_source.transcript_uri = transcript_uri + conversation.data_source.gcs_source.audio_uri = audio_uri + conversation.medium = contact_center_insights_v1.Conversation.Medium.CHAT + + # Construct a TTL. + ttl = duration_pb2.Duration() + ttl.seconds = 86400 + conversation.ttl = ttl + + # Call the Insights client to create a conversation. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + conversation = insights_client.create_conversation( + parent=parent, conversation=conversation + ) + + print(f"Created {conversation.name}") + return conversation + + +# [END contactcenterinsights_create_conversation_with_ttl] diff --git a/samples/snippets/create_issue_model.py b/samples/snippets/create_issue_model.py index 4568cc4..b340335 100644 --- a/samples/snippets/create_issue_model.py +++ b/samples/snippets/create_issue_model.py @@ -25,7 +25,7 @@ def create_issue_model(project_id: str) -> contact_center_insights_v1.IssueModel # Construct an issue model. issue_model = contact_center_insights_v1.IssueModel() issue_model.display_name = "my-model" - issue_model.input_data_config.filter = "medium=\"CHAT\"" + issue_model.input_data_config.filter = 'medium="CHAT"' # Call the Insights client to create an issue model. insights_client = contact_center_insights_v1.ContactCenterInsightsClient() diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index b008613..0e13f5f 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -1,4 +1,4 @@ -# Copyright 2019 Google LLC +# 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. diff --git a/samples/snippets/set_project_ttl.py b/samples/snippets/set_project_ttl.py index f3a98fe..b5aa021 100644 --- a/samples/snippets/set_project_ttl.py +++ b/samples/snippets/set_project_ttl.py @@ -50,4 +50,5 @@ def set_project_ttl(project_id: str) -> None: ) ) + # [END contactcenterinsights_set_project_ttl] diff --git a/samples/snippets/test_create_conversation_with_ttl.py b/samples/snippets/test_create_conversation_with_ttl.py new file mode 100644 index 0000000..ee493d4 --- /dev/null +++ b/samples/snippets/test_create_conversation_with_ttl.py @@ -0,0 +1,44 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import create_conversation_with_ttl + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def conversation_resource(project_id): + # Create a conversation + conversation = create_conversation_with_ttl.create_conversation_with_ttl(project_id) + yield conversation + + # Delete the conversation. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + insights_client.delete_conversation(name=conversation.name) + + +def test_create_conversation_with_ttl(capsys, conversation_resource): + conversation = conversation_resource + out, err = capsys.readouterr() + assert "Created {}".format(conversation.name) in out From 6692d149dcee22e323cff34b938acf2b28ccc287 Mon Sep 17 00:00:00 2001 From: Bamboo Le <8941262+TrucHLe@users.noreply.github.com> Date: Fri, 24 Sep 2021 14:16:41 -0400 Subject: [PATCH 09/10] samples: get operation (#24) --- samples/snippets/get_operation.py | 36 ++++++++++++ samples/snippets/test_get_operation.py | 80 ++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 samples/snippets/get_operation.py create mode 100644 samples/snippets/test_get_operation.py diff --git a/samples/snippets/get_operation.py b/samples/snippets/get_operation.py new file mode 100644 index 0000000..195b373 --- /dev/null +++ b/samples/snippets/get_operation.py @@ -0,0 +1,36 @@ +# 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 +# +# 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. +# +# Get a long-running operation. +# [START contactcenterinsights_get_operation] +from google.cloud import contact_center_insights_v1 +from google.longrunning import operations_pb2 + + +def get_operation(operation_name: str) -> operations_pb2.Operation: + # Construct an Insights client that will authenticate via Application Default Credentials. + # See authentication details at https://cloud.google.com/docs/authentication/production. + insights_client = contact_center_insights_v1.ContactCenterInsightsClient() + + # Call the Insights client to get the operation. + operation = insights_client.transport.operations_client.get_operation( + operation_name + ) + if operation.done: + print("Operation is done") + else: + print("Operation is in progress") + + +# [END contactcenterinsights_get_operation] diff --git a/samples/snippets/test_get_operation.py b/samples/snippets/test_get_operation.py new file mode 100644 index 0000000..f7e859e --- /dev/null +++ b/samples/snippets/test_get_operation.py @@ -0,0 +1,80 @@ +# 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 +# +# 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. +# +import google.auth + +from google.cloud import contact_center_insights_v1 + +import pytest + +import get_operation + +TRANSCRIPT_URI = "gs://cloud-samples-data/ccai/chat_sample.json" +AUDIO_URI = "gs://cloud-samples-data/ccai/voice_6912.txt" + + +@pytest.fixture +def project_id(): + _, project_id = google.auth.default() + return project_id + + +@pytest.fixture +def insights_client(): + return contact_center_insights_v1.ContactCenterInsightsClient() + + +@pytest.fixture +def conversation_resource(project_id, insights_client): + # Create a conversation. + parent = contact_center_insights_v1.ContactCenterInsightsClient.common_location_path( + project_id, "us-central1" + ) + + conversation = contact_center_insights_v1.Conversation() + conversation.data_source.gcs_source.transcript_uri = TRANSCRIPT_URI + conversation.data_source.gcs_source.audio_uri = AUDIO_URI + conversation.medium = contact_center_insights_v1.Conversation.Medium.CHAT + + conversation = insights_client.create_conversation( + parent=parent, conversation=conversation + ) + yield conversation + + # Delete the conversation. + delete_request = contact_center_insights_v1.DeleteConversationRequest() + delete_request.name = conversation.name + delete_request.force = True + insights_client.delete_conversation(request=delete_request) + + +@pytest.fixture +def analysis_operation(conversation_resource, insights_client): + # Create an analysis. + conversation_name = conversation_resource.name + analysis = contact_center_insights_v1.Analysis() + analysis_operation = insights_client.create_analysis( + parent=conversation_name, analysis=analysis + ) + + # Wait until the analysis operation is done and return the operation. + analysis_operation.result(timeout=600) + yield analysis_operation + + +def test_get_operation(capsys, analysis_operation): + operation_name = analysis_operation.operation.name + get_operation.get_operation(operation_name) + out, err = capsys.readouterr() + assert "Operation is done" in out From d57e94b4045b56b5baf8b1e96ca9023c0279d87f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 14:38:10 +0000 Subject: [PATCH 10/10] chore: release 0.3.1 (#52) :robot: I have created a release \*beep\* \*boop\* --- ### [0.3.1](https://www.github.com/googleapis/python-contact-center-insights/compare/v0.3.0...v0.3.1) (2021-09-24) ### Bug Fixes * add 'dict' annotation type to 'request' ([94e64ac](https://www.github.com/googleapis/python-contact-center-insights/commit/94e64acc866eeed789768c2e216dad3f561c81e3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ samples/snippets/noxfile.py | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abce497..c18e564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.3.1](https://www.github.com/googleapis/python-contact-center-insights/compare/v0.3.0...v0.3.1) (2021-09-24) + + +### Bug Fixes + +* add 'dict' annotation type to 'request' ([94e64ac](https://www.github.com/googleapis/python-contact-center-insights/commit/94e64acc866eeed789768c2e216dad3f561c81e3)) + ## [0.3.0](https://www.github.com/googleapis/python-contact-center-insights/compare/v0.2.0...v0.3.0) (2021-09-20) diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 0e13f5f..b008613 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index 5f8da45..89f07ef 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-contact-center-insights" description = "Contact Center AI Insights API" -version = "0.3.0" +version = "0.3.1" release_status = "Development Status :: 4 - Beta" url = "https://github.com/googleapis/python-contact-center-insights" dependencies = [