From f8d67baca37bfef37cc451cfb119dfa3a030e7ee Mon Sep 17 00:00:00 2001 From: Google APIs Date: Wed, 2 Dec 2020 11:10:33 -0800 Subject: [PATCH] feat: added support for Actions SDK Build APIs PiperOrigin-RevId: 345270867 --- google/actions/sdk/v2/BUILD.bazel | 4 +- google/actions/sdk/v2/actions_sdk.proto | 270 ++++++++++++++++++ .../prompt/content/static_media_prompt.proto | 2 +- google/actions/sdk/v2/release_channel.proto | 44 +++ google/actions/sdk/v2/settings.proto | 7 + google/actions/sdk/v2/version.proto | 91 ++++++ 6 files changed, 416 insertions(+), 2 deletions(-) create mode 100644 google/actions/sdk/v2/release_channel.proto create mode 100644 google/actions/sdk/v2/version.proto diff --git a/google/actions/sdk/v2/BUILD.bazel b/google/actions/sdk/v2/BUILD.bazel index dbd2f489..abc2d289 100644 --- a/google/actions/sdk/v2/BUILD.bazel +++ b/google/actions/sdk/v2/BUILD.bazel @@ -32,10 +32,12 @@ proto_library( "files.proto", "localized_settings.proto", "manifest.proto", + "release_channel.proto", "settings.proto", "surface.proto", "theme_customization.proto", "validation_results.proto", + "version.proto", "webhook.proto", ], deps = [ @@ -78,10 +80,10 @@ load( nodejs_gapic_library( name = "sdk_nodejs_gapic", + package_name = "@assistant/actions", src = ":sdk_proto_with_info", grpc_service_config = "actions_grpc_service_config.json", package = "google.actions.sdk.v2", - package_name = "@assistant/actions", service_yaml = "actions_v2.yaml", deps = [], ) diff --git a/google/actions/sdk/v2/actions_sdk.proto b/google/actions/sdk/v2/actions_sdk.proto index edbda450..0cc32925 100644 --- a/google/actions/sdk/v2/actions_sdk.proto +++ b/google/actions/sdk/v2/actions_sdk.proto @@ -18,7 +18,9 @@ package google.actions.sdk.v2; import "google/actions/sdk/v2/account_linking_secret.proto"; import "google/actions/sdk/v2/files.proto"; +import "google/actions/sdk/v2/release_channel.proto"; import "google/actions/sdk/v2/validation_results.proto"; +import "google/actions/sdk/v2/version.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; @@ -34,6 +36,14 @@ option java_package = "com.google.actions.sdk.v2"; service ActionsSdk { option (google.api.default_host) = "actions.googleapis.com"; + // Updates the project draft based on the model. + rpc WriteDraft(stream WriteDraftRequest) returns (Draft) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/draft:write" + body: "*" + }; + } + // Updates the user's project preview based on the model. rpc WritePreview(stream WritePreviewRequest) returns (Preview) { option (google.api.http) = { @@ -41,6 +51,106 @@ service ActionsSdk { body: "*" }; } + + // Creates a project version based on the model and triggers deployment to the + // specified release channel, if specified. + rpc CreateVersion(stream CreateVersionRequest) returns (Version) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/versions:create" + body: "*" + }; + } + + // Reads the entire content of the project draft. + rpc ReadDraft(ReadDraftRequest) returns (stream ReadDraftResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/draft}:read" + body: "*" + }; + } + + // Reads the entire content of a project version. + rpc ReadVersion(ReadVersionRequest) returns (stream ReadVersionResponse) { + option (google.api.http) = { + post: "/v2/{name=projects/*/versions/*}:read" + body: "*" + }; + } + + // Encrypts the OAuth client secret used in account linking flows. + // This can be used to encrypt the client secret for the first time (e.g. + // before the first push or after changing the client secret) or to re-encrypt + // a client secret using the latest primary key version (considering key + // rotation). + rpc EncryptSecret(EncryptSecretRequest) returns (EncryptSecretResponse) { + option (google.api.http) = { + post: "/v2:encryptSecret" + body: "*" + }; + } + + // Decrypts the OAuth client secret used in account linking flows. + // This can be used to view the client secret (e.g. after pulling a project). + rpc DecryptSecret(DecryptSecretRequest) returns (DecryptSecretResponse) { + option (google.api.http) = { + post: "/v2:decryptSecret" + body: "*" + }; + } + + // Lists all release channels and corresponding versions, if any. + rpc ListReleaseChannels(ListReleaseChannelsRequest) returns (ListReleaseChannelsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/releaseChannels" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all versions and their current states. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Streaming RPC request for WriteDraft. +message WriteDraftRequest { + // Required. The parent resource name in the format `projects/{project}`. The + // `{project}` is the cloud project ID associated with the project. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "actions.googleapis.com/Draft" + } + ]; + + // Required. List of files sent to the server at a time. This is a list of config files + // or data files. + // 1. The first request must be a ConfigFiles. + // 2. The first request must have a ConfigFile with 'settings'. + // 3. The first request must have a ConfigFile with 'manifest'. + // 4. The webhook ConfigFile corresponding to inline cloud function must be + // streamed before the DataFile corresponding to its source code. + Files files = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Definition of draft resource. +message Draft { + option (google.api.resource) = { + type: "actions.googleapis.com/Draft" + pattern: "projects/{project}/draft" + }; + + // The unique identifier of the draft in the following format. + // `projects/{project}/draft` + string name = 1; + + // Validation results associated with the project draft content. Note that + // WriteDraft updates the draft despite the warnings as warnings are not draft + // blocking. + ValidationResults validation_results = 2; } // Streaming RPC request for WritePreview. @@ -86,6 +196,8 @@ message WritePreviewRequest { // 1. The first request must be a ConfigFiles. // 2. The first request must have a ConfigFile with 'settings'. // 3. The first request must have a ConfigFile with 'manifest'. + // 4. The webhook ConfigFile corresponding to inline cloud function must be + // streamed before the DataFile corresponding to its source code. Files files = 5; // Content sourced from the project draft. @@ -116,3 +228,161 @@ message Preview { // The simulator URL to test the user preview. string simulator_url = 3; } + +// Streaming RPC request for CreateVersion. +message CreateVersionRequest { + // Required. The parent resource name in the format `projects/{project}`. The + // `{project}` is the cloud project ID associated with the project. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "actions.googleapis.com/Version" + } + ]; + + // Required. List of files sent to the server at a time. This is a list of config files + // or data files. + // 1. The first request must be a ConfigFiles. + // 2. The first request must have a ConfigFile with 'settings'. + // 3. The first request must have a ConfigFile with 'manifest'. + // 4. The webhook ConfigFile corresponding to inline cloud function must be + // streamed before the DataFile corresponding to its source code. + Files files = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The release channel to deploy the version, if specified. The supported + // built in release channels are actions.channels.Production, + // actions.channels.ClosedBeta, actions.channels.Alpha. + // . + string release_channel = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// RPC request for ReadDraft. +message ReadDraftRequest { + // Required. The name of the resource in the format `projects/{project}/draft`. The + // `{project}` is the cloud project ID associated with the project. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The version of the crypto key used to encrypt the account linking OAuth + // client secret. If not specified, the primary key version is used for + // encryption. Only relevant for projects with account linking with client + // secret. + string client_secret_encryption_key_version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Streaming RPC response for ReadDraft. +message ReadDraftResponse { + // List of files sent from the server at a time. + Files files = 3; +} + +// RPC request for ReadVersion. +message ReadVersionRequest { + // Required. The name of the version resource in the format + // `projects/{project}/versions/{version}`. `{project}` is the + // cloud project ID associated with the project, `{version}` is the + // identifier of the version being read. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The version of the crypto key used to encrypt the account linking OAuth + // client secret. If not specified, the primary key version is used for + // encryption. Only relevant for projects with account linking with client + // secret. + string client_secret_encryption_key_version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Streaming RPC response for ReadVersion. +message ReadVersionResponse { + // List of files sent from the server at a time. + Files files = 1; +} + +// RPC request for EncryptSecret. +message EncryptSecretRequest { + // Required. The account linking client secret plaintext. + string client_secret = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// RPC response for EncryptSecret. +message EncryptSecretResponse { + // Contains the encrypted account linking client secret and the key version + // used to encrypt the secret. + AccountLinkingSecret account_linking_secret = 1; +} + +// RPC request for DecryptSecret. +message DecryptSecretRequest { + // Required. The account linking client secret ciphertext. + bytes encrypted_client_secret = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// RPC response for DecryptSecret. +message DecryptSecretResponse { + // The account linking client secret plaintext. + string client_secret = 1; +} + +// RPC request for listing release channels +message ListReleaseChannelsRequest { + // Required. The name of the resource in the format `projects/{project}`. The + // `{project}` is the cloud project ID associated with the project. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "actions.googleapis.com/ReleaseChannel" + } + ]; + + // The maximum number of release channels to return. The service may return + // fewer than this value. If unspecified, at most 50 release channels will be + // returned. + int32 page_size = 2; + + // A page token, received from a previous `ListReleaseChannels` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListReleaseChannels` + // must match the call that provided the page token. + string page_token = 3; +} + +// RPC response for listing release channels +message ListReleaseChannelsResponse { + // List of the release channels for the given project id. + repeated ReleaseChannel release_channels = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// RPC request for listing versions +message ListVersionsRequest { + // Required. The name of the resource in the format `projects/{project}`. The + // `{project}` is the cloud project ID associated with the project. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "actions.googleapis.com/Version" + } + ]; + + // The maximum number of versions to return. The service may return + // fewer than this value. If unspecified, at most 50 versions will be + // returned. + int32 page_size = 2; + + // A page token, received from a previous `ListVersions` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListVersions` + // must match the call that provided the page token. + string page_token = 3; +} + +// RPC response for listing versions +message ListVersionsResponse { + // List of the versions for the given project id. + repeated Version versions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} diff --git a/google/actions/sdk/v2/interactionmodel/prompt/content/static_media_prompt.proto b/google/actions/sdk/v2/interactionmodel/prompt/content/static_media_prompt.proto index 2ec544c8..982a2dec 100644 --- a/google/actions/sdk/v2/interactionmodel/prompt/content/static_media_prompt.proto +++ b/google/actions/sdk/v2/interactionmodel/prompt/content/static_media_prompt.proto @@ -25,7 +25,7 @@ option java_outer_classname = "StaticMediaPromptProto"; option java_package = "com.google.actions.sdk.v2.interactionmodel.prompt"; // Contains information about the media, such as name, description, url, etc. -// Next id: 10 +// Next id: 11 message StaticMediaPrompt { // Media type of this response. enum MediaType { diff --git a/google/actions/sdk/v2/release_channel.proto b/google/actions/sdk/v2/release_channel.proto new file mode 100644 index 00000000..20c62428 --- /dev/null +++ b/google/actions/sdk/v2/release_channel.proto @@ -0,0 +1,44 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.actions.sdk.v2; + +import "google/api/resource.proto"; + +option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk"; +option java_multiple_files = true; +option java_outer_classname = "ReleaseChannelProto"; +option java_package = "com.google.actions.sdk.v2"; + +// Definition of release channel resource. +message ReleaseChannel { + option (google.api.resource) = { + type: "actions.googleapis.com/ReleaseChannel" + pattern: "projects/{project}/releaseChannels/{release_channel}" + }; + + // The unique name of the release channel in the following format. + // `projects/{project}/releaseChannels/{release_channel}`. + string name = 1; + + // Version currently deployed to this release channel in the following format: + // `projects/{project}/versions/{version}`. + string current_version = 2; + + // Version to be deployed to this release channel in the following format: + // `projects/{project}/versions/{version}`. + string pending_version = 3; +} diff --git a/google/actions/sdk/v2/settings.proto b/google/actions/sdk/v2/settings.proto index f89435ea..94835b2d 100644 --- a/google/actions/sdk/v2/settings.proto +++ b/google/actions/sdk/v2/settings.proto @@ -176,4 +176,11 @@ message Settings { // Allow users to create or link accounts through Google sign-in and/or your // own OAuth service. AccountLinking account_linking = 16; + + // Android apps selected to acccess Google Play purchases for transactions. + // This is a selection from the Android apps connected to the actions project + // to verify brand ownership and enable additional features. See + // https://developers.google.com/assistant/console/brand-verification for more + // information. + repeated string selected_android_apps = 20; } diff --git a/google/actions/sdk/v2/version.proto b/google/actions/sdk/v2/version.proto new file mode 100644 index 00000000..3df6f6dd --- /dev/null +++ b/google/actions/sdk/v2/version.proto @@ -0,0 +1,91 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.actions.sdk.v2; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.actions.sdk.v2"; + +// Definition of version resource. +message Version { + option (google.api.resource) = { + type: "actions.googleapis.com/Version" + pattern: "projects/{project}/versions/{version}" + }; + + // Represents the current state of the version. + message VersionState { + // Enum indicating the states that a Version can take. This enum is not yet + // frozen and values maybe added later. + enum State { + // Default value of State. + STATE_UNSPECIFIED = 0; + + // The version creation is in progress. + CREATION_IN_PROGRESS = 1; + + // The version creation failed. + CREATION_FAILED = 2; + + // The version has been successfully created. + CREATED = 3; + + // The version is under policy review (aka Approval). + REVIEW_IN_PROGRESS = 4; + + // The version has been approved for policy review and can be deployed. + APPROVED = 5; + + // The version has been conditionally approved but is pending final + // review. It may be rolled back if final review is denied. + CONDITIONALLY_APPROVED = 6; + + // The version has been denied for policy review. + DENIED = 7; + + // The version is taken down as entire agent and all versions are taken + // down. + UNDER_TAKEDOWN = 8; + + // The version has been deleted. + DELETED = 9; + } + + // The current state of the version. + State state = 1; + + // User-friendly message for the current state of the version. + string message = 2; + } + + // The unique identifier of the version in the following format. + // `projects/{project}/versions/{version}`. + string name = 1; + + // The current state of the version. + VersionState version_state = 2; + + // Email of the user who created this version. + string creator = 3; + + // Timestamp of the last change to this version. + google.protobuf.Timestamp update_time = 4; +}