// Copyright 2022 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.cloud.discoveryengine.v1beta;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/discoveryengine/v1beta/document.proto";
import "google/cloud/discoveryengine/v1beta/import_config.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
option go_package = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta;discoveryengine";
option java_multiple_files = true;
option java_outer_classname = "DocumentServiceProto";
option java_package = "com.google.cloud.discoveryengine.v1beta";
option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
// Service for ingesting
// [Document][google.cloud.discoveryengine.v1beta.Document] information of the
// customer's website.
service DocumentService {
option (google.api.default_host) = "discoveryengine.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";
// Gets a [Document][google.cloud.discoveryengine.v1beta.Document].
rpc GetDocument(GetDocumentRequest) returns (Document) {
option (google.api.http) = {
get: "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
};
option (google.api.method_signature) = "name";
}
// Gets a list of [Document][google.cloud.discoveryengine.v1beta.Document]s.
rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
option (google.api.http) = {
get: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents"
};
option (google.api.method_signature) = "parent";
}
// Creates a [Document][google.cloud.discoveryengine.v1beta.Document].
rpc CreateDocument(CreateDocumentRequest) returns (Document) {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents"
body: "document"
};
option (google.api.method_signature) = "parent,document,document_id";
}
// Updates a [Document][google.cloud.discoveryengine.v1beta.Document].
rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
option (google.api.http) = {
patch: "/v1beta/{document.name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
body: "document"
};
}
// Deletes a [Document][google.cloud.discoveryengine.v1beta.Document].
rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
};
option (google.api.method_signature) = "name";
}
// Bulk import of multiple
// [Document][google.cloud.discoveryengine.v1beta.Document]s. Request
// processing may be synchronous. Non-existing items will be created.
//
// Note: It is possible for a subset of the
// [Document][google.cloud.discoveryengine.v1beta.Document]s to be
// successfully updated.
rpc ImportDocuments(ImportDocumentsRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents:import"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "google.cloud.discoveryengine.v1beta.ImportDocumentsResponse"
metadata_type: "google.cloud.discoveryengine.v1beta.ImportDocumentsMetadata"
};
}
}
// Request message for
// [DocumentService.GetDocument][google.cloud.discoveryengine.v1beta.DocumentService.GetDocument]
// method.
message GetDocumentRequest {
// Required. Full resource name of
// [Document][google.cloud.discoveryengine.v1beta.Document], such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
//
// If the caller does not have permission to access the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
// whether or not it exists, a PERMISSION_DENIED error is returned.
//
// If the requested [Document][google.cloud.discoveryengine.v1beta.Document]
// does not exist, a NOT_FOUND error is returned.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Document"
}
];
}
// Request message for
// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
// method.
message ListDocumentsRequest {
// Required. The parent branch resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
// Use `default_branch` as the branch ID, to list documents under the default
// branch.
//
// If the caller does not have permission to list [Documents][]s under this
// branch, regardless of whether or not this branch exists, a
// PERMISSION_DENIED error is returned.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Branch"
}
];
// Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s
// to return. If unspecified, defaults to 100. The maximum allowed value is
// 1000. Values above 1000 will be coerced to 1000.
//
// If this field is negative, an INVALID_ARGUMENT error is returned.
int32 page_size = 2;
// A page token
// [ListDocumentsResponse.next_page_token][google.cloud.discoveryengine.v1beta.ListDocumentsResponse.next_page_token],
// received from a previous
// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
// call. Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to
// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
// must match the call that provided the page token. Otherwise, an
// INVALID_ARGUMENT error is returned.
string page_token = 3;
}
// Response message for
// [DocumentService.ListDocuments][google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments]
// method.
message ListDocumentsResponse {
// The [Document][google.cloud.discoveryengine.v1beta.Document]s.
repeated Document documents = 1;
// A token that can be sent as
// [ListDocumentsRequest.page_token][google.cloud.discoveryengine.v1beta.ListDocumentsRequest.page_token]
// to retrieve the next page. If this field is omitted, there are no
// subsequent pages.
string next_page_token = 2;
}
// Request message for
// [DocumentService.CreateDocument][google.cloud.discoveryengine.v1beta.DocumentService.CreateDocument]
// method.
message CreateDocumentRequest {
// Required. The parent resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Branch"
}
];
// Required. The [Document][google.cloud.discoveryengine.v1beta.Document] to
// create.
Document document = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The ID to use for the
// [Document][google.cloud.discoveryengine.v1beta.Document], which will become
// the final component of the
// [Document.name][google.cloud.discoveryengine.v1beta.Document.name].
//
// If the caller does not have permission to create the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
// whether or not it exists, a PERMISSION_DENIED error is returned.
//
// This field must be unique among all
// [Document][google.cloud.discoveryengine.v1beta.Document]s with the same
// [parent][google.cloud.discoveryengine.v1beta.CreateDocumentRequest.parent].
// Otherwise, an ALREADY_EXISTS error is returned.
//
// This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
// standard with a length limit of 63 characters. Otherwise, an
// INVALID_ARGUMENT error is returned.
string document_id = 3 [(google.api.field_behavior) = REQUIRED];
}
// Request message for
// [DocumentService.UpdateDocument][google.cloud.discoveryengine.v1beta.DocumentService.UpdateDocument]
// method.
message UpdateDocumentRequest {
// Required. The document to update/create.
//
// If the caller does not have permission to update the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
// whether or not it exists, a PERMISSION_DENIED error is returned.
//
// If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
// does not exist and
// [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
// is not set, a NOT_FOUND error is returned.
Document document = 1 [(google.api.field_behavior) = REQUIRED];
// If set to true, and the
// [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a
// new [Document][google.cloud.discoveryengine.v1beta.Document] will be
// created.
bool allow_missing = 2;
}
// Request message for
// [DocumentService.DeleteDocument][google.cloud.discoveryengine.v1beta.DocumentService.DeleteDocument]
// method.
message DeleteDocumentRequest {
// Required. Full resource name of
// [Document][google.cloud.discoveryengine.v1beta.Document], such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
//
// If the caller does not have permission to delete the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
// whether or not it exists, a PERMISSION_DENIED error is returned.
//
// If the [Document][google.cloud.discoveryengine.v1beta.Document] to delete
// does not exist, a NOT_FOUND error is returned.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Document"
}
];
}