httpbody.proto 2.6 KB

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