Skip to content

Commit 0510e6d

Browse files
feat: Launch BulkDelete API, and bulk audio import via the IngestConversations 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>
1 parent 08a092d commit 0510e6d

File tree

18 files changed

+1488
-4
lines changed

18 files changed

+1488
-4
lines changed

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
BulkAnalyzeConversationsMetadata,
2929
BulkAnalyzeConversationsRequest,
3030
BulkAnalyzeConversationsResponse,
31+
BulkDeleteConversationsMetadata,
32+
BulkDeleteConversationsRequest,
33+
BulkDeleteConversationsResponse,
3134
CalculateIssueModelStatsRequest,
3235
CalculateIssueModelStatsResponse,
3336
CalculateStatsRequest,
@@ -140,6 +143,9 @@
140143
"BulkAnalyzeConversationsMetadata",
141144
"BulkAnalyzeConversationsRequest",
142145
"BulkAnalyzeConversationsResponse",
146+
"BulkDeleteConversationsMetadata",
147+
"BulkDeleteConversationsRequest",
148+
"BulkDeleteConversationsResponse",
143149
"CalculateIssueModelStatsRequest",
144150
"CalculateIssueModelStatsResponse",
145151
"CalculateStatsRequest",

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights_v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
BulkAnalyzeConversationsMetadata,
2727
BulkAnalyzeConversationsRequest,
2828
BulkAnalyzeConversationsResponse,
29+
BulkDeleteConversationsMetadata,
30+
BulkDeleteConversationsRequest,
31+
BulkDeleteConversationsResponse,
2932
CalculateIssueModelStatsRequest,
3033
CalculateIssueModelStatsResponse,
3134
CalculateStatsRequest,
@@ -143,6 +146,9 @@
143146
"BulkAnalyzeConversationsMetadata",
144147
"BulkAnalyzeConversationsRequest",
145148
"BulkAnalyzeConversationsResponse",
149+
"BulkDeleteConversationsMetadata",
150+
"BulkDeleteConversationsRequest",
151+
"BulkDeleteConversationsResponse",
146152
"CalculateIssueModelStatsRequest",
147153
"CalculateIssueModelStatsResponse",
148154
"CalculateStatsRequest",

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"bulk_analyze_conversations"
1616
]
1717
},
18+
"BulkDeleteConversations": {
19+
"methods": [
20+
"bulk_delete_conversations"
21+
]
22+
},
1823
"CalculateIssueModelStats": {
1924
"methods": [
2025
"calculate_issue_model_stats"
@@ -210,6 +215,11 @@
210215
"bulk_analyze_conversations"
211216
]
212217
},
218+
"BulkDeleteConversations": {
219+
"methods": [
220+
"bulk_delete_conversations"
221+
]
222+
},
213223
"CalculateIssueModelStats": {
214224
"methods": [
215225
"calculate_issue_model_stats"
@@ -405,6 +415,11 @@
405415
"bulk_analyze_conversations"
406416
]
407417
},
418+
"BulkDeleteConversations": {
419+
"methods": [
420+
"bulk_delete_conversations"
421+
]
422+
},
408423
"CalculateIssueModelStats": {
409424
"methods": [
410425
"calculate_issue_model_stats"

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights_v1/services/contact_center_insights/async_client.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,137 @@ async def sample_bulk_analyze_conversations():
14831483
# Done; return the response.
14841484
return response
14851485

1486+
async def bulk_delete_conversations(
1487+
self,
1488+
request: Optional[
1489+
Union[contact_center_insights.BulkDeleteConversationsRequest, dict]
1490+
] = None,
1491+
*,
1492+
parent: Optional[str] = None,
1493+
filter: Optional[str] = None,
1494+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1495+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1496+
metadata: Sequence[Tuple[str, str]] = (),
1497+
) -> operation_async.AsyncOperation:
1498+
r"""Deletes multiple conversations in a single request.
1499+
1500+
.. code-block:: python
1501+
1502+
# This snippet has been automatically generated and should be regarded as a
1503+
# code template only.
1504+
# It will require modifications to work:
1505+
# - It may require correct/in-range values for request initialization.
1506+
# - It may require specifying regional endpoints when creating the service
1507+
# client as shown in:
1508+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1509+
from google.cloud import contact_center_insights_v1
1510+
1511+
async def sample_bulk_delete_conversations():
1512+
# Create a client
1513+
client = contact_center_insights_v1.ContactCenterInsightsAsyncClient()
1514+
1515+
# Initialize request argument(s)
1516+
request = contact_center_insights_v1.BulkDeleteConversationsRequest(
1517+
parent="parent_value",
1518+
)
1519+
1520+
# Make the request
1521+
operation = client.bulk_delete_conversations(request=request)
1522+
1523+
print("Waiting for operation to complete...")
1524+
1525+
response = (await operation).result()
1526+
1527+
# Handle the response
1528+
print(response)
1529+
1530+
Args:
1531+
request (Optional[Union[google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsRequest, dict]]):
1532+
The request object. The request to delete conversations
1533+
in bulk.
1534+
parent (:class:`str`):
1535+
Required. The parent resource to
1536+
create analyses in. Format:
1537+
1538+
projects/{project}/locations/{location}
1539+
1540+
This corresponds to the ``parent`` field
1541+
on the ``request`` instance; if ``request`` is provided, this
1542+
should not be set.
1543+
filter (:class:`str`):
1544+
Filter used to select the subset of
1545+
conversations to analyze.
1546+
1547+
This corresponds to the ``filter`` field
1548+
on the ``request`` instance; if ``request`` is provided, this
1549+
should not be set.
1550+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1551+
should be retried.
1552+
timeout (float): The timeout for this request.
1553+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1554+
sent along with the request as metadata.
1555+
1556+
Returns:
1557+
google.api_core.operation_async.AsyncOperation:
1558+
An object representing a long-running operation.
1559+
1560+
The result type for the operation will be
1561+
:class:`google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsResponse`
1562+
The response for a bulk analyze conversations operation.
1563+
1564+
"""
1565+
# Create or coerce a protobuf request object.
1566+
# Quick check: If we got a request object, we should *not* have
1567+
# gotten any keyword arguments that map to the request.
1568+
has_flattened_params = any([parent, filter])
1569+
if request is not None and has_flattened_params:
1570+
raise ValueError(
1571+
"If the `request` argument is set, then none of "
1572+
"the individual field arguments should be set."
1573+
)
1574+
1575+
request = contact_center_insights.BulkDeleteConversationsRequest(request)
1576+
1577+
# If we have keyword arguments corresponding to fields on the
1578+
# request, apply these.
1579+
if parent is not None:
1580+
request.parent = parent
1581+
if filter is not None:
1582+
request.filter = filter
1583+
1584+
# Wrap the RPC method; this adds retry and timeout information,
1585+
# and friendly error handling.
1586+
rpc = gapic_v1.method_async.wrap_method(
1587+
self._client._transport.bulk_delete_conversations,
1588+
default_timeout=None,
1589+
client_info=DEFAULT_CLIENT_INFO,
1590+
)
1591+
1592+
# Certain fields should be provided within the metadata header;
1593+
# add these here.
1594+
metadata = tuple(metadata) + (
1595+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1596+
)
1597+
1598+
# Send the request.
1599+
response = await rpc(
1600+
request,
1601+
retry=retry,
1602+
timeout=timeout,
1603+
metadata=metadata,
1604+
)
1605+
1606+
# Wrap the response in an operation future.
1607+
response = operation_async.from_gapic(
1608+
response,
1609+
self._client._transport.operations_client,
1610+
contact_center_insights.BulkDeleteConversationsResponse,
1611+
metadata_type=contact_center_insights.BulkDeleteConversationsMetadata,
1612+
)
1613+
1614+
# Done; return the response.
1615+
return response
1616+
14861617
async def ingest_conversations(
14871618
self,
14881619
request: Optional[

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights_v1/services/contact_center_insights/client.py

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,141 @@ def sample_bulk_analyze_conversations():
18851885
# Done; return the response.
18861886
return response
18871887

1888+
def bulk_delete_conversations(
1889+
self,
1890+
request: Optional[
1891+
Union[contact_center_insights.BulkDeleteConversationsRequest, dict]
1892+
] = None,
1893+
*,
1894+
parent: Optional[str] = None,
1895+
filter: Optional[str] = None,
1896+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1897+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1898+
metadata: Sequence[Tuple[str, str]] = (),
1899+
) -> operation.Operation:
1900+
r"""Deletes multiple conversations in a single request.
1901+
1902+
.. code-block:: python
1903+
1904+
# This snippet has been automatically generated and should be regarded as a
1905+
# code template only.
1906+
# It will require modifications to work:
1907+
# - It may require correct/in-range values for request initialization.
1908+
# - It may require specifying regional endpoints when creating the service
1909+
# client as shown in:
1910+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1911+
from google.cloud import contact_center_insights_v1
1912+
1913+
def sample_bulk_delete_conversations():
1914+
# Create a client
1915+
client = contact_center_insights_v1.ContactCenterInsightsClient()
1916+
1917+
# Initialize request argument(s)
1918+
request = contact_center_insights_v1.BulkDeleteConversationsRequest(
1919+
parent="parent_value",
1920+
)
1921+
1922+
# Make the request
1923+
operation = client.bulk_delete_conversations(request=request)
1924+
1925+
print("Waiting for operation to complete...")
1926+
1927+
response = operation.result()
1928+
1929+
# Handle the response
1930+
print(response)
1931+
1932+
Args:
1933+
request (Union[google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsRequest, dict]):
1934+
The request object. The request to delete conversations
1935+
in bulk.
1936+
parent (str):
1937+
Required. The parent resource to
1938+
create analyses in. Format:
1939+
1940+
projects/{project}/locations/{location}
1941+
1942+
This corresponds to the ``parent`` field
1943+
on the ``request`` instance; if ``request`` is provided, this
1944+
should not be set.
1945+
filter (str):
1946+
Filter used to select the subset of
1947+
conversations to analyze.
1948+
1949+
This corresponds to the ``filter`` field
1950+
on the ``request`` instance; if ``request`` is provided, this
1951+
should not be set.
1952+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1953+
should be retried.
1954+
timeout (float): The timeout for this request.
1955+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1956+
sent along with the request as metadata.
1957+
1958+
Returns:
1959+
google.api_core.operation.Operation:
1960+
An object representing a long-running operation.
1961+
1962+
The result type for the operation will be
1963+
:class:`google.cloud.contact_center_insights_v1.types.BulkDeleteConversationsResponse`
1964+
The response for a bulk analyze conversations operation.
1965+
1966+
"""
1967+
# Create or coerce a protobuf request object.
1968+
# Quick check: If we got a request object, we should *not* have
1969+
# gotten any keyword arguments that map to the request.
1970+
has_flattened_params = any([parent, filter])
1971+
if request is not None and has_flattened_params:
1972+
raise ValueError(
1973+
"If the `request` argument is set, then none of "
1974+
"the individual field arguments should be set."
1975+
)
1976+
1977+
# Minor optimization to avoid making a copy if the user passes
1978+
# in a contact_center_insights.BulkDeleteConversationsRequest.
1979+
# There's no risk of modifying the input as we've already verified
1980+
# there are no flattened fields.
1981+
if not isinstance(
1982+
request, contact_center_insights.BulkDeleteConversationsRequest
1983+
):
1984+
request = contact_center_insights.BulkDeleteConversationsRequest(request)
1985+
# If we have keyword arguments corresponding to fields on the
1986+
# request, apply these.
1987+
if parent is not None:
1988+
request.parent = parent
1989+
if filter is not None:
1990+
request.filter = filter
1991+
1992+
# Wrap the RPC method; this adds retry and timeout information,
1993+
# and friendly error handling.
1994+
rpc = self._transport._wrapped_methods[
1995+
self._transport.bulk_delete_conversations
1996+
]
1997+
1998+
# Certain fields should be provided within the metadata header;
1999+
# add these here.
2000+
metadata = tuple(metadata) + (
2001+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
2002+
)
2003+
2004+
# Send the request.
2005+
response = rpc(
2006+
request,
2007+
retry=retry,
2008+
timeout=timeout,
2009+
metadata=metadata,
2010+
)
2011+
2012+
# Wrap the response in an operation future.
2013+
response = operation.from_gapic(
2014+
response,
2015+
self._transport.operations_client,
2016+
contact_center_insights.BulkDeleteConversationsResponse,
2017+
metadata_type=contact_center_insights.BulkDeleteConversationsMetadata,
2018+
)
2019+
2020+
# Done; return the response.
2021+
return response
2022+
18882023
def ingest_conversations(
18892024
self,
18902025
request: Optional[

packages/google-cloud-contact-center-insights/google/cloud/contact_center_insights_v1/services/contact_center_insights/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ def _prep_wrapped_messages(self, client_info):
182182
default_timeout=None,
183183
client_info=client_info,
184184
),
185+
self.bulk_delete_conversations: gapic_v1.method.wrap_method(
186+
self.bulk_delete_conversations,
187+
default_timeout=None,
188+
client_info=client_info,
189+
),
185190
self.ingest_conversations: gapic_v1.method.wrap_method(
186191
self.ingest_conversations,
187192
default_timeout=None,
@@ -438,6 +443,15 @@ def bulk_analyze_conversations(
438443
]:
439444
raise NotImplementedError()
440445

446+
@property
447+
def bulk_delete_conversations(
448+
self,
449+
) -> Callable[
450+
[contact_center_insights.BulkDeleteConversationsRequest],
451+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
452+
]:
453+
raise NotImplementedError()
454+
441455
@property
442456
def ingest_conversations(
443457
self,

0 commit comments

Comments
 (0)