1// Copyright 2023 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.ai.generativelanguage.v1beta; 18 19import "google/ai/generativelanguage/v1beta/file.proto"; 20import "google/api/annotations.proto"; 21import "google/api/client.proto"; 22import "google/api/field_behavior.proto"; 23import "google/api/resource.proto"; 24import "google/protobuf/empty.proto"; 25 26option go_package = "cloud.google.com/go/ai/generativelanguage/apiv1beta/generativelanguagepb;generativelanguagepb"; 27option java_multiple_files = true; 28option java_outer_classname = "FileServiceProto"; 29option java_package = "com.google.ai.generativelanguage.v1beta"; 30 31// An API for uploading and managing files. 32service FileService { 33 option (google.api.default_host) = "generativelanguage.googleapis.com"; 34 35 // Creates a `File`. 36 rpc CreateFile(CreateFileRequest) returns (CreateFileResponse) { 37 option (google.api.http) = { 38 post: "/v1beta/files" 39 body: "*" 40 }; 41 } 42 43 // Lists the metadata for `File`s owned by the requesting project. 44 rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) { 45 option (google.api.http) = { 46 get: "/v1beta/files" 47 }; 48 } 49 50 // Gets the metadata for the given `File`. 51 rpc GetFile(GetFileRequest) returns (File) { 52 option (google.api.http) = { 53 get: "/v1beta/{name=files/*}" 54 }; 55 option (google.api.method_signature) = "name"; 56 } 57 58 // Deletes the `File`. 59 rpc DeleteFile(DeleteFileRequest) returns (google.protobuf.Empty) { 60 option (google.api.http) = { 61 delete: "/v1beta/{name=files/*}" 62 }; 63 option (google.api.method_signature) = "name"; 64 } 65} 66 67// Request for `CreateFile`. 68message CreateFileRequest { 69 // Optional. Metadata for the file to create. 70 File file = 1 [(google.api.field_behavior) = OPTIONAL]; 71} 72 73// Response for `CreateFile`. 74message CreateFileResponse { 75 // Metadata for the created file. 76 File file = 1; 77} 78 79// Request for `ListFiles`. 80message ListFilesRequest { 81 // Optional. Maximum number of `File`s to return per page. 82 // If unspecified, defaults to 10. Maximum `page_size` is 100. 83 int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; 84 85 // Optional. A page token from a previous `ListFiles` call. 86 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 87} 88 89// Response for `ListFiles`. 90message ListFilesResponse { 91 // The list of `File`s. 92 repeated File files = 1; 93 94 // A token that can be sent as a `page_token` into a subsequent `ListFiles` 95 // call. 96 string next_page_token = 2; 97} 98 99// Request for `GetFile`. 100message GetFileRequest { 101 // Required. The name of the `File` to get. 102 // Example: `files/abc-123` 103 string name = 1 [ 104 (google.api.field_behavior) = REQUIRED, 105 (google.api.resource_reference) = { 106 type: "generativelanguage.googleapis.com/File" 107 } 108 ]; 109} 110 111// Request for `DeleteFile`. 112message DeleteFileRequest { 113 // Required. The name of the `File` to delete. 114 // Example: `files/abc-123` 115 string name = 1 [ 116 (google.api.field_behavior) = REQUIRED, 117 (google.api.resource_reference) = { 118 type: "generativelanguage.googleapis.com/File" 119 } 120 ]; 121} 122