HTTP.pbobjc.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Generated by the protocol buffer compiler. DO NOT EDIT!
  17. // source: google/api/http.proto
  18. // This CPP symbol can be defined to use imports that match up to the framework
  19. // imports needed when using CocoaPods.
  20. #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
  21. #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
  22. #endif
  23. #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
  24. #import <Protobuf/GPBProtocolBuffers.h>
  25. #else
  26. #import "GPBProtocolBuffers.h"
  27. #endif
  28. #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
  29. #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
  30. #endif
  31. #if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
  32. #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
  33. #endif
  34. // @@protoc_insertion_point(imports)
  35. #pragma clang diagnostic push
  36. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  37. CF_EXTERN_C_BEGIN
  38. @class GAPICustomHttpPattern;
  39. @class GAPIHttpRule;
  40. NS_ASSUME_NONNULL_BEGIN
  41. #pragma mark - GAPIHTTPRoot
  42. /**
  43. * Exposes the extension registry for this file.
  44. *
  45. * The base class provides:
  46. * @code
  47. * + (GPBExtensionRegistry *)extensionRegistry;
  48. * @endcode
  49. * which is a @c GPBExtensionRegistry that includes all the extensions defined by
  50. * this file and all files that it depends on.
  51. **/
  52. @interface GAPIHTTPRoot : GPBRootObject
  53. @end
  54. #pragma mark - GAPIHttp
  55. typedef GPB_ENUM(GAPIHttp_FieldNumber) {
  56. GAPIHttp_FieldNumber_RulesArray = 1,
  57. };
  58. /**
  59. * Defines the HTTP configuration for a service. It contains a list of
  60. * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
  61. * to one or more HTTP REST API methods.
  62. **/
  63. @interface GAPIHttp : GPBMessage
  64. /**
  65. * A list of HTTP configuration rules that apply to individual API methods.
  66. *
  67. * **NOTE:** All service configuration rules follow "last one wins" order.
  68. **/
  69. @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GAPIHttpRule*> *rulesArray;
  70. /** The number of items in @c rulesArray without causing the array to be created. */
  71. @property(nonatomic, readonly) NSUInteger rulesArray_Count;
  72. @end
  73. #pragma mark - GAPIHttpRule
  74. typedef GPB_ENUM(GAPIHttpRule_FieldNumber) {
  75. GAPIHttpRule_FieldNumber_Selector = 1,
  76. GAPIHttpRule_FieldNumber_Get = 2,
  77. GAPIHttpRule_FieldNumber_Put = 3,
  78. GAPIHttpRule_FieldNumber_Post = 4,
  79. GAPIHttpRule_FieldNumber_Delete_p = 5,
  80. GAPIHttpRule_FieldNumber_Patch = 6,
  81. GAPIHttpRule_FieldNumber_Body = 7,
  82. GAPIHttpRule_FieldNumber_Custom = 8,
  83. GAPIHttpRule_FieldNumber_AdditionalBindingsArray = 11,
  84. };
  85. typedef GPB_ENUM(GAPIHttpRule_Pattern_OneOfCase) {
  86. GAPIHttpRule_Pattern_OneOfCase_GPBUnsetOneOfCase = 0,
  87. GAPIHttpRule_Pattern_OneOfCase_Get = 2,
  88. GAPIHttpRule_Pattern_OneOfCase_Put = 3,
  89. GAPIHttpRule_Pattern_OneOfCase_Post = 4,
  90. GAPIHttpRule_Pattern_OneOfCase_Delete_p = 5,
  91. GAPIHttpRule_Pattern_OneOfCase_Patch = 6,
  92. GAPIHttpRule_Pattern_OneOfCase_Custom = 8,
  93. };
  94. /**
  95. * `HttpRule` defines the mapping of an RPC method to one or more HTTP
  96. * REST APIs. The mapping determines what portions of the request
  97. * message are populated from the path, query parameters, or body of
  98. * the HTTP request. The mapping is typically specified as an
  99. * `google.api.http` annotation, see "google/api/annotations.proto"
  100. * for details.
  101. *
  102. * The mapping consists of a field specifying the path template and
  103. * method kind. The path template can refer to fields in the request
  104. * message, as in the example below which describes a REST GET
  105. * operation on a resource collection of messages:
  106. *
  107. *
  108. * service Messaging {
  109. * rpc GetMessage(GetMessageRequest) returns (Message) {
  110. * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
  111. * }
  112. * }
  113. * message GetMessageRequest {
  114. * message SubMessage {
  115. * string subfield = 1;
  116. * }
  117. * string message_id = 1; // mapped to the URL
  118. * SubMessage sub = 2; // `sub.subfield` is url-mapped
  119. * }
  120. * message Message {
  121. * string text = 1; // content of the resource
  122. * }
  123. *
  124. * The same http annotation can alternatively be expressed inside the
  125. * `GRPC API Configuration` YAML file.
  126. *
  127. * http:
  128. * rules:
  129. * - selector: <proto_package_name>.Messaging.GetMessage
  130. * get: /v1/messages/{message_id}/{sub.subfield}
  131. *
  132. * This definition enables an automatic, bidrectional mapping of HTTP
  133. * JSON to RPC. Example:
  134. *
  135. * HTTP | RPC
  136. * -----|-----
  137. * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
  138. *
  139. * In general, not only fields but also field paths can be referenced
  140. * from a path pattern. Fields mapped to the path pattern cannot be
  141. * repeated and must have a primitive (non-message) type.
  142. *
  143. * Any fields in the request message which are not bound by the path
  144. * pattern automatically become (optional) HTTP query
  145. * parameters. Assume the following definition of the request message:
  146. *
  147. *
  148. * message GetMessageRequest {
  149. * message SubMessage {
  150. * string subfield = 1;
  151. * }
  152. * string message_id = 1; // mapped to the URL
  153. * int64 revision = 2; // becomes a parameter
  154. * SubMessage sub = 3; // `sub.subfield` becomes a parameter
  155. * }
  156. *
  157. *
  158. * This enables a HTTP JSON to RPC mapping as below:
  159. *
  160. * HTTP | RPC
  161. * -----|-----
  162. * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
  163. *
  164. * Note that fields which are mapped to HTTP parameters must have a
  165. * primitive type or a repeated primitive type. Message types are not
  166. * allowed. In the case of a repeated type, the parameter can be
  167. * repeated in the URL, as in `...?param=A&param=B`.
  168. *
  169. * For HTTP method kinds which allow a request body, the `body` field
  170. * specifies the mapping. Consider a REST update method on the
  171. * message resource collection:
  172. *
  173. *
  174. * service Messaging {
  175. * rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
  176. * option (google.api.http) = {
  177. * put: "/v1/messages/{message_id}"
  178. * body: "message"
  179. * };
  180. * }
  181. * }
  182. * message UpdateMessageRequest {
  183. * string message_id = 1; // mapped to the URL
  184. * Message message = 2; // mapped to the body
  185. * }
  186. *
  187. *
  188. * The following HTTP JSON to RPC mapping is enabled, where the
  189. * representation of the JSON in the request body is determined by
  190. * protos JSON encoding:
  191. *
  192. * HTTP | RPC
  193. * -----|-----
  194. * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
  195. *
  196. * The special name `*` can be used in the body mapping to define that
  197. * every field not bound by the path template should be mapped to the
  198. * request body. This enables the following alternative definition of
  199. * the update method:
  200. *
  201. * service Messaging {
  202. * rpc UpdateMessage(Message) returns (Message) {
  203. * option (google.api.http) = {
  204. * put: "/v1/messages/{message_id}"
  205. * body: "*"
  206. * };
  207. * }
  208. * }
  209. * message Message {
  210. * string message_id = 1;
  211. * string text = 2;
  212. * }
  213. *
  214. *
  215. * The following HTTP JSON to RPC mapping is enabled:
  216. *
  217. * HTTP | RPC
  218. * -----|-----
  219. * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
  220. *
  221. * Note that when using `*` in the body mapping, it is not possible to
  222. * have HTTP parameters, as all fields not bound by the path end in
  223. * the body. This makes this option more rarely used in practice of
  224. * defining REST APIs. The common usage of `*` is in custom methods
  225. * which don't use the URL at all for transferring data.
  226. *
  227. * It is possible to define multiple HTTP methods for one RPC by using
  228. * the `additional_bindings` option. Example:
  229. *
  230. * service Messaging {
  231. * rpc GetMessage(GetMessageRequest) returns (Message) {
  232. * option (google.api.http) = {
  233. * get: "/v1/messages/{message_id}"
  234. * additional_bindings {
  235. * get: "/v1/users/{user_id}/messages/{message_id}"
  236. * }
  237. * };
  238. * }
  239. * }
  240. * message GetMessageRequest {
  241. * string message_id = 1;
  242. * string user_id = 2;
  243. * }
  244. *
  245. *
  246. * This enables the following two alternative HTTP JSON to RPC
  247. * mappings:
  248. *
  249. * HTTP | RPC
  250. * -----|-----
  251. * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
  252. * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
  253. *
  254. * # Rules for HTTP mapping
  255. *
  256. * The rules for mapping HTTP path, query parameters, and body fields
  257. * to the request message are as follows:
  258. *
  259. * 1. The `body` field specifies either `*` or a field path, or is
  260. * omitted. If omitted, it assumes there is no HTTP body.
  261. * 2. Leaf fields (recursive expansion of nested messages in the
  262. * request) can be classified into three types:
  263. * (a) Matched in the URL template.
  264. * (b) Covered by body (if body is `*`, everything except (a) fields;
  265. * else everything under the body field)
  266. * (c) All other fields.
  267. * 3. URL query parameters found in the HTTP request are mapped to (c) fields.
  268. * 4. Any body sent with an HTTP request can contain only (b) fields.
  269. *
  270. * The syntax of the path template is as follows:
  271. *
  272. * Template = "/" Segments [ Verb ] ;
  273. * Segments = Segment { "/" Segment } ;
  274. * Segment = "*" | "**" | LITERAL | Variable ;
  275. * Variable = "{" FieldPath [ "=" Segments ] "}" ;
  276. * FieldPath = IDENT { "." IDENT } ;
  277. * Verb = ":" LITERAL ;
  278. *
  279. * The syntax `*` matches a single path segment. It follows the semantics of
  280. * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
  281. * Expansion.
  282. *
  283. * The syntax `**` matches zero or more path segments. It follows the semantics
  284. * of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved
  285. * Expansion. NOTE: it must be the last segment in the path except the Verb.
  286. *
  287. * The syntax `LITERAL` matches literal text in the URL path.
  288. *
  289. * The syntax `Variable` matches the entire path as specified by its template;
  290. * this nested template must not contain further variables. If a variable
  291. * matches a single path segment, its template may be omitted, e.g. `{var}`
  292. * is equivalent to `{var=*}`.
  293. *
  294. * NOTE: the field paths in variables and in the `body` must not refer to
  295. * repeated fields or map fields.
  296. *
  297. * Use CustomHttpPattern to specify any HTTP method that is not included in the
  298. * `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for
  299. * a given URL path rule. The wild-card rule is useful for services that provide
  300. * content to Web (HTML) clients.
  301. **/
  302. @interface GAPIHttpRule : GPBMessage
  303. /**
  304. * Selects methods to which this rule applies.
  305. *
  306. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
  307. **/
  308. @property(nonatomic, readwrite, copy, null_resettable) NSString *selector;
  309. /**
  310. * Determines the URL pattern is matched by this rules. This pattern can be
  311. * used with any of the {get|put|post|delete|patch} methods. A custom method
  312. * can be defined using the 'custom' field.
  313. **/
  314. @property(nonatomic, readonly) GAPIHttpRule_Pattern_OneOfCase patternOneOfCase;
  315. /** Used for listing and getting information about resources. */
  316. @property(nonatomic, readwrite, copy, null_resettable) NSString *get;
  317. /** Used for updating a resource. */
  318. @property(nonatomic, readwrite, copy, null_resettable) NSString *put;
  319. /** Used for creating a resource. */
  320. @property(nonatomic, readwrite, copy, null_resettable) NSString *post;
  321. /** Used for deleting a resource. */
  322. @property(nonatomic, readwrite, copy, null_resettable) NSString *delete_p;
  323. /** Used for updating a resource. */
  324. @property(nonatomic, readwrite, copy, null_resettable) NSString *patch;
  325. /** Custom pattern is used for defining custom verbs. */
  326. @property(nonatomic, readwrite, strong, null_resettable) GAPICustomHttpPattern *custom;
  327. /**
  328. * The name of the request field whose value is mapped to the HTTP body, or
  329. * `*` for mapping all fields not captured by the path pattern to the HTTP
  330. * body. NOTE: the referred field must not be a repeated field and must be
  331. * present at the top-level of request message type.
  332. **/
  333. @property(nonatomic, readwrite, copy, null_resettable) NSString *body;
  334. /**
  335. * Additional HTTP bindings for the selector. Nested bindings must
  336. * not contain an `additional_bindings` field themselves (that is,
  337. * the nesting may only be one level deep).
  338. **/
  339. @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GAPIHttpRule*> *additionalBindingsArray;
  340. /** The number of items in @c additionalBindingsArray without causing the array to be created. */
  341. @property(nonatomic, readonly) NSUInteger additionalBindingsArray_Count;
  342. @end
  343. /**
  344. * Clears whatever value was set for the oneof 'pattern'.
  345. **/
  346. void GAPIHttpRule_ClearPatternOneOfCase(GAPIHttpRule *message);
  347. #pragma mark - GAPICustomHttpPattern
  348. typedef GPB_ENUM(GAPICustomHttpPattern_FieldNumber) {
  349. GAPICustomHttpPattern_FieldNumber_Kind = 1,
  350. GAPICustomHttpPattern_FieldNumber_Path = 2,
  351. };
  352. /**
  353. * A custom pattern is used for defining custom HTTP verb.
  354. **/
  355. @interface GAPICustomHttpPattern : GPBMessage
  356. /** The name of this custom HTTP verb. */
  357. @property(nonatomic, readwrite, copy, null_resettable) NSString *kind;
  358. /** The path matched by this custom verb. */
  359. @property(nonatomic, readwrite, copy, null_resettable) NSString *path;
  360. @end
  361. NS_ASSUME_NONNULL_END
  362. CF_EXTERN_C_END
  363. #pragma clang diagnostic pop
  364. // @@protoc_insertion_point(global_scope)