1// Copyright 2020 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.actions.sdk.v2; 18 19import "google/actions/sdk/v2/account_linking_secret.proto"; 20import "google/actions/sdk/v2/files.proto"; 21import "google/actions/sdk/v2/release_channel.proto"; 22import "google/actions/sdk/v2/validation_results.proto"; 23import "google/actions/sdk/v2/version.proto"; 24import "google/api/annotations.proto"; 25import "google/api/client.proto"; 26import "google/api/field_behavior.proto"; 27import "google/api/resource.proto"; 28import "google/protobuf/wrappers.proto"; 29 30option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk"; 31option java_multiple_files = true; 32option java_outer_classname = "ActionsSdkProto"; 33option java_package = "com.google.actions.sdk.v2"; 34 35// Actions SDK API which allows developers to build projects using the SDK. 36service ActionsSdk { 37 option (google.api.default_host) = "actions.googleapis.com"; 38 39 // Updates the project draft based on the model. 40 rpc WriteDraft(stream WriteDraftRequest) returns (Draft) { 41 option (google.api.http) = { 42 post: "/v2/{parent=projects/*}/draft:write" 43 body: "*" 44 }; 45 } 46 47 // Updates the user's project preview based on the model. 48 rpc WritePreview(stream WritePreviewRequest) returns (Preview) { 49 option (google.api.http) = { 50 post: "/v2/{parent=projects/*}/preview:write" 51 body: "*" 52 }; 53 } 54 55 // Creates a project version based on the model and triggers deployment to the 56 // specified release channel, if specified. 57 rpc CreateVersion(stream CreateVersionRequest) returns (Version) { 58 option (google.api.http) = { 59 post: "/v2/{parent=projects/*}/versions:create" 60 body: "*" 61 }; 62 } 63 64 // Reads the entire content of the project draft. 65 rpc ReadDraft(ReadDraftRequest) returns (stream ReadDraftResponse) { 66 option (google.api.http) = { 67 post: "/v2/{name=projects/*/draft}:read" 68 body: "*" 69 }; 70 } 71 72 // Reads the entire content of a project version. 73 rpc ReadVersion(ReadVersionRequest) returns (stream ReadVersionResponse) { 74 option (google.api.http) = { 75 post: "/v2/{name=projects/*/versions/*}:read" 76 body: "*" 77 }; 78 } 79 80 // Encrypts the OAuth client secret used in account linking flows. 81 // This can be used to encrypt the client secret for the first time (e.g. 82 // before the first push or after changing the client secret) or to re-encrypt 83 // a client secret using the latest primary key version (considering key 84 // rotation). 85 rpc EncryptSecret(EncryptSecretRequest) returns (EncryptSecretResponse) { 86 option (google.api.http) = { 87 post: "/v2:encryptSecret" 88 body: "*" 89 }; 90 } 91 92 // Decrypts the OAuth client secret used in account linking flows. 93 // This can be used to view the client secret (e.g. after pulling a project). 94 rpc DecryptSecret(DecryptSecretRequest) returns (DecryptSecretResponse) { 95 option (google.api.http) = { 96 post: "/v2:decryptSecret" 97 body: "*" 98 }; 99 } 100 101 // Lists all the sample projects supported by the gactions CLI. 102 rpc ListSampleProjects(ListSampleProjectsRequest) returns (ListSampleProjectsResponse) { 103 option (google.api.http) = { 104 get: "/v2/sampleProjects" 105 }; 106 } 107 108 // Lists all release channels and corresponding versions, if any. 109 rpc ListReleaseChannels(ListReleaseChannelsRequest) returns (ListReleaseChannelsResponse) { 110 option (google.api.http) = { 111 get: "/v2/{parent=projects/*}/releaseChannels" 112 }; 113 option (google.api.method_signature) = "parent"; 114 } 115 116 // Lists all versions and their current states. 117 rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { 118 option (google.api.http) = { 119 get: "/v2/{parent=projects/*}/versions" 120 }; 121 option (google.api.method_signature) = "parent"; 122 } 123} 124 125// Streaming RPC request for WriteDraft. 126message WriteDraftRequest { 127 // Required. The parent resource name in the format `projects/{project}`. The 128 // `{project}` is the cloud project ID associated with the project. 129 string parent = 1 [ 130 (google.api.field_behavior) = REQUIRED, 131 (google.api.resource_reference) = { 132 child_type: "actions.googleapis.com/Draft" 133 } 134 ]; 135 136 // Required. List of files sent to the server at a time. This is a list of config files 137 // or data files. 138 // 1. The first request must be a ConfigFiles. 139 // 2. The first request must have a ConfigFile with 'settings'. 140 // 3. The first request must have a ConfigFile with 'manifest'. 141 // 4. The webhook ConfigFile corresponding to inline cloud function must be 142 // streamed before the DataFile corresponding to its source code. 143 Files files = 4 [(google.api.field_behavior) = REQUIRED]; 144} 145 146// Definition of draft resource. 147message Draft { 148 option (google.api.resource) = { 149 type: "actions.googleapis.com/Draft" 150 pattern: "projects/{project}/draft" 151 }; 152 153 // The unique identifier of the draft in the following format. 154 // `projects/{project}/draft` 155 string name = 1; 156 157 // Validation results associated with the project draft content. Note that 158 // WriteDraft updates the draft despite the warnings as warnings are not draft 159 // blocking. 160 ValidationResults validation_results = 2; 161} 162 163// Streaming RPC request for WritePreview. 164message WritePreviewRequest { 165 // Indicates the preview content will be coming from the Draft. 166 message ContentFromDraft { 167 168 } 169 170 // Indicates the preview content will be coming from an exiting version. 171 message ContentFromSubmittedVersion { 172 // Required. Submitted version of the project to be used to create a preview. 173 // Format: `projects/{project}/versions/{version}` 174 string version = 1 [ 175 (google.api.field_behavior) = REQUIRED, 176 (google.api.resource_reference) = { 177 type: "actions.googleapis.com/Version" 178 } 179 ]; 180 } 181 182 // Settings for updating the preview. 183 message PreviewSettings { 184 // Indicates whether or not to run certain operations, such as transactions, 185 // in sandbox mode. By default, preview requests run these operations in 186 // sandbox mode. In other words, the default value for `sandbox` is `true`. 187 google.protobuf.BoolValue sandbox = 1; 188 } 189 190 // Required. The parent resource name in the format `projects/{project}`. The 191 // `{project}` is the cloud project ID associated with the project. 192 string parent = 1 [ 193 (google.api.field_behavior) = REQUIRED, 194 (google.api.resource_reference) = { 195 child_type: "actions.googleapis.com/Preview" 196 } 197 ]; 198 199 // Data source used to created the preview. 200 oneof source { 201 // List of files sent to the server at a time. This is a list of config 202 // files or data files. 203 // 1. The first request must be a ConfigFiles. 204 // 2. The first request must have a ConfigFile with 'settings'. 205 // 3. The first request must have a ConfigFile with 'manifest'. 206 // 4. The webhook ConfigFile corresponding to inline cloud function must be 207 // streamed before the DataFile corresponding to its source code. 208 Files files = 5; 209 210 // Content sourced from the project draft. 211 ContentFromDraft draft = 6; 212 213 // Content sourced from the an exiting version. 214 ContentFromSubmittedVersion submitted_version = 7; 215 } 216 217 // Required. The settings for updating the user's preview. 218 PreviewSettings preview_settings = 4 [(google.api.field_behavior) = REQUIRED]; 219} 220 221// Definition of preview resource. 222message Preview { 223 option (google.api.resource) = { 224 type: "actions.googleapis.com/Preview" 225 pattern: "projects/{project}/previews/{preview}" 226 }; 227 228 // The unique identifier of the preview. 229 // Format: `projects/{project}/preview` 230 string name = 1; 231 232 // Validation results associated with the user project preview content. 233 ValidationResults validation_results = 2; 234 235 // The simulator URL to test the user preview. 236 string simulator_url = 3; 237} 238 239// Streaming RPC request for CreateVersion. 240message CreateVersionRequest { 241 // Required. The parent resource name in the format `projects/{project}`. The 242 // `{project}` is the cloud project ID associated with the project. 243 string parent = 1 [ 244 (google.api.field_behavior) = REQUIRED, 245 (google.api.resource_reference) = { 246 child_type: "actions.googleapis.com/Version" 247 } 248 ]; 249 250 // Required. List of files sent to the server at a time. This is a list of config files 251 // or data files. 252 // 1. The first request must be a ConfigFiles. 253 // 2. The first request must have a ConfigFile with 'settings'. 254 // 3. The first request must have a ConfigFile with 'manifest'. 255 // 4. The webhook ConfigFile corresponding to inline cloud function must be 256 // streamed before the DataFile corresponding to its source code. 257 Files files = 5 [(google.api.field_behavior) = REQUIRED]; 258 259 // Optional. The release channel to deploy the version, if specified. The supported 260 // built in release channels are actions.channels.Production, 261 // actions.channels.ClosedBeta, actions.channels.Alpha. 262 // . 263 string release_channel = 4 [(google.api.field_behavior) = OPTIONAL]; 264} 265 266// RPC request for ReadDraft. 267message ReadDraftRequest { 268 // Required. The name of the resource in the format `projects/{project}/draft`. The 269 // `{project}` is the cloud project ID associated with the project. 270 string name = 1 [(google.api.field_behavior) = REQUIRED]; 271 272 // Optional. The version of the crypto key used to encrypt the account linking OAuth 273 // client secret. If not specified, the primary key version is used for 274 // encryption. Only relevant for projects with account linking with client 275 // secret. 276 string client_secret_encryption_key_version = 2 [(google.api.field_behavior) = OPTIONAL]; 277} 278 279// Streaming RPC response for ReadDraft. 280message ReadDraftResponse { 281 // List of files sent from the server at a time. 282 Files files = 3; 283} 284 285// RPC request for ReadVersion. 286message ReadVersionRequest { 287 // Required. The name of the version resource in the format 288 // `projects/{project}/versions/{version}`. `{project}` is the 289 // cloud project ID associated with the project, `{version}` is the 290 // identifier of the version being read. 291 string name = 1 [(google.api.field_behavior) = REQUIRED]; 292 293 // Optional. The version of the crypto key used to encrypt the account linking OAuth 294 // client secret. If not specified, the primary key version is used for 295 // encryption. Only relevant for projects with account linking with client 296 // secret. 297 string client_secret_encryption_key_version = 2 [(google.api.field_behavior) = OPTIONAL]; 298} 299 300// Streaming RPC response for ReadVersion. 301message ReadVersionResponse { 302 // List of files sent from the server at a time. 303 Files files = 1; 304} 305 306// RPC request for EncryptSecret. 307message EncryptSecretRequest { 308 // Required. The account linking client secret plaintext. 309 string client_secret = 1 [(google.api.field_behavior) = REQUIRED]; 310} 311 312// RPC response for EncryptSecret. 313message EncryptSecretResponse { 314 // Contains the encrypted account linking client secret and the key version 315 // used to encrypt the secret. 316 AccountLinkingSecret account_linking_secret = 1; 317} 318 319// RPC request for DecryptSecret. 320message DecryptSecretRequest { 321 // Required. The account linking client secret ciphertext. 322 bytes encrypted_client_secret = 1 [(google.api.field_behavior) = REQUIRED]; 323} 324 325// RPC response for DecryptSecret. 326message DecryptSecretResponse { 327 // The account linking client secret plaintext. 328 string client_secret = 1; 329} 330 331// RPC request for ListSampleProjects. 332message ListSampleProjectsRequest { 333 // Optional. The maximum number of sample projects to return. The service may return 334 // fewer than this value. 335 // If unspecified, at most 1000 sample projects will be returned. Values above 336 // 1000 will be coerced to 1000. 337 int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; 338 339 // Optional. A page token, received from a previous 'ListSampleProjects' call. 340 // Provide this to retrieve the subsequent page. 341 string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; 342} 343 344// RPC response for ListSampleProjects. 345message ListSampleProjectsResponse { 346 // The list of sample projects supported. 347 repeated SampleProject sample_projects = 1; 348 349 // A token, which can be sent as `page_token` to retrieve the next page. 350 // If this field is omitted, there are no subsequent pages. 351 string next_page_token = 2; 352} 353 354// Definition of sample project resource. 355message SampleProject { 356 option (google.api.resource) = { 357 type: "actions.googleapis.com/SampleProject" 358 pattern: "sampleProjects/{sample_project}" 359 }; 360 361 // The name of the sample project. 362 // Format: `sampleProjects/{sample_project}` 363 string name = 1; 364 365 // The URL to the zip file where the sample is hosted. 366 string hosted_url = 2; 367 368 // The description of the sample project. 369 string description = 3; 370} 371 372// RPC request for listing release channels 373message ListReleaseChannelsRequest { 374 // Required. The name of the resource in the format `projects/{project}`. The 375 // `{project}` is the cloud project ID associated with the project. 376 string parent = 1 [ 377 (google.api.field_behavior) = REQUIRED, 378 (google.api.resource_reference) = { 379 child_type: "actions.googleapis.com/ReleaseChannel" 380 } 381 ]; 382 383 // The maximum number of release channels to return. The service may return 384 // fewer than this value. If unspecified, at most 50 release channels will be 385 // returned. 386 int32 page_size = 2; 387 388 // A page token, received from a previous `ListReleaseChannels` call. 389 // Provide this to retrieve the subsequent page. 390 // When paginating, all other parameters provided to `ListReleaseChannels` 391 // must match the call that provided the page token. 392 string page_token = 3; 393} 394 395// RPC response for listing release channels 396message ListReleaseChannelsResponse { 397 // List of the release channels for the given project id. 398 repeated ReleaseChannel release_channels = 1; 399 400 // A token, which can be sent as `page_token` to retrieve the next page. 401 // If this field is omitted, there are no subsequent pages. 402 string next_page_token = 2; 403} 404 405// RPC request for listing versions 406message ListVersionsRequest { 407 // Required. The name of the resource in the format `projects/{project}`. The 408 // `{project}` is the cloud project ID associated with the project. 409 string parent = 1 [ 410 (google.api.field_behavior) = REQUIRED, 411 (google.api.resource_reference) = { 412 child_type: "actions.googleapis.com/Version" 413 } 414 ]; 415 416 // The maximum number of versions to return. The service may return 417 // fewer than this value. If unspecified, at most 50 versions will be 418 // returned. 419 int32 page_size = 2; 420 421 // A page token, received from a previous `ListVersions` call. 422 // Provide this to retrieve the subsequent page. 423 // When paginating, all other parameters provided to `ListVersions` 424 // must match the call that provided the page token. 425 string page_token = 3; 426} 427 428// RPC response for listing versions 429message ListVersionsResponse { 430 // List of the versions for the given project id. 431 repeated Version versions = 1; 432 433 // A token, which can be sent as `page_token` to retrieve the next page. 434 // If this field is omitted, there are no subsequent pages. 435 string next_page_token = 2; 436} 437