xref: /aosp_15_r20/external/googleapis/google/chat/v1/attachment.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.chat.v1;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto";
21*d5c09012SAndroid Build Coastguard Worker
22*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Apps.Chat.V1";
23*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb";
24*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
25*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "AttachmentProto";
26*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.chat.v1";
27*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Apps\\Chat\\V1";
28*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Apps::Chat::V1";
29*d5c09012SAndroid Build Coastguard Worker
30*d5c09012SAndroid Build Coastguard Worker// An attachment in Google Chat.
31*d5c09012SAndroid Build Coastguard Workermessage Attachment {
32*d5c09012SAndroid Build Coastguard Worker  option (google.api.resource) = {
33*d5c09012SAndroid Build Coastguard Worker    type: "chat.googleapis.com/Attachment"
34*d5c09012SAndroid Build Coastguard Worker    pattern: "spaces/{space}/messages/{message}/attachments/{attachment}"
35*d5c09012SAndroid Build Coastguard Worker  };
36*d5c09012SAndroid Build Coastguard Worker
37*d5c09012SAndroid Build Coastguard Worker  // The source of the attachment.
38*d5c09012SAndroid Build Coastguard Worker  enum Source {
39*d5c09012SAndroid Build Coastguard Worker    // Reserved.
40*d5c09012SAndroid Build Coastguard Worker    SOURCE_UNSPECIFIED = 0;
41*d5c09012SAndroid Build Coastguard Worker
42*d5c09012SAndroid Build Coastguard Worker    // The file is a Google Drive file.
43*d5c09012SAndroid Build Coastguard Worker    DRIVE_FILE = 1;
44*d5c09012SAndroid Build Coastguard Worker
45*d5c09012SAndroid Build Coastguard Worker    // The file is uploaded to Chat.
46*d5c09012SAndroid Build Coastguard Worker    UPLOADED_CONTENT = 2;
47*d5c09012SAndroid Build Coastguard Worker  }
48*d5c09012SAndroid Build Coastguard Worker
49*d5c09012SAndroid Build Coastguard Worker  // Resource name of the attachment, in the form
50*d5c09012SAndroid Build Coastguard Worker  // `spaces/*/messages/*/attachments/*`.
51*d5c09012SAndroid Build Coastguard Worker  string name = 1;
52*d5c09012SAndroid Build Coastguard Worker
53*d5c09012SAndroid Build Coastguard Worker  // Output only. The original file name for the content, not the full path.
54*d5c09012SAndroid Build Coastguard Worker  string content_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
55*d5c09012SAndroid Build Coastguard Worker
56*d5c09012SAndroid Build Coastguard Worker  // Output only. The content type (MIME type) of the file.
57*d5c09012SAndroid Build Coastguard Worker  string content_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
58*d5c09012SAndroid Build Coastguard Worker
59*d5c09012SAndroid Build Coastguard Worker  // The data reference to the attachment.
60*d5c09012SAndroid Build Coastguard Worker  oneof data_ref {
61*d5c09012SAndroid Build Coastguard Worker    // A reference to the attachment data. This field is used with the media API
62*d5c09012SAndroid Build Coastguard Worker    // to download the attachment data.
63*d5c09012SAndroid Build Coastguard Worker    AttachmentDataRef attachment_data_ref = 4;
64*d5c09012SAndroid Build Coastguard Worker
65*d5c09012SAndroid Build Coastguard Worker    // Output only. A reference to the Google Drive attachment. This field is
66*d5c09012SAndroid Build Coastguard Worker    // used with the Google Drive API.
67*d5c09012SAndroid Build Coastguard Worker    DriveDataRef drive_data_ref = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
68*d5c09012SAndroid Build Coastguard Worker  }
69*d5c09012SAndroid Build Coastguard Worker
70*d5c09012SAndroid Build Coastguard Worker  // Output only. The thumbnail URL which should be used to preview the
71*d5c09012SAndroid Build Coastguard Worker  // attachment to a human user. Chat apps shouldn't use this URL to download
72*d5c09012SAndroid Build Coastguard Worker  // attachment content.
73*d5c09012SAndroid Build Coastguard Worker  string thumbnail_uri = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
74*d5c09012SAndroid Build Coastguard Worker
75*d5c09012SAndroid Build Coastguard Worker  // Output only. The download URL which should be used to allow a human user to
76*d5c09012SAndroid Build Coastguard Worker  // download the attachment. Chat apps shouldn't use this URL to download
77*d5c09012SAndroid Build Coastguard Worker  // attachment content.
78*d5c09012SAndroid Build Coastguard Worker  string download_uri = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
79*d5c09012SAndroid Build Coastguard Worker
80*d5c09012SAndroid Build Coastguard Worker  // Output only. The source of the attachment.
81*d5c09012SAndroid Build Coastguard Worker  Source source = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
82*d5c09012SAndroid Build Coastguard Worker}
83*d5c09012SAndroid Build Coastguard Worker
84*d5c09012SAndroid Build Coastguard Worker// A reference to the data of a drive attachment.
85*d5c09012SAndroid Build Coastguard Workermessage DriveDataRef {
86*d5c09012SAndroid Build Coastguard Worker  // The ID for the drive file. Use with the Drive API.
87*d5c09012SAndroid Build Coastguard Worker  string drive_file_id = 2;
88*d5c09012SAndroid Build Coastguard Worker}
89*d5c09012SAndroid Build Coastguard Worker
90*d5c09012SAndroid Build Coastguard Worker// A reference to the attachment data.
91*d5c09012SAndroid Build Coastguard Workermessage AttachmentDataRef {
92*d5c09012SAndroid Build Coastguard Worker  // The resource name of the attachment data. This field is used with the media
93*d5c09012SAndroid Build Coastguard Worker  // API to download the attachment data.
94*d5c09012SAndroid Build Coastguard Worker  string resource_name = 1;
95*d5c09012SAndroid Build Coastguard Worker
96*d5c09012SAndroid Build Coastguard Worker  // Opaque token containing a reference to an uploaded attachment. Treated by
97*d5c09012SAndroid Build Coastguard Worker  // clients as an opaque string and used to create or update Chat messages with
98*d5c09012SAndroid Build Coastguard Worker  // attachments.
99*d5c09012SAndroid Build Coastguard Worker  string attachment_upload_token = 2;
100*d5c09012SAndroid Build Coastguard Worker}
101*d5c09012SAndroid Build Coastguard Worker
102*d5c09012SAndroid Build Coastguard Worker// Request to get an attachment.
103*d5c09012SAndroid Build Coastguard Workermessage GetAttachmentRequest {
104*d5c09012SAndroid Build Coastguard Worker  // Required. Resource name of the attachment, in the form
105*d5c09012SAndroid Build Coastguard Worker  // `spaces/*/messages/*/attachments/*`.
106*d5c09012SAndroid Build Coastguard Worker  string name = 1 [
107*d5c09012SAndroid Build Coastguard Worker    (google.api.field_behavior) = REQUIRED,
108*d5c09012SAndroid Build Coastguard Worker    (google.api.resource_reference) = { type: "chat.googleapis.com/Attachment" }
109*d5c09012SAndroid Build Coastguard Worker  ];
110*d5c09012SAndroid Build Coastguard Worker}
111*d5c09012SAndroid Build Coastguard Worker
112*d5c09012SAndroid Build Coastguard Worker// Request to upload an attachment.
113*d5c09012SAndroid Build Coastguard Workermessage UploadAttachmentRequest {
114*d5c09012SAndroid Build Coastguard Worker  // Required. Resource name of the Chat space in which the attachment is
115*d5c09012SAndroid Build Coastguard Worker  // uploaded. Format "spaces/{space}".
116*d5c09012SAndroid Build Coastguard Worker  string parent = 1 [
117*d5c09012SAndroid Build Coastguard Worker    (google.api.field_behavior) = REQUIRED,
118*d5c09012SAndroid Build Coastguard Worker    (google.api.resource_reference) = {
119*d5c09012SAndroid Build Coastguard Worker      child_type: "chat.googleapis.com/Message"
120*d5c09012SAndroid Build Coastguard Worker    }
121*d5c09012SAndroid Build Coastguard Worker  ];
122*d5c09012SAndroid Build Coastguard Worker
123*d5c09012SAndroid Build Coastguard Worker  // Required. The filename of the attachment, including the file extension.
124*d5c09012SAndroid Build Coastguard Worker  string filename = 4 [(google.api.field_behavior) = REQUIRED];
125*d5c09012SAndroid Build Coastguard Worker}
126*d5c09012SAndroid Build Coastguard Worker
127*d5c09012SAndroid Build Coastguard Worker// Response of uploading an attachment.
128*d5c09012SAndroid Build Coastguard Workermessage UploadAttachmentResponse {
129*d5c09012SAndroid Build Coastguard Worker  // Reference to the uploaded attachment.
130*d5c09012SAndroid Build Coastguard Worker  AttachmentDataRef attachment_data_ref = 1;
131*d5c09012SAndroid Build Coastguard Worker}
132