HTTP.pbobjc.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. GAPIHttp_FieldNumber_FullyDecodeReservedExpansion = 2,
  58. };
  59. /**
  60. * Defines the HTTP configuration for an API service. It contains a list of
  61. * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
  62. * to one or more HTTP REST API methods.
  63. **/
  64. @interface GAPIHttp : GPBMessage
  65. /**
  66. * A list of HTTP configuration rules that apply to individual API methods.
  67. *
  68. * **NOTE:** All service configuration rules follow "last one wins" order.
  69. **/
  70. @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GAPIHttpRule*> *rulesArray;
  71. /** The number of items in @c rulesArray without causing the array to be created. */
  72. @property(nonatomic, readonly) NSUInteger rulesArray_Count;
  73. /**
  74. * When set to true, URL path parmeters will be fully URI-decoded except in
  75. * cases of single segment matches in reserved expansion, where "%2F" will be
  76. * left encoded.
  77. *
  78. * The default behavior is to not decode RFC 6570 reserved characters in multi
  79. * segment matches.
  80. **/
  81. @property(nonatomic, readwrite) BOOL fullyDecodeReservedExpansion;
  82. @end
  83. #pragma mark - GAPIHttpRule
  84. typedef GPB_ENUM(GAPIHttpRule_FieldNumber) {
  85. GAPIHttpRule_FieldNumber_Selector = 1,
  86. GAPIHttpRule_FieldNumber_Get = 2,
  87. GAPIHttpRule_FieldNumber_Put = 3,
  88. GAPIHttpRule_FieldNumber_Post = 4,
  89. GAPIHttpRule_FieldNumber_Delete_p = 5,
  90. GAPIHttpRule_FieldNumber_Patch = 6,
  91. GAPIHttpRule_FieldNumber_Body = 7,
  92. GAPIHttpRule_FieldNumber_Custom = 8,
  93. GAPIHttpRule_FieldNumber_AdditionalBindingsArray = 11,
  94. };
  95. typedef GPB_ENUM(GAPIHttpRule_Pattern_OneOfCase) {
  96. GAPIHttpRule_Pattern_OneOfCase_GPBUnsetOneOfCase = 0,
  97. GAPIHttpRule_Pattern_OneOfCase_Get = 2,
  98. GAPIHttpRule_Pattern_OneOfCase_Put = 3,
  99. GAPIHttpRule_Pattern_OneOfCase_Post = 4,
  100. GAPIHttpRule_Pattern_OneOfCase_Delete_p = 5,
  101. GAPIHttpRule_Pattern_OneOfCase_Patch = 6,
  102. GAPIHttpRule_Pattern_OneOfCase_Custom = 8,
  103. };
  104. /**
  105. * `HttpRule` defines the mapping of an RPC method to one or more HTTP
  106. * REST API methods. The mapping specifies how different portions of the RPC
  107. * request message are mapped to URL path, URL query parameters, and
  108. * HTTP request body. The mapping is typically specified as an
  109. * `google.api.http` annotation on the RPC method,
  110. * see "google/api/annotations.proto" for details.
  111. *
  112. * The mapping consists of a field specifying the path template and
  113. * method kind. The path template can refer to fields in the request
  114. * message, as in the example below which describes a REST GET
  115. * operation on a resource collection of messages:
  116. *
  117. *
  118. * service Messaging {
  119. * rpc GetMessage(GetMessageRequest) returns (Message) {
  120. * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
  121. * }
  122. * }
  123. * message GetMessageRequest {
  124. * message SubMessage {
  125. * string subfield = 1;
  126. * }
  127. * string message_id = 1; // mapped to the URL
  128. * SubMessage sub = 2; // `sub.subfield` is url-mapped
  129. * }
  130. * message Message {
  131. * string text = 1; // content of the resource
  132. * }
  133. *
  134. * The same http annotation can alternatively be expressed inside the
  135. * `GRPC API Configuration` YAML file.
  136. *
  137. * http:
  138. * rules:
  139. * - selector: <proto_package_name>.Messaging.GetMessage
  140. * get: /v1/messages/{message_id}/{sub.subfield}
  141. *
  142. * This definition enables an automatic, bidrectional mapping of HTTP
  143. * JSON to RPC. Example:
  144. *
  145. * HTTP | RPC
  146. * -----|-----
  147. * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
  148. *
  149. * In general, not only fields but also field paths can be referenced
  150. * from a path pattern. Fields mapped to the path pattern cannot be
  151. * repeated and must have a primitive (non-message) type.
  152. *
  153. * Any fields in the request message which are not bound by the path
  154. * pattern automatically become (optional) HTTP query
  155. * parameters. Assume the following definition of the request message:
  156. *
  157. *
  158. * service Messaging {
  159. * rpc GetMessage(GetMessageRequest) returns (Message) {
  160. * option (google.api.http).get = "/v1/messages/{message_id}";
  161. * }
  162. * }
  163. * message GetMessageRequest {
  164. * message SubMessage {
  165. * string subfield = 1;
  166. * }
  167. * string message_id = 1; // mapped to the URL
  168. * int64 revision = 2; // becomes a parameter
  169. * SubMessage sub = 3; // `sub.subfield` becomes a parameter
  170. * }
  171. *
  172. *
  173. * This enables a HTTP JSON to RPC mapping as below:
  174. *
  175. * HTTP | RPC
  176. * -----|-----
  177. * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
  178. *
  179. * Note that fields which are mapped to HTTP parameters must have a
  180. * primitive type or a repeated primitive type. Message types are not
  181. * allowed. In the case of a repeated type, the parameter can be
  182. * repeated in the URL, as in `...?param=A&param=B`.
  183. *
  184. * For HTTP method kinds which allow a request body, the `body` field
  185. * specifies the mapping. Consider a REST update method on the
  186. * message resource collection:
  187. *
  188. *
  189. * service Messaging {
  190. * rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
  191. * option (google.api.http) = {
  192. * put: "/v1/messages/{message_id}"
  193. * body: "message"
  194. * };
  195. * }
  196. * }
  197. * message UpdateMessageRequest {
  198. * string message_id = 1; // mapped to the URL
  199. * Message message = 2; // mapped to the body
  200. * }
  201. *
  202. *
  203. * The following HTTP JSON to RPC mapping is enabled, where the
  204. * representation of the JSON in the request body is determined by
  205. * protos JSON encoding:
  206. *
  207. * HTTP | RPC
  208. * -----|-----
  209. * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
  210. *
  211. * The special name `*` can be used in the body mapping to define that
  212. * every field not bound by the path template should be mapped to the
  213. * request body. This enables the following alternative definition of
  214. * the update method:
  215. *
  216. * service Messaging {
  217. * rpc UpdateMessage(Message) returns (Message) {
  218. * option (google.api.http) = {
  219. * put: "/v1/messages/{message_id}"
  220. * body: "*"
  221. * };
  222. * }
  223. * }
  224. * message Message {
  225. * string message_id = 1;
  226. * string text = 2;
  227. * }
  228. *
  229. *
  230. * The following HTTP JSON to RPC mapping is enabled:
  231. *
  232. * HTTP | RPC
  233. * -----|-----
  234. * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
  235. *
  236. * Note that when using `*` in the body mapping, it is not possible to
  237. * have HTTP parameters, as all fields not bound by the path end in
  238. * the body. This makes this option more rarely used in practice of
  239. * defining REST APIs. The common usage of `*` is in custom methods
  240. * which don't use the URL at all for transferring data.
  241. *
  242. * It is possible to define multiple HTTP methods for one RPC by using
  243. * the `additional_bindings` option. Example:
  244. *
  245. * service Messaging {
  246. * rpc GetMessage(GetMessageRequest) returns (Message) {
  247. * option (google.api.http) = {
  248. * get: "/v1/messages/{message_id}"
  249. * additional_bindings {
  250. * get: "/v1/users/{user_id}/messages/{message_id}"
  251. * }
  252. * };
  253. * }
  254. * }
  255. * message GetMessageRequest {
  256. * string message_id = 1;
  257. * string user_id = 2;
  258. * }
  259. *
  260. *
  261. * This enables the following two alternative HTTP JSON to RPC
  262. * mappings:
  263. *
  264. * HTTP | RPC
  265. * -----|-----
  266. * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
  267. * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
  268. *
  269. * # Rules for HTTP mapping
  270. *
  271. * The rules for mapping HTTP path, query parameters, and body fields
  272. * to the request message are as follows:
  273. *
  274. * 1. The `body` field specifies either `*` or a field path, or is
  275. * omitted. If omitted, it indicates there is no HTTP request body.
  276. * 2. Leaf fields (recursive expansion of nested messages in the
  277. * request) can be classified into three types:
  278. * (a) Matched in the URL template.
  279. * (b) Covered by body (if body is `*`, everything except (a) fields;
  280. * else everything under the body field)
  281. * (c) All other fields.
  282. * 3. URL query parameters found in the HTTP request are mapped to (c) fields.
  283. * 4. Any body sent with an HTTP request can contain only (b) fields.
  284. *
  285. * The syntax of the path template is as follows:
  286. *
  287. * Template = "/" Segments [ Verb ] ;
  288. * Segments = Segment { "/" Segment } ;
  289. * Segment = "*" | "**" | LITERAL | Variable ;
  290. * Variable = "{" FieldPath [ "=" Segments ] "}" ;
  291. * FieldPath = IDENT { "." IDENT } ;
  292. * Verb = ":" LITERAL ;
  293. *
  294. * The syntax `*` matches a single path segment. The syntax `**` matches zero
  295. * or more path segments, which must be the last part of the path except the
  296. * `Verb`. The syntax `LITERAL` matches literal text in the path.
  297. *
  298. * The syntax `Variable` matches part of the URL path as specified by its
  299. * template. A variable template must not contain other variables. If a variable
  300. * matches a single path segment, its template may be omitted, e.g. `{var}`
  301. * is equivalent to `{var=*}`.
  302. *
  303. * If a variable contains exactly one path segment, such as `"{var}"` or
  304. * `"{var=*}"`, when such a variable is expanded into a URL path, all characters
  305. * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
  306. * Discovery Document as `{var}`.
  307. *
  308. * If a variable contains one or more path segments, such as `"{var=foo/\*}"`
  309. * or `"{var=**}"`, when such a variable is expanded into a URL path, all
  310. * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
  311. * show up in the Discovery Document as `{+var}`.
  312. *
  313. * NOTE: While the single segment variable matches the semantics of
  314. * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
  315. * Simple String Expansion, the multi segment variable **does not** match
  316. * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
  317. * does not expand special characters like `?` and `#`, which would lead
  318. * to invalid URLs.
  319. *
  320. * NOTE: the field paths in variables and in the `body` must not refer to
  321. * repeated fields or map fields.
  322. **/
  323. @interface GAPIHttpRule : GPBMessage
  324. /**
  325. * Selects methods to which this rule applies.
  326. *
  327. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
  328. **/
  329. @property(nonatomic, readwrite, copy, null_resettable) NSString *selector;
  330. /**
  331. * Determines the URL pattern is matched by this rules. This pattern can be
  332. * used with any of the {get|put|post|delete|patch} methods. A custom method
  333. * can be defined using the 'custom' field.
  334. **/
  335. @property(nonatomic, readonly) GAPIHttpRule_Pattern_OneOfCase patternOneOfCase;
  336. /** Used for listing and getting information about resources. */
  337. @property(nonatomic, readwrite, copy, null_resettable) NSString *get;
  338. /** Used for updating a resource. */
  339. @property(nonatomic, readwrite, copy, null_resettable) NSString *put;
  340. /** Used for creating a resource. */
  341. @property(nonatomic, readwrite, copy, null_resettable) NSString *post;
  342. /** Used for deleting a resource. */
  343. @property(nonatomic, readwrite, copy, null_resettable) NSString *delete_p;
  344. /** Used for updating a resource. */
  345. @property(nonatomic, readwrite, copy, null_resettable) NSString *patch;
  346. /**
  347. * The custom pattern is used for specifying an HTTP method that is not
  348. * included in the `pattern` field, such as HEAD, or "*" to leave the
  349. * HTTP method unspecified for this rule. The wild-card rule is useful
  350. * for services that provide content to Web (HTML) clients.
  351. **/
  352. @property(nonatomic, readwrite, strong, null_resettable) GAPICustomHttpPattern *custom;
  353. /**
  354. * The name of the request field whose value is mapped to the HTTP body, or
  355. * `*` for mapping all fields not captured by the path pattern to the HTTP
  356. * body. NOTE: the referred field must not be a repeated field and must be
  357. * present at the top-level of request message type.
  358. **/
  359. @property(nonatomic, readwrite, copy, null_resettable) NSString *body;
  360. /**
  361. * Additional HTTP bindings for the selector. Nested bindings must
  362. * not contain an `additional_bindings` field themselves (that is,
  363. * the nesting may only be one level deep).
  364. **/
  365. @property(nonatomic, readwrite, strong, null_resettable) NSMutableArray<GAPIHttpRule*> *additionalBindingsArray;
  366. /** The number of items in @c additionalBindingsArray without causing the array to be created. */
  367. @property(nonatomic, readonly) NSUInteger additionalBindingsArray_Count;
  368. @end
  369. /**
  370. * Clears whatever value was set for the oneof 'pattern'.
  371. **/
  372. void GAPIHttpRule_ClearPatternOneOfCase(GAPIHttpRule *message);
  373. #pragma mark - GAPICustomHttpPattern
  374. typedef GPB_ENUM(GAPICustomHttpPattern_FieldNumber) {
  375. GAPICustomHttpPattern_FieldNumber_Kind = 1,
  376. GAPICustomHttpPattern_FieldNumber_Path = 2,
  377. };
  378. /**
  379. * A custom pattern is used for defining custom HTTP verb.
  380. **/
  381. @interface GAPICustomHttpPattern : GPBMessage
  382. /** The name of this custom HTTP verb. */
  383. @property(nonatomic, readwrite, copy, null_resettable) NSString *kind;
  384. /** The path matched by this custom verb. */
  385. @property(nonatomic, readwrite, copy, null_resettable) NSString *path;
  386. @end
  387. NS_ASSUME_NONNULL_END
  388. CF_EXTERN_C_END
  389. #pragma clang diagnostic pop
  390. // @@protoc_insertion_point(global_scope)