Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
🦉 Updates from OwlBot
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Dec 20, 2021
1 parent de5c5a9 commit a7a35a5
Show file tree
Hide file tree
Showing 401 changed files with 558 additions and 188,885 deletions.
4 changes: 4 additions & 0 deletions google/cloud/dialogflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
from google.cloud.dialogflow_v2.types.document import CreateDocumentRequest
from google.cloud.dialogflow_v2.types.document import DeleteDocumentRequest
from google.cloud.dialogflow_v2.types.document import Document
from google.cloud.dialogflow_v2.types.document import ExportDocumentRequest
from google.cloud.dialogflow_v2.types.document import GetDocumentRequest
from google.cloud.dialogflow_v2.types.document import KnowledgeOperationMetadata
from google.cloud.dialogflow_v2.types.document import ListDocumentsRequest
Expand Down Expand Up @@ -192,6 +193,7 @@
from google.cloud.dialogflow_v2.types.fulfillment import Fulfillment
from google.cloud.dialogflow_v2.types.fulfillment import GetFulfillmentRequest
from google.cloud.dialogflow_v2.types.fulfillment import UpdateFulfillmentRequest
from google.cloud.dialogflow_v2.types.gcs import GcsDestination
from google.cloud.dialogflow_v2.types.human_agent_assistant_event import (
HumanAgentAssistantEvent,
)
Expand Down Expand Up @@ -376,6 +378,7 @@
"CreateDocumentRequest",
"DeleteDocumentRequest",
"Document",
"ExportDocumentRequest",
"GetDocumentRequest",
"KnowledgeOperationMetadata",
"ListDocumentsRequest",
Expand Down Expand Up @@ -409,6 +412,7 @@
"Fulfillment",
"GetFulfillmentRequest",
"UpdateFulfillmentRequest",
"GcsDestination",
"HumanAgentAssistantEvent",
"BatchDeleteIntentsRequest",
"BatchUpdateIntentsRequest",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/dialogflow_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
from .types.document import CreateDocumentRequest
from .types.document import DeleteDocumentRequest
from .types.document import Document
from .types.document import ExportDocumentRequest
from .types.document import GetDocumentRequest
from .types.document import KnowledgeOperationMetadata
from .types.document import ListDocumentsRequest
Expand Down Expand Up @@ -142,6 +143,7 @@
from .types.fulfillment import Fulfillment
from .types.fulfillment import GetFulfillmentRequest
from .types.fulfillment import UpdateFulfillmentRequest
from .types.gcs import GcsDestination
from .types.human_agent_assistant_event import HumanAgentAssistantEvent
from .types.intent import BatchDeleteIntentsRequest
from .types.intent import BatchUpdateIntentsRequest
Expand Down Expand Up @@ -302,9 +304,11 @@
"EventInput",
"ExportAgentRequest",
"ExportAgentResponse",
"ExportDocumentRequest",
"FaqAnswer",
"Fulfillment",
"FulfillmentsClient",
"GcsDestination",
"GetAgentRequest",
"GetContextRequest",
"GetConversationProfileRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/dialogflow_v2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@
"delete_document"
]
},
"ExportDocument": {
"methods": [
"export_document"
]
},
"GetDocument": {
"methods": [
"get_document"
Expand Down Expand Up @@ -395,6 +400,11 @@
"delete_document"
]
},
"ExportDocument": {
"methods": [
"export_document"
]
},
"GetDocument": {
"methods": [
"get_document"
Expand Down
78 changes: 78 additions & 0 deletions google/cloud/dialogflow_v2/services/documents/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,84 @@ async def reload_document(
# Done; return the response.
return response

async def export_document(
self,
request: Union[document.ExportDocumentRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Exports a smart messaging candidate document into the specified
destination.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
- ``response``: [Document][google.cloud.dialogflow.v2.Document]
Args:
request (Union[google.cloud.dialogflow_v2.types.ExportDocumentRequest, dict]):
The request object. Request message for
[Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument].
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.dialogflow_v2.types.Document` A
knowledge document to be used by a
[KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase].
For more information, see the [knowledge base
guide](\ https://cloud.google.com/dialogflow/docs/how/knowledge-bases).
Note: The projects.agent.knowledgeBases.documents
resource is deprecated; only use
projects.knowledgeBases.documents.
"""
# Create or coerce a protobuf request object.
request = document.ExportDocumentRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.export_document,
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((("name", request.name),)),
)

# 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,
document.Document,
metadata_type=document.KnowledgeOperationMetadata,
)

# Done; return the response.
return response

async def __aenter__(self):
return self

Expand Down
79 changes: 79 additions & 0 deletions google/cloud/dialogflow_v2/services/documents/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,85 @@ def reload_document(
# Done; return the response.
return response

def export_document(
self,
request: Union[document.ExportDocumentRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Exports a smart messaging candidate document into the specified
destination.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
- ``response``: [Document][google.cloud.dialogflow.v2.Document]
Args:
request (Union[google.cloud.dialogflow_v2.types.ExportDocumentRequest, dict]):
The request object. Request message for
[Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument].
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.dialogflow_v2.types.Document` A
knowledge document to be used by a
[KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase].
For more information, see the [knowledge base
guide](\ https://cloud.google.com/dialogflow/docs/how/knowledge-bases).
Note: The projects.agent.knowledgeBases.documents
resource is deprecated; only use
projects.knowledgeBases.documents.
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
# in a document.ExportDocumentRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, document.ExportDocumentRequest):
request = document.ExportDocumentRequest(request)

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

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

# 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,
document.Document,
metadata_type=document.KnowledgeOperationMetadata,
)

# Done; return the response.
return response

def __enter__(self):
return self

Expand Down
12 changes: 12 additions & 0 deletions google/cloud/dialogflow_v2/services/documents/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def _prep_wrapped_messages(self, client_info):
self.reload_document: gapic_v1.method.wrap_method(
self.reload_document, default_timeout=None, client_info=client_info,
),
self.export_document: gapic_v1.method.wrap_method(
self.export_document, default_timeout=None, client_info=client_info,
),
}

def close(self):
Expand Down Expand Up @@ -217,5 +220,14 @@ def reload_document(
]:
raise NotImplementedError()

@property
def export_document(
self,
) -> Callable[
[document.ExportDocumentRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()


__all__ = ("DocumentsTransport",)
36 changes: 36 additions & 0 deletions google/cloud/dialogflow_v2/services/documents/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,42 @@ def reload_document(
)
return self._stubs["reload_document"]

@property
def export_document(
self,
) -> Callable[[document.ExportDocumentRequest], operations_pb2.Operation]:
r"""Return a callable for the export document method over gRPC.
Exports a smart messaging candidate document into the specified
destination.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
- ``response``: [Document][google.cloud.dialogflow.v2.Document]
Returns:
Callable[[~.ExportDocumentRequest],
~.Operation]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "export_document" not in self._stubs:
self._stubs["export_document"] = self.grpc_channel.unary_unary(
"/google.cloud.dialogflow.v2.Documents/ExportDocument",
request_serializer=document.ExportDocumentRequest.serialize,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["export_document"]

def close(self):
self.grpc_channel.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,44 @@ def reload_document(
)
return self._stubs["reload_document"]

@property
def export_document(
self,
) -> Callable[
[document.ExportDocumentRequest], Awaitable[operations_pb2.Operation]
]:
r"""Return a callable for the export document method over gRPC.
Exports a smart messaging candidate document into the specified
destination.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
- ``response``: [Document][google.cloud.dialogflow.v2.Document]
Returns:
Callable[[~.ExportDocumentRequest],
Awaitable[~.Operation]]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "export_document" not in self._stubs:
self._stubs["export_document"] = self.grpc_channel.unary_unary(
"/google.cloud.dialogflow.v2.Documents/ExportDocument",
request_serializer=document.ExportDocumentRequest.serialize,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["export_document"]

def close(self):
return self.grpc_channel.close()

Expand Down
4 changes: 4 additions & 0 deletions google/cloud/dialogflow_v2/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
CreateDocumentRequest,
DeleteDocumentRequest,
Document,
ExportDocumentRequest,
GetDocumentRequest,
KnowledgeOperationMetadata,
ListDocumentsRequest,
Expand Down Expand Up @@ -130,6 +131,7 @@
GetFulfillmentRequest,
UpdateFulfillmentRequest,
)
from .gcs import GcsDestination
from .human_agent_assistant_event import HumanAgentAssistantEvent
from .intent import (
BatchDeleteIntentsRequest,
Expand Down Expand Up @@ -286,6 +288,7 @@
"CreateDocumentRequest",
"DeleteDocumentRequest",
"Document",
"ExportDocumentRequest",
"GetDocumentRequest",
"KnowledgeOperationMetadata",
"ListDocumentsRequest",
Expand Down Expand Up @@ -319,6 +322,7 @@
"Fulfillment",
"GetFulfillmentRequest",
"UpdateFulfillmentRequest",
"GcsDestination",
"HumanAgentAssistantEvent",
"BatchDeleteIntentsRequest",
"BatchUpdateIntentsRequest",
Expand Down
Loading

0 comments on commit a7a35a5

Please sign in to comment.