httpbody.proto 2.6 KB

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