xref: /aosp_15_r20/external/googleapis/google/api/httpbody.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.api;
18
19import "google/protobuf/any.proto";
20
21option cc_enable_arenas = true;
22option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
23option java_multiple_files = true;
24option java_outer_classname = "HttpBodyProto";
25option java_package = "com.google.api";
26option objc_class_prefix = "GAPI";
27
28// Message that represents an arbitrary HTTP body. It should only be used for
29// payload formats that can't be represented as JSON, such as raw binary or
30// an HTML page.
31//
32//
33// This message can be used both in streaming and non-streaming API methods in
34// the request as well as the response.
35//
36// It can be used as a top-level request field, which is convenient if one
37// wants to extract parameters from either the URL or HTTP template into the
38// request fields and also want access to the raw HTTP body.
39//
40// Example:
41//
42//     message GetResourceRequest {
43//       // A unique request id.
44//       string request_id = 1;
45//
46//       // The raw HTTP body is bound to this field.
47//       google.api.HttpBody http_body = 2;
48//
49//     }
50//
51//     service ResourceService {
52//       rpc GetResource(GetResourceRequest)
53//         returns (google.api.HttpBody);
54//       rpc UpdateResource(google.api.HttpBody)
55//         returns (google.protobuf.Empty);
56//
57//     }
58//
59// Example with streaming methods:
60//
61//     service CaldavService {
62//       rpc GetCalendar(stream google.api.HttpBody)
63//         returns (stream google.api.HttpBody);
64//       rpc UpdateCalendar(stream google.api.HttpBody)
65//         returns (stream google.api.HttpBody);
66//
67//     }
68//
69// Use of this type only changes how the request and response bodies are
70// handled, all other features will continue to work unchanged.
71message HttpBody {
72  // The HTTP Content-Type header value specifying the content type of the body.
73  string content_type = 1;
74
75  // The HTTP request/response body as raw binary.
76  bytes data = 2;
77
78  // Application specific response metadata. Must be set in the first response
79  // for streaming APIs.
80  repeated google.protobuf.Any extensions = 3;
81}
82