2026-02-04 17:11:56 -08:00
|
|
|
// Copyright 2026 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.developers.knowledge.v1alpha;
|
|
|
|
|
|
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
import "google/api/client.proto";
|
|
|
|
|
import "google/api/field_behavior.proto";
|
|
|
|
|
import "google/api/resource.proto";
|
|
|
|
|
|
|
|
|
|
option go_package = "google.golang.org/genproto/googleapis/developers/knowledge/v1alpha;knowledge";
|
|
|
|
|
option java_multiple_files = true;
|
|
|
|
|
option java_outer_classname = "DeveloperKnowledgeProto";
|
|
|
|
|
option java_package = "com.google.developers.knowledge.v1alpha";
|
|
|
|
|
|
|
|
|
|
// The Developer Knowledge API provides programmatic access to Google's public
|
|
|
|
|
// developer documentation, enabling you to integrate this knowledge base into
|
|
|
|
|
// your own applications and workflows.
|
|
|
|
|
//
|
|
|
|
|
// The API is designed to be the canonical source for machine-readable access to
|
|
|
|
|
// Google's developer documentation.
|
|
|
|
|
//
|
|
|
|
|
// A typical use case is to first use
|
|
|
|
|
// [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1alpha.DeveloperKnowledge.SearchDocumentChunks]
|
|
|
|
|
// to find relevant page URIs based on a query, and then use
|
|
|
|
|
// [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1alpha.DeveloperKnowledge.GetDocument]
|
|
|
|
|
// or
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments]
|
|
|
|
|
// to fetch the full content of the top results.
|
|
|
|
|
//
|
|
|
|
|
// All document content is provided in Markdown format.
|
|
|
|
|
service DeveloperKnowledge {
|
|
|
|
|
option (google.api.default_host) = "developerknowledge.googleapis.com";
|
2026-03-24 10:30:04 -07:00
|
|
|
option (google.api.oauth_scopes) =
|
|
|
|
|
"https://www.googleapis.com/auth/cloud-platform";
|
2026-02-04 17:11:56 -08:00
|
|
|
|
|
|
|
|
// Searches for developer knowledge across Google's developer documentation.
|
2026-03-24 10:30:04 -07:00
|
|
|
// Returns [DocumentChunk][google.developers.knowledge.v1alpha.DocumentChunk]s
|
|
|
|
|
// based on the user's query. There may be many chunks from the same
|
|
|
|
|
// [Document][google.developers.knowledge.v1alpha.Document]. To retrieve full
|
|
|
|
|
// documents, use
|
2026-02-04 17:11:56 -08:00
|
|
|
// [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1alpha.DeveloperKnowledge.GetDocument]
|
|
|
|
|
// or
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments]
|
|
|
|
|
// with the
|
|
|
|
|
// [DocumentChunk.parent][google.developers.knowledge.v1alpha.DocumentChunk.parent]
|
|
|
|
|
// returned in the
|
|
|
|
|
// [SearchDocumentChunksResponse.results][google.developers.knowledge.v1alpha.SearchDocumentChunksResponse.results].
|
|
|
|
|
rpc SearchDocumentChunks(SearchDocumentChunksRequest)
|
|
|
|
|
returns (SearchDocumentChunksResponse) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/v1alpha/documents:searchDocumentChunks"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieves a single document with its full Markdown content.
|
|
|
|
|
rpc GetDocument(GetDocumentRequest) returns (Document) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/v1alpha/{name=documents/**}"
|
|
|
|
|
};
|
|
|
|
|
option (google.api.method_signature) = "name";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieves multiple documents, each with its full Markdown content.
|
|
|
|
|
rpc BatchGetDocuments(BatchGetDocumentsRequest)
|
|
|
|
|
returns (BatchGetDocumentsResponse) {
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/v1alpha/documents:batchGet"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Request message for
|
|
|
|
|
// [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1alpha.DeveloperKnowledge.SearchDocumentChunks].
|
|
|
|
|
message SearchDocumentChunksRequest {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Required. Provides the raw query string provided by the user, such as "How
|
|
|
|
|
// to create a Cloud Storage bucket?".
|
2026-02-04 17:11:56 -08:00
|
|
|
string query = 1 [(google.api.field_behavior) = REQUIRED];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Optional. Specifies the maximum number of results to return. The service
|
|
|
|
|
// may return fewer than this value.
|
2026-02-04 17:11:56 -08:00
|
|
|
//
|
|
|
|
|
// If unspecified, at most 5 results will be returned.
|
|
|
|
|
//
|
|
|
|
|
// The maximum value is 20; values above 20 will result in an INVALID_ARGUMENT
|
|
|
|
|
// error.
|
|
|
|
|
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Optional. Contains a page token, received from a previous
|
|
|
|
|
// `SearchDocumentChunks` call. Provide this to retrieve the subsequent page.
|
2026-02-04 17:11:56 -08:00
|
|
|
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Response message for
|
|
|
|
|
// [DeveloperKnowledge.SearchDocumentChunks][google.developers.knowledge.v1alpha.DeveloperKnowledge.SearchDocumentChunks].
|
|
|
|
|
message SearchDocumentChunksResponse {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Contains the search results for the given query. Each
|
2026-02-04 17:11:56 -08:00
|
|
|
// [DocumentChunk][google.developers.knowledge.v1alpha.DocumentChunk] in this
|
|
|
|
|
// list contains a snippet of content relevant to the search query. Use the
|
|
|
|
|
// [DocumentChunk.parent][google.developers.knowledge.v1alpha.DocumentChunk.parent]
|
|
|
|
|
// field of each result with
|
|
|
|
|
// [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1alpha.DeveloperKnowledge.GetDocument]
|
|
|
|
|
// or
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments]
|
|
|
|
|
// to retrieve the full document content.
|
|
|
|
|
repeated DocumentChunk results = 1;
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Optional. Provides a token that can be sent as `page_token` to retrieve the
|
|
|
|
|
// next page. If this field is omitted, there are no subsequent pages.
|
2026-02-04 17:11:56 -08:00
|
|
|
string next_page_token = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Request message for
|
|
|
|
|
// [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1alpha.DeveloperKnowledge.GetDocument].
|
|
|
|
|
message GetDocumentRequest {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Required. Specifies the name of the document to retrieve.
|
2026-02-04 17:11:56 -08:00
|
|
|
// Format: `documents/{uri_without_scheme}`
|
|
|
|
|
// Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
|
|
|
string name = 1 [
|
|
|
|
|
(google.api.field_behavior) = REQUIRED,
|
|
|
|
|
(google.api.resource_reference) = {
|
|
|
|
|
type: "developerknowledge.googleapis.com/Document"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Request message for
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments].
|
|
|
|
|
message BatchGetDocumentsRequest {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Required. Specifies the names of the documents to retrieve. A maximum of 20
|
|
|
|
|
// documents can be retrieved in a batch. The documents are returned in the
|
|
|
|
|
// same order as the `names` in the request.
|
2026-02-04 17:11:56 -08:00
|
|
|
//
|
|
|
|
|
// Format: `documents/{uri_without_scheme}`
|
|
|
|
|
// Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
|
|
|
repeated string names = 1 [
|
|
|
|
|
(google.api.field_behavior) = REQUIRED,
|
|
|
|
|
(google.api.resource_reference) = {
|
|
|
|
|
type: "developerknowledge.googleapis.com/Document"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Response message for
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments].
|
|
|
|
|
message BatchGetDocumentsResponse {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Contains the documents requested.
|
2026-02-04 17:11:56 -08:00
|
|
|
repeated Document documents = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A Document represents a piece of content from the Developer Knowledge corpus.
|
|
|
|
|
message Document {
|
|
|
|
|
option (google.api.resource) = {
|
|
|
|
|
type: "developerknowledge.googleapis.com/Document"
|
|
|
|
|
pattern: "documents/{document}"
|
|
|
|
|
plural: "documents"
|
|
|
|
|
singular: "document"
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Identifier. Contains the resource name of the document.
|
2026-02-04 17:11:56 -08:00
|
|
|
// Format: `documents/{uri_without_scheme}`
|
|
|
|
|
// Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
|
|
|
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Provides the URI of the content, such as
|
2026-02-04 17:11:56 -08:00
|
|
|
// `docs.cloud.google.com/storage/docs/creating-buckets`.
|
|
|
|
|
string uri = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Contains the full content of the document in Markdown format.
|
2026-02-04 17:11:56 -08:00
|
|
|
string content = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Provides a description of the document.
|
2026-02-04 17:11:56 -08:00
|
|
|
string description = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
2026-03-24 10:30:04 -07:00
|
|
|
|
|
|
|
|
// Output only. Provides the title of the document.
|
|
|
|
|
string title = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
|
2026-02-04 17:11:56 -08:00
|
|
|
}
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// A DocumentChunk represents a piece of content from a
|
|
|
|
|
// [Document][google.developers.knowledge.v1alpha.Document] in the
|
2026-02-04 17:11:56 -08:00
|
|
|
// DeveloperKnowledge corpus. To fetch the entire document content, pass the
|
|
|
|
|
// `parent` to
|
|
|
|
|
// [DeveloperKnowledge.GetDocument][google.developers.knowledge.v1alpha.DeveloperKnowledge.GetDocument]
|
|
|
|
|
// or
|
|
|
|
|
// [DeveloperKnowledge.BatchGetDocuments][google.developers.knowledge.v1alpha.DeveloperKnowledge.BatchGetDocuments].
|
|
|
|
|
message DocumentChunk {
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Contains the resource name of the document this chunk is from.
|
2026-02-04 17:11:56 -08:00
|
|
|
// Format: `documents/{uri_without_scheme}`
|
|
|
|
|
// Example: `documents/docs.cloud.google.com/storage/docs/creating-buckets`
|
|
|
|
|
string parent = 1 [
|
|
|
|
|
(google.api.field_behavior) = OUTPUT_ONLY,
|
|
|
|
|
(google.api.resource_reference) = {
|
|
|
|
|
type: "developerknowledge.googleapis.com/Document"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Specifies the ID of this chunk within the document. The chunk
|
|
|
|
|
// ID is unique within a document, but not globally unique across documents.
|
|
|
|
|
// The chunk ID is not stable and may change over time.
|
2026-02-04 17:11:56 -08:00
|
|
|
string id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
|
|
|
|
2026-03-24 10:30:04 -07:00
|
|
|
// Output only. Contains the content of the document chunk.
|
2026-02-04 17:11:56 -08:00
|
|
|
string content = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
|
|
|
}
|