Skip to content

Commit

Permalink
feat: Expose supported languages of the agent;
Browse files Browse the repository at this point in the history
feat: add export / import flow API
docs: Update docs on Pages, Session, Version, etc.

PiperOrigin-RevId: 370860251
  • Loading branch information
Google APIs authored and copybara-github committed Apr 28, 2021
1 parent cfa6e02 commit ef119e7
Show file tree
Hide file tree
Showing 9 changed files with 324 additions and 110 deletions.
4 changes: 1 addition & 3 deletions google/cloud/dialogflow/cx/v3/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ ruby_grpc_library(
ruby_cloud_gapic_library(
name = "cx_ruby_gapic",
srcs = [":cx_proto_with_info"],
extra_protoc_parameters = [
"ruby-cloud-gem-name=google-cloud-dialogflow-cx-v3",
],
extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-dialogflow-cx-v3"],
grpc_service_config = "dialogflow_grpc_service_config.json",
deps = [
":cx_ruby_grpc",
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/dialogflow/cx/v3/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/dialogflow/cx/v3/flow.proto";
import "google/cloud/dialogflow/cx/v3/security_settings.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
Expand Down Expand Up @@ -165,6 +166,10 @@ message Agent {
// This field cannot be set by the [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] method.
string default_language_code = 3 [(google.api.field_behavior) = IMMUTABLE];

// The list of all languages supported by the agent (except for the
// `default_language_code`).
repeated string supported_language_codes = 4;

// Required. The time zone of the agent from the [time zone
// database](https://www.iana.org/time-zones), e.g., America/New_York,
// Europe/Paris.
Expand Down Expand Up @@ -305,6 +310,16 @@ message ExportAgentRequest {
// `gs://<bucket-name>/<object-name>`.
// If left unspecified, the serialized agent is returned inline.
string agent_uri = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Environment name. If not set, draft environment is assumed.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/environments/<Environment ID>`.
string environment = 5 [
(google.api.field_behavior) = OPTIONAL,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Environment"
}
];
}

// The response message for [Agents.ExportAgent][google.cloud.dialogflow.cx.v3.Agents.ExportAgent].
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/dialogflow/cx/v3/dialogflow_v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ types:
- name: google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse
- name: google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata
- name: google.cloud.dialogflow.cx.v3.ExportAgentResponse
- name: google.cloud.dialogflow.cx.v3.ExportFlowResponse
- name: google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata
- name: google.cloud.dialogflow.cx.v3.ExportTestCasesResponse
- name: google.cloud.dialogflow.cx.v3.ImportFlowResponse
- name: google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata
- name: google.cloud.dialogflow.cx.v3.ImportTestCasesResponse
- name: google.cloud.dialogflow.cx.v3.RunTestCaseMetadata
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/dialogflow/cx/v3/experiment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ message Experiment {
// Version variant and associated metrics.
message VersionMetrics {
// The name of the flow [Version][google.cloud.dialogflow.cx.v3.Version].
// Format: `projects/<Project Number>/locations/<Location
// Format: `projects/<Project ID>/locations/<Location
// ID>/agents/<Agent ID>/flows/<Flow ID>/versions/<Version ID>`.
string version = 1 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Version"
Expand Down
122 changes: 122 additions & 0 deletions google/cloud/dialogflow/cx/v3/flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,33 @@ service Flows {
};
option (google.api.method_signature) = "name";
}

// Imports the specified flow to the specified agent from a binary file.
rpc ImportFlow(ImportFlowRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v3/{parent=projects/*/locations/*/agents/*}/flows:import"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "ImportFlowResponse"
metadata_type: "google.protobuf.Struct"
};
}

// Exports the specified flow to a binary file.
//
// Note that resources (e.g. intents, entities, webhooks) that the flow
// references will also be exported.
rpc ExportFlow(ExportFlowRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v3/{name=projects/*/locations/*/agents/*/flows/*}:export"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "ExportFlowResponse"
metadata_type: "google.protobuf.Struct"
};
}
}

// Settings related to NLU.
Expand Down Expand Up @@ -260,7 +287,9 @@ message CreateFlowRequest {
// The language of the following fields in `flow`:
//
// * `Flow.event_handlers.trigger_fulfillment.messages`
// * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
// * `Flow.transition_routes.trigger_fulfillment.messages`
// * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down Expand Up @@ -317,7 +346,9 @@ message ListFlowsRequest {
// dependent:
//
// * `Flow.event_handlers.trigger_fulfillment.messages`
// * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
// * `Flow.transition_routes.trigger_fulfillment.messages`
// * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down Expand Up @@ -354,7 +385,9 @@ message GetFlowRequest {
// dependent:
//
// * `Flow.event_handlers.trigger_fulfillment.messages`
// * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
// * `Flow.transition_routes.trigger_fulfillment.messages`
// * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand All @@ -376,7 +409,9 @@ message UpdateFlowRequest {
// The language of the following fields in `flow`:
//
// * `Flow.event_handlers.trigger_fulfillment.messages`
// * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
// * `Flow.transition_routes.trigger_fulfillment.messages`
// * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down Expand Up @@ -449,3 +484,90 @@ message FlowValidationResult {
// Last time the flow was validated.
google.protobuf.Timestamp update_time = 3;
}

// The request message for [Flows.ImportFlow][google.cloud.dialogflow.cx.v3.Flows.ImportFlow].
message ImportFlowRequest {
// Import option.
enum ImportOption {
// Unspecified. Treated as `KEEP`.
IMPORT_OPTION_UNSPECIFIED = 0;

// Always respect settings in exported flow content. It may cause a
// import failure if some settings (e.g. custom NLU) are not supported in
// the agent to import into.
KEEP = 1;

// Fallback to default settings if some settings are not supported in the
// agent to import into. E.g. Standard NLU will be used if custom NLU is
// not available.
FALLBACK = 2;
}

// Required. The agent to import the flow into.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "dialogflow.googleapis.com/Flow"
}
];

// Required. The flow to import.
oneof flow {
// The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
// to import flow from. The format of this URI must be
// `gs://<bucket-name>/<object-name>`.
string flow_uri = 2;

// Uncompressed raw byte content for flow.
bytes flow_content = 3;
}

// Flow import mode. If not specified, `KEEP` is assumed.
ImportOption import_option = 4;
}

// The response message for [Flows.ImportFlow][google.cloud.dialogflow.cx.v3.Flows.ImportFlow].
message ImportFlowResponse {
// The unique identifier of the new flow.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/flows/<Flow ID>`.
string flow = 1 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Flow"
}];
}

// The request message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3.Flows.ExportFlow].
message ExportFlowRequest {
// Required. The name of the flow to export.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/flows/<Flow ID>`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Flow"
}
];

// Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to
// export the flow to. The format of this URI must be
// `gs://<bucket-name>/<object-name>`.
// If left unspecified, the serialized flow is returned inline.
string flow_uri = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Whether to export flows referenced by the specified flow.
bool include_referenced_flows = 4 [(google.api.field_behavior) = OPTIONAL];
}

// The response message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3.Flows.ExportFlow].
message ExportFlowResponse {
// The exported flow.
oneof flow {
// The URI to a file containing the exported flow. This field is populated
// only if `flow_uri` is specified in [ExportFlowRequest][google.cloud.dialogflow.cx.v3.ExportFlowRequest].
string flow_uri = 1;

// Uncompressed raw byte content for flow.
bytes flow_content = 2;
}
}
40 changes: 32 additions & 8 deletions google/cloud/dialogflow/cx/v3/page.proto
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,17 @@ message ListPagesRequest {
// dependent:
//
// * `Page.entry_fulfillment.messages`
// * `Page.entry_fulfillment.conditional_cases`
// * `Page.event_handlers.trigger_fulfillment.messages`
// * `Page.event_handlers.trigger_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
// *
// `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
// * `Page.transition_routes.trigger_fulfillment.messages`
// *
// `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages`
// `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
// * `Page.transition_routes.trigger_fulfillment.messages`
// * `Page.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down Expand Up @@ -426,11 +432,17 @@ message GetPageRequest {
// dependent:
//
// * `Page.entry_fulfillment.messages`
// * `Page.entry_fulfillment.conditional_cases`
// * `Page.event_handlers.trigger_fulfillment.messages`
// * `Page.event_handlers.trigger_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
// *
// `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
// * `Page.transition_routes.trigger_fulfillment.messages`
// *
// `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages`
// `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
// * `Page.transition_routes.trigger_fulfillment.messages`
// * `Page.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down Expand Up @@ -458,11 +470,17 @@ message CreatePageRequest {
// The language of the following fields in `page`:
//
// * `Page.entry_fulfillment.messages`
// * `Page.entry_fulfillment.conditional_cases`
// * `Page.event_handlers.trigger_fulfillment.messages`
// * `Page.event_handlers.trigger_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
// *
// `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
// * `Page.transition_routes.trigger_fulfillment.messages`
// *
// `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages`
// `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
// * `Page.transition_routes.trigger_fulfillment.messages`
// * `Page.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand All @@ -480,11 +498,17 @@ message UpdatePageRequest {
// The language of the following fields in `page`:
//
// * `Page.entry_fulfillment.messages`
// * `Page.entry_fulfillment.conditional_cases`
// * `Page.event_handlers.trigger_fulfillment.messages`
// * `Page.event_handlers.trigger_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
// *
// `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
// * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
// * `Page.transition_routes.trigger_fulfillment.messages`
// *
// `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages`
// `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
// * `Page.transition_routes.trigger_fulfillment.messages`
// * `Page.transition_routes.trigger_fulfillment.conditional_cases`
//
// If not specified, the agent's default language is used.
// [Many
Expand Down
Loading

0 comments on commit ef119e7

Please sign in to comment.