github.com/yoogoc/kratos-scaffold@v0.0.0-20240402032722-a538b3c18955/project_generator/resources/httpbody.proto (about)

     1  // Copyright 2020 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  
    15  syntax = "proto3";
    16  
    17  package google.api;
    18  
    19  import "google/protobuf/any.proto";
    20  
    21  option cc_enable_arenas = true;
    22  option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
    23  option java_multiple_files = true;
    24  option java_outer_classname = "HttpBodyProto";
    25  option java_package = "com.google.api";
    26  option 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  //     service ResourceService {
    51  //       rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
    52  //       rpc UpdateResource(google.api.HttpBody) returns
    53  //       (google.protobuf.Empty);
    54  //     }
    55  //
    56  // Example with streaming methods:
    57  //
    58  //     service CaldavService {
    59  //       rpc GetCalendar(stream google.api.HttpBody)
    60  //         returns (stream google.api.HttpBody);
    61  //       rpc UpdateCalendar(stream google.api.HttpBody)
    62  //         returns (stream google.api.HttpBody);
    63  //     }
    64  //
    65  // Use of this type only changes how the request and response bodies are
    66  // handled, all other features will continue to work unchanged.
    67  message HttpBody {
    68    // The HTTP Content-Type header value specifying the content type of the body.
    69    string content_type = 1;
    70  
    71    // The HTTP request/response body as raw binary.
    72    bytes data = 2;
    73  
    74    // Application specific response metadata. Must be set in the first response
    75    // for streaming APIs.
    76    repeated google.protobuf.Any extensions = 3;
    77  }