Skip to content

Commit

Permalink
feat: Launch BulkDelete API, and bulk audio import via the IngestConv…
Browse files Browse the repository at this point in the history
…ersations API (#11981)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 579178675

Source-Link:
googleapis/googleapis@7e33fcb

Source-Link:
googleapis/googleapis-gen@cb25a3f
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbnRhY3QtY2VudGVyLWluc2lnaHRzLy5Pd2xCb3QueWFtbCIsImgiOiJjYjI1YTNmY2NiNzliYjM1ZjIyN2IwYjE5MzlmZjYyZjA1NmRmYmVhIn0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 3, 2023
1 parent 08a092d commit 0510e6d
Show file tree
Hide file tree
Showing 18 changed files with 1,488 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
BulkAnalyzeConversationsMetadata,
BulkAnalyzeConversationsRequest,
BulkAnalyzeConversationsResponse,
BulkDeleteConversationsMetadata,
BulkDeleteConversationsRequest,
BulkDeleteConversationsResponse,
CalculateIssueModelStatsRequest,
CalculateIssueModelStatsResponse,
CalculateStatsRequest,
Expand Down Expand Up @@ -140,6 +143,9 @@
"BulkAnalyzeConversationsMetadata",
"BulkAnalyzeConversationsRequest",
"BulkAnalyzeConversationsResponse",
"BulkDeleteConversationsMetadata",
"BulkDeleteConversationsRequest",
"BulkDeleteConversationsResponse",
"CalculateIssueModelStatsRequest",
"CalculateIssueModelStatsResponse",
"CalculateStatsRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
BulkAnalyzeConversationsMetadata,
BulkAnalyzeConversationsRequest,
BulkAnalyzeConversationsResponse,
BulkDeleteConversationsMetadata,
BulkDeleteConversationsRequest,
BulkDeleteConversationsResponse,
CalculateIssueModelStatsRequest,
CalculateIssueModelStatsResponse,
CalculateStatsRequest,
Expand Down Expand Up @@ -143,6 +146,9 @@
"BulkAnalyzeConversationsMetadata",
"BulkAnalyzeConversationsRequest",
"BulkAnalyzeConversationsResponse",
"BulkDeleteConversationsMetadata",
"BulkDeleteConversationsRequest",
"BulkDeleteConversationsResponse",
"CalculateIssueModelStatsRequest",
"CalculateIssueModelStatsResponse",
"CalculateStatsRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"bulk_analyze_conversations"
]
},
"BulkDeleteConversations": {
"methods": [
"bulk_delete_conversations"
]
},
"CalculateIssueModelStats": {
"methods": [
"calculate_issue_model_stats"
Expand Down Expand Up @@ -210,6 +215,11 @@
"bulk_analyze_conversations"
]
},
"BulkDeleteConversations": {
"methods": [
"bulk_delete_conversations"
]
},
"CalculateIssueModelStats": {
"methods": [
"calculate_issue_model_stats"
Expand Down Expand Up @@ -405,6 +415,11 @@
"bulk_analyze_conversations"
]
},
"BulkDeleteConversations": {
"methods": [
"bulk_delete_conversations"
]
},
"CalculateIssueModelStats": {
"methods": [
"calculate_issue_model_stats"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,137 @@ async def sample_bulk_analyze_conversations():
# Done; return the response.
return response

async def bulk_delete_conversations(
self,
request: Optional[
Union[contact_center_insights.BulkDeleteConversationsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes multiple conversations in a single request.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import contact_center_insights_v1
async def sample_bulk_delete_conversations():
# Create a client
client = contact_center_insights_v1.ContactCenterInsightsAsyncClient()
# Initialize request argument(s)
request = contact_center_insights_v1.BulkDeleteConversationsRequest(
parent="parent_value",
)
# Make the request
operation = client.bulk_delete_conversations(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsRequest, dict]]):
The request object. The request to delete conversations
in bulk.
parent (:class:`str`):
Required. The parent resource to
create analyses in. Format:
projects/{project}/locations/{location}
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
filter (:class:`str`):
Filter used to select the subset of
conversations to analyze.
This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsResponse`
The response for a bulk analyze conversations operation.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, filter])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = contact_center_insights.BulkDeleteConversationsRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if filter is not None:
request.filter = filter

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.bulk_delete_conversations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
contact_center_insights.BulkDeleteConversationsResponse,
metadata_type=contact_center_insights.BulkDeleteConversationsMetadata,
)

# Done; return the response.
return response

async def ingest_conversations(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,141 @@ def sample_bulk_analyze_conversations():
# Done; return the response.
return response

def bulk_delete_conversations(
self,
request: Optional[
Union[contact_center_insights.BulkDeleteConversationsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Deletes multiple conversations in a single request.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import contact_center_insights_v1
def sample_bulk_delete_conversations():
# Create a client
client = contact_center_insights_v1.ContactCenterInsightsClient()
# Initialize request argument(s)
request = contact_center_insights_v1.BulkDeleteConversationsRequest(
parent="parent_value",
)
# Make the request
operation = client.bulk_delete_conversations(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsRequest, dict]):
The request object. The request to delete conversations
in bulk.
parent (str):
Required. The parent resource to
create analyses in. Format:
projects/{project}/locations/{location}
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
filter (str):
Filter used to select the subset of
conversations to analyze.
This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsResponse`
The response for a bulk analyze conversations operation.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, filter])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a contact_center_insights.BulkDeleteConversationsRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(
request, contact_center_insights.BulkDeleteConversationsRequest
):
request = contact_center_insights.BulkDeleteConversationsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if filter is not None:
request.filter = filter

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.bulk_delete_conversations
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation.from_gapic(
response,
self._transport.operations_client,
contact_center_insights.BulkDeleteConversationsResponse,
metadata_type=contact_center_insights.BulkDeleteConversationsMetadata,
)

# Done; return the response.
return response

def ingest_conversations(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.bulk_delete_conversations: gapic_v1.method.wrap_method(
self.bulk_delete_conversations,
default_timeout=None,
client_info=client_info,
),
self.ingest_conversations: gapic_v1.method.wrap_method(
self.ingest_conversations,
default_timeout=None,
Expand Down Expand Up @@ -438,6 +443,15 @@ def bulk_analyze_conversations(
]:
raise NotImplementedError()

@property
def bulk_delete_conversations(
self,
) -> Callable[
[contact_center_insights.BulkDeleteConversationsRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def ingest_conversations(
self,
Expand Down
Loading

0 comments on commit 0510e6d

Please sign in to comment.