From daf9af84fc1b448f86d340c56bc37460b0254f82 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 10:48:11 +0000 Subject: [PATCH] chore: use gapic-generator-python 0.53.4 (#85) - [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: https://github.com/googleapis/googleapis/commit/83d81b0c8fc22291a13398d6d77f02dc97a5b6f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9 --- .../contact_center_insights/async_client.py | 174 +++++++++--------- .../contact_center_insights/client.py | 58 +++--- .../transports/base.py | 37 +--- .../transports/grpc.py | 2 +- .../transports/grpc_asyncio.py | 3 +- .../types/contact_center_insights.py | 3 + .../types/resources.py | 64 +++++++ setup.py | 3 +- testing/constraints-3.6.txt | 4 +- .../test_contact_center_insights.py | 91 +-------- 10 files changed, 201 insertions(+), 238 deletions(-) diff --git a/google/cloud/contact_center_insights_v1/services/contact_center_insights/async_client.py b/google/cloud/contact_center_insights_v1/services/contact_center_insights/async_client.py index 2f249ba..cdc24c4 100644 --- a/google/cloud/contact_center_insights_v1/services/contact_center_insights/async_client.py +++ b/google/cloud/contact_center_insights_v1/services/contact_center_insights/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.contact_center_insights_v1.services.contact_center_insights import ( @@ -197,19 +199,19 @@ def __init__( async 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, conversation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: r"""Creates a conversation. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -291,18 +293,18 @@ async def create_conversation( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: r"""Updates a conversation. Args: - request (:class:`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 (:class:`google.cloud.contact_center_insights_v1.types.Conversation`): @@ -370,17 +372,17 @@ async def update_conversation( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: r"""Gets a conversation. Args: - request (:class:`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 (:class:`str`): Required. The name of the @@ -438,17 +440,17 @@ async def get_conversation( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListConversationsAsyncPager: r"""Lists conversations. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -517,17 +519,17 @@ async def list_conversations( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a conversation. Args: - request (:class:`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 (:class:`str`): @@ -581,11 +583,11 @@ async def delete_conversation( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -593,7 +595,7 @@ async def create_analysis( done when the analysis has completed. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -671,17 +673,17 @@ async def create_analysis( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Analysis: r"""Gets an analysis. Args: - request (:class:`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 (:class:`str`): Required. The name of the analysis to @@ -739,17 +741,17 @@ async def get_analysis( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnalysesAsyncPager: r"""Lists analyses. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -817,17 +819,17 @@ async def list_analyses( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an analysis. Args: - request (:class:`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 (:class:`str`): Required. The name of the analysis to @@ -880,10 +882,10 @@ async def delete_analysis( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -891,7 +893,7 @@ async def export_insights_data( request body. Args: - request (:class:`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 (:class:`str`): Required. The parent resource to @@ -962,18 +964,18 @@ async def export_insights_data( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates an issue model. Args: - request (:class:`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 (:class:`str`): @@ -1052,18 +1054,18 @@ async def create_issue_model( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.IssueModel: r"""Updates an issue model. Args: - request (:class:`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 (:class:`google.cloud.contact_center_insights_v1.types.IssueModel`): @@ -1131,17 +1133,17 @@ async def update_issue_model( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.IssueModel: r"""Gets an issue model. Args: - request (:class:`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 (:class:`str`): Required. The name of the issue model @@ -1199,17 +1201,17 @@ async def get_issue_model( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.ListIssueModelsResponse: r"""Lists issue models. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -1267,17 +1269,17 @@ async def list_issue_models( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes an issue model. Args: - request (:class:`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 (:class:`str`): @@ -1359,10 +1361,10 @@ async def delete_issue_model( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -1371,7 +1373,7 @@ async def deploy_issue_model( analysis after it has been deployed. Args: - request (:class:`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 (:class:`str`): @@ -1441,10 +1443,10 @@ async def deploy_issue_model( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: @@ -1453,7 +1455,7 @@ async def undeploy_issue_model( been undeployed. Args: - request (:class:`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 (:class:`str`): @@ -1525,17 +1527,17 @@ async def undeploy_issue_model( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Issue: r"""Gets an issue. Args: - request (:class:`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 (:class:`str`): Required. The name of the issue to @@ -1593,17 +1595,17 @@ async def get_issue( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.ListIssuesResponse: r"""Lists issues. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -1661,18 +1663,18 @@ async def list_issues( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Issue: r"""Updates an issue. Args: - request (:class:`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 (:class:`google.cloud.contact_center_insights_v1.types.Issue`): Required. The new values for the @@ -1739,17 +1741,19 @@ async def update_issue( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.CalculateIssueModelStatsResponse: r"""Gets an issue model's statistics. Args: - request (:class:`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 (:class:`str`): @@ -1812,18 +1816,18 @@ async def calculate_issue_model_stats( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PhraseMatcher: r"""Creates a phrase matcher. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the phrase matcher. @@ -1893,17 +1897,17 @@ async def create_phrase_matcher( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PhraseMatcher: r"""Gets a phrase matcher. Args: - request (:class:`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 (:class:`str`): @@ -1962,17 +1966,17 @@ async def get_phrase_matcher( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPhraseMatchersAsyncPager: r"""Lists phrase matchers. Args: - request (:class:`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 (:class:`str`): Required. The parent resource of the @@ -2041,17 +2045,17 @@ async def list_phrase_matchers( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a phrase matcher. Args: - request (:class:`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 (:class:`str`): @@ -2105,17 +2109,17 @@ async def delete_phrase_matcher( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.CalculateStatsResponse: r"""Gets conversation statistics. Args: - request (:class:`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 (:class:`str`): @@ -2176,17 +2180,17 @@ async def calculate_stats( async 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, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Settings: r"""Gets project-level settings. Args: - request (:class:`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 (:class:`str`): @@ -2245,18 +2249,18 @@ async def get_settings( async 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, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Settings: r"""Updates project-level settings. Args: - request (:class:`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 (:class:`google.cloud.contact_center_insights_v1.types.Settings`): 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 001e031..6215d40 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 @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.contact_center_insights_v1.services.contact_center_insights import ( @@ -467,7 +469,7 @@ def create_conversation( parent: str = None, conversation: resources.Conversation = None, conversation_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: @@ -560,7 +562,7 @@ def update_conversation( *, conversation: resources.Conversation = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: @@ -638,7 +640,7 @@ def get_conversation( request: Union[contact_center_insights.GetConversationRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Conversation: @@ -706,7 +708,7 @@ def list_conversations( request: Union[contact_center_insights.ListConversationsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListConversationsPager: @@ -785,7 +787,7 @@ def delete_conversation( request: Union[contact_center_insights.DeleteConversationRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -850,7 +852,7 @@ def create_analysis( *, parent: str = None, analysis: resources.Analysis = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -939,7 +941,7 @@ def get_analysis( request: Union[contact_center_insights.GetAnalysisRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Analysis: @@ -1007,7 +1009,7 @@ def list_analyses( request: Union[contact_center_insights.ListAnalysesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnalysesPager: @@ -1085,7 +1087,7 @@ def delete_analysis( request: Union[contact_center_insights.DeleteAnalysisRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -1148,7 +1150,7 @@ def export_insights_data( request: Union[contact_center_insights.ExportInsightsDataRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1231,7 +1233,7 @@ def create_issue_model( *, parent: str = None, issue_model: resources.IssueModel = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1321,7 +1323,7 @@ def update_issue_model( *, issue_model: resources.IssueModel = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.IssueModel: @@ -1399,7 +1401,7 @@ def get_issue_model( request: Union[contact_center_insights.GetIssueModelRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.IssueModel: @@ -1467,7 +1469,7 @@ def list_issue_models( request: Union[contact_center_insights.ListIssueModelsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.ListIssueModelsResponse: @@ -1535,7 +1537,7 @@ def delete_issue_model( request: Union[contact_center_insights.DeleteIssueModelRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1627,7 +1629,7 @@ def deploy_issue_model( request: Union[contact_center_insights.DeployIssueModelRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1709,7 +1711,7 @@ def undeploy_issue_model( request: Union[contact_center_insights.UndeployIssueModelRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: @@ -1793,7 +1795,7 @@ def get_issue( request: Union[contact_center_insights.GetIssueRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Issue: @@ -1861,7 +1863,7 @@ def list_issues( request: Union[contact_center_insights.ListIssuesRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.ListIssuesResponse: @@ -1930,7 +1932,7 @@ def update_issue( *, issue: resources.Issue = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Issue: @@ -2009,7 +2011,7 @@ def calculate_issue_model_stats( ] = None, *, issue_model: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.CalculateIssueModelStatsResponse: @@ -2087,7 +2089,7 @@ def create_phrase_matcher( *, parent: str = None, phrase_matcher: resources.PhraseMatcher = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PhraseMatcher: @@ -2167,7 +2169,7 @@ def get_phrase_matcher( request: Union[contact_center_insights.GetPhraseMatcherRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PhraseMatcher: @@ -2236,7 +2238,7 @@ def list_phrase_matchers( request: Union[contact_center_insights.ListPhraseMatchersRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListPhraseMatchersPager: @@ -2315,7 +2317,7 @@ def delete_phrase_matcher( request: Union[contact_center_insights.DeletePhraseMatcherRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -2379,7 +2381,7 @@ def calculate_stats( request: Union[contact_center_insights.CalculateStatsRequest, dict] = None, *, location: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> contact_center_insights.CalculateStatsResponse: @@ -2450,7 +2452,7 @@ def get_settings( request: Union[contact_center_insights.GetSettingsRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Settings: @@ -2520,7 +2522,7 @@ def update_settings( *, settings: resources.Settings = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.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 cf30eb9..a8aea49 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 @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -41,15 +40,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ContactCenterInsightsTransport(abc.ABC): """Abstract transport class for ContactCenterInsights.""" @@ -99,7 +89,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -132,29 +122,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -266,7 +233,7 @@ def close(self): raise NotImplementedError() @property - def operations_client(self) -> operations_v1.OperationsClient: + def operations_client(self): """Return the client designed to process long-running operations.""" raise NotImplementedError() 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 6b97d7a..2c86387 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 @@ -115,7 +115,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) 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 03b6846..5213a60 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 @@ -21,7 +21,6 @@ from google.api_core import operations_v1 # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore @@ -162,7 +161,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} - self._operations_client = None + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) diff --git a/google/cloud/contact_center_insights_v1/types/contact_center_insights.py b/google/cloud/contact_center_insights_v1/types/contact_center_insights.py index 9559a7d..e901838 100644 --- a/google/cloud/contact_center_insights_v1/types/contact_center_insights.py +++ b/google/cloud/contact_center_insights_v1/types/contact_center_insights.py @@ -425,9 +425,12 @@ class DeleteAnalysisRequest(proto.Message): class ExportInsightsDataRequest(proto.Message): r"""The request to export insights. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: big_query_destination (google.cloud.contact_center_insights_v1.types.ExportInsightsDataRequest.BigQueryDestination): Specified if sink is a BigQuery table. + This field is a member of `oneof`_ ``destination``. parent (str): Required. The parent resource to export data from. diff --git a/google/cloud/contact_center_insights_v1/types/resources.py b/google/cloud/contact_center_insights_v1/types/resources.py index 651e9fa..319fa28 100644 --- a/google/cloud/contact_center_insights_v1/types/resources.py +++ b/google/cloud/contact_center_insights_v1/types/resources.py @@ -67,17 +67,27 @@ class Conversation(proto.Message): r"""The conversation resource. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: call_metadata (google.cloud.contact_center_insights_v1.types.Conversation.CallMetadata): Call-specific metadata. + This field is a member of `oneof`_ ``metadata``. expire_time (google.protobuf.timestamp_pb2.Timestamp): The time at which this conversation should expire. After this time, the conversation data and any associated analyses will be deleted. + This field is a member of `oneof`_ ``expiration``. ttl (google.protobuf.duration_pb2.Duration): Input only. The TTL for this resource. If specified, then this TTL will be used to calculate the expire time. + This field is a member of `oneof`_ ``expiration``. name (str): Immutable. The resource name of the conversation. Format: @@ -327,13 +337,22 @@ class ConversationDataSource(proto.Message): r"""The conversation source, which is a combination of transcript and audio. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: gcs_source (google.cloud.contact_center_insights_v1.types.GcsSource): A Cloud Storage location specification for the audio and transcript. + This field is a member of `oneof`_ ``source``. dialogflow_source (google.cloud.contact_center_insights_v1.types.DialogflowSource): The source when the conversation comes from Dialogflow. + This field is a member of `oneof`_ ``source``. """ gcs_source = proto.Field( @@ -381,10 +400,13 @@ class DialogflowSource(proto.Message): class AnalysisResult(proto.Message): r"""The result of an analysis. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: call_analysis_metadata (google.cloud.contact_center_insights_v1.types.AnalysisResult.CallAnalysisMetadata): Call-specific metadata created by the analysis. + This field is a member of `oneof`_ ``metadata``. end_time (google.protobuf.timestamp_pb2.Timestamp): The time at which the analysis ended. """ @@ -487,21 +509,35 @@ class IssueAssignment(proto.Message): class CallAnnotation(proto.Message): r"""A piece of metadata that applies to a window of a call. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: interruption_data (google.cloud.contact_center_insights_v1.types.InterruptionData): Data specifying an interruption. + This field is a member of `oneof`_ ``data``. sentiment_data (google.cloud.contact_center_insights_v1.types.SentimentData): Data specifying sentiment. + This field is a member of `oneof`_ ``data``. silence_data (google.cloud.contact_center_insights_v1.types.SilenceData): Data specifying silence. + This field is a member of `oneof`_ ``data``. hold_data (google.cloud.contact_center_insights_v1.types.HoldData): Data specifying a hold. + This field is a member of `oneof`_ ``data``. entity_mention_data (google.cloud.contact_center_insights_v1.types.EntityMentionData): Data specifying an entity mention. + This field is a member of `oneof`_ ``data``. intent_match_data (google.cloud.contact_center_insights_v1.types.IntentMatchData): Data specifying an intent match. + This field is a member of `oneof`_ ``data``. phrase_match_data (google.cloud.contact_center_insights_v1.types.PhraseMatchData): Data specifying a phrase match. + This field is a member of `oneof`_ ``data``. channel_tag (int): The channel of the audio where the annotation occurs. For single-channel audio, this field is @@ -546,11 +582,15 @@ class AnnotationBoundary(proto.Message): r"""A point in a conversation that marks the start or the end of an annotation. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: word_index (int): The word index of this boundary with respect to the first word in the transcript piece. This index starts at zero. + This field is a member of `oneof`_ ``detailed_boundary``. transcript_index (int): The index in the sequence of transcribed pieces of the conversation where the boundary is @@ -989,9 +1029,12 @@ class PhraseMatchRule(proto.Message): class PhraseMatchRuleConfig(proto.Message): r"""Configuration information of a phrase match rule. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: exact_match_config (google.cloud.contact_center_insights_v1.types.ExactMatchConfig): The configuration for the exact match rule. + This field is a member of `oneof`_ ``config``. """ exact_match_config = proto.Field( @@ -1089,17 +1132,29 @@ class RuntimeAnnotation(proto.Message): r"""An annotation that was generated during the customer and agent interaction. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: article_suggestion (google.cloud.contact_center_insights_v1.types.ArticleSuggestionData): Agent Assist Article Suggestion data. + This field is a member of `oneof`_ ``data``. faq_answer (google.cloud.contact_center_insights_v1.types.FaqAnswerData): Agent Assist FAQ answer data. + This field is a member of `oneof`_ ``data``. smart_reply (google.cloud.contact_center_insights_v1.types.SmartReplyData): Agent Assist Smart Reply data. + This field is a member of `oneof`_ ``data``. smart_compose_suggestion (google.cloud.contact_center_insights_v1.types.SmartComposeSuggestionData): Agent Assist Smart Compose suggestion data. + This field is a member of `oneof`_ ``data``. dialogflow_interaction (google.cloud.contact_center_insights_v1.types.DialogflowInteractionData): Dialogflow interaction data. + This field is a member of `oneof`_ ``data``. annotation_id (str): The unique identifier of the annotation. Format: projects/{project}/locations/{location}/conversationDatasets/{dataset}/conversationDataItems/{data_item}/conversationAnnotations/{annotation} @@ -1306,14 +1361,23 @@ class DialogflowInteractionData(proto.Message): class ConversationParticipant(proto.Message): r"""The call participant speaking for a given utterance. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: dialogflow_participant_name (str): The name of the participant provided by Dialogflow. Format: projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant} + This field is a member of `oneof`_ ``participant``. user_id (str): A user-specified ID representing the participant. + This field is a member of `oneof`_ ``participant``. dialogflow_participant (str): Deprecated. Use ``dialogflow_participant_name`` instead. The name of the Dialogflow participant. Format: diff --git a/setup.py b/setup.py index 0b9b57f..8ceb636 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.27.0, <3.0.0dev", + "google-api-core[grpc] >= 1.28.0, <3.0.0dev", "proto-plus >= 1.15.0", - "packaging >= 14.3", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 8bd05d7..1e3ec8b 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -4,7 +4,5 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.27.0 +google-api-core==1.28.0 proto-plus==1.15.0 -packaging==14.3 -google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 si transitively required through google-api-core \ No newline at end of file diff --git a/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py b/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py index 1f4686a..81d37c2 100644 --- a/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py +++ b/tests/unit/gapic/contact_center_insights_v1/test_contact_center_insights.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -47,9 +46,6 @@ from google.cloud.contact_center_insights_v1.services.contact_center_insights import ( transports, ) -from google.cloud.contact_center_insights_v1.services.contact_center_insights.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.contact_center_insights_v1.types import contact_center_insights from google.cloud.contact_center_insights_v1.types import resources from google.longrunning import operations_pb2 @@ -60,20 +56,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -235,7 +217,7 @@ def test_contact_center_insights_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -252,7 +234,7 @@ def test_contact_center_insights_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -269,7 +251,7 @@ def test_contact_center_insights_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -298,7 +280,7 @@ def test_contact_center_insights_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -367,7 +349,7 @@ def test_contact_center_insights_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -409,7 +391,7 @@ def test_contact_center_insights_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -431,7 +413,7 @@ def test_contact_center_insights_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -466,7 +448,7 @@ def test_contact_center_insights_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -501,7 +483,7 @@ def test_contact_center_insights_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -7506,7 +7488,6 @@ def test_contact_center_insights_base_transport(): transport.operations_client -@requires_google_auth_gte_1_25_0 def test_contact_center_insights_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -7527,26 +7508,6 @@ def test_contact_center_insights_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_contact_center_insights_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.contact_center_insights_v1.services.contact_center_insights.transports.ContactCenterInsightsTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ContactCenterInsightsTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - def test_contact_center_insights_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -7558,7 +7519,6 @@ def test_contact_center_insights_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_contact_center_insights_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -7571,18 +7531,6 @@ def test_contact_center_insights_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_contact_center_insights_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ContactCenterInsightsClient() - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -7590,7 +7538,6 @@ def test_contact_center_insights_auth_adc_old_google_auth(): transports.ContactCenterInsightsGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_contact_center_insights_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -7604,26 +7551,6 @@ def test_contact_center_insights_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.ContactCenterInsightsGrpcTransport, - transports.ContactCenterInsightsGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_contact_center_insights_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=("https://www.googleapis.com/auth/cloud-platform",), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [