2
0

http.pb.swift 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: google/api/http.proto
  6. //
  7. // For information on using the generated types, please see the documentation:
  8. // https://github.com/apple/swift-protobuf/
  9. // Copyright 2015 Google LLC
  10. //
  11. // Licensed under the Apache License, Version 2.0 (the "License");
  12. // you may not use this file except in compliance with the License.
  13. // You may obtain a copy of the License at
  14. //
  15. // http://www.apache.org/licenses/LICENSE-2.0
  16. //
  17. // Unless required by applicable law or agreed to in writing, software
  18. // distributed under the License is distributed on an "AS IS" BASIS,
  19. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. // See the License for the specific language governing permissions and
  21. // limitations under the License.
  22. import Foundation
  23. import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. /// Defines the HTTP configuration for an API service. It contains a list of
  34. /// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
  35. /// to one or more HTTP REST API methods.
  36. struct Google_Api_Http {
  37. // SwiftProtobuf.Message conformance is added in an extension below. See the
  38. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  39. // methods supported on all messages.
  40. /// A list of HTTP configuration rules that apply to individual API methods.
  41. ///
  42. /// **NOTE:** All service configuration rules follow "last one wins" order.
  43. var rules: [Google_Api_HttpRule] = []
  44. /// When set to true, URL path parameters will be fully URI-decoded except in
  45. /// cases of single segment matches in reserved expansion, where "%2F" will be
  46. /// left encoded.
  47. ///
  48. /// The default behavior is to not decode RFC 6570 reserved characters in multi
  49. /// segment matches.
  50. var fullyDecodeReservedExpansion: Bool = false
  51. var unknownFields = SwiftProtobuf.UnknownStorage()
  52. init() {}
  53. }
  54. /// # gRPC Transcoding
  55. ///
  56. /// gRPC Transcoding is a feature for mapping between a gRPC method and one or
  57. /// more HTTP REST endpoints. It allows developers to build a single API service
  58. /// that supports both gRPC APIs and REST APIs. Many systems, including [Google
  59. /// APIs](https://github.com/googleapis/googleapis),
  60. /// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
  61. /// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
  62. /// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
  63. /// and use it for large scale production services.
  64. ///
  65. /// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
  66. /// how different portions of the gRPC request message are mapped to the URL
  67. /// path, URL query parameters, and HTTP request body. It also controls how the
  68. /// gRPC response message is mapped to the HTTP response body. `HttpRule` is
  69. /// typically specified as an `google.api.http` annotation on the gRPC method.
  70. ///
  71. /// Each mapping specifies a URL path template and an HTTP method. The path
  72. /// template may refer to one or more fields in the gRPC request message, as long
  73. /// as each field is a non-repeated field with a primitive (non-message) type.
  74. /// The path template controls how fields of the request message are mapped to
  75. /// the URL path.
  76. ///
  77. /// Example:
  78. ///
  79. /// service Messaging {
  80. /// rpc GetMessage(GetMessageRequest) returns (Message) {
  81. /// option (google.api.http) = {
  82. /// get: "/v1/{name=messages/*}"
  83. /// };
  84. /// }
  85. /// }
  86. /// message GetMessageRequest {
  87. /// string name = 1; // Mapped to URL path.
  88. /// }
  89. /// message Message {
  90. /// string text = 1; // The resource content.
  91. /// }
  92. ///
  93. /// This enables an HTTP REST to gRPC mapping as below:
  94. ///
  95. /// HTTP | gRPC
  96. /// -----|-----
  97. /// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
  98. ///
  99. /// Any fields in the request message which are not bound by the path template
  100. /// automatically become HTTP query parameters if there is no HTTP request body.
  101. /// For example:
  102. ///
  103. /// service Messaging {
  104. /// rpc GetMessage(GetMessageRequest) returns (Message) {
  105. /// option (google.api.http) = {
  106. /// get:"/v1/messages/{message_id}"
  107. /// };
  108. /// }
  109. /// }
  110. /// message GetMessageRequest {
  111. /// message SubMessage {
  112. /// string subfield = 1;
  113. /// }
  114. /// string message_id = 1; // Mapped to URL path.
  115. /// int64 revision = 2; // Mapped to URL query parameter `revision`.
  116. /// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
  117. /// }
  118. ///
  119. /// This enables a HTTP JSON to RPC mapping as below:
  120. ///
  121. /// HTTP | gRPC
  122. /// -----|-----
  123. /// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
  124. /// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
  125. /// "foo"))`
  126. ///
  127. /// Note that fields which are mapped to URL query parameters must have a
  128. /// primitive type or a repeated primitive type or a non-repeated message type.
  129. /// In the case of a repeated type, the parameter can be repeated in the URL
  130. /// as `...?param=A&param=B`. In the case of a message type, each field of the
  131. /// message is mapped to a separate parameter, such as
  132. /// `...?foo.a=A&foo.b=B&foo.c=C`.
  133. ///
  134. /// For HTTP methods that allow a request body, the `body` field
  135. /// specifies the mapping. Consider a REST update method on the
  136. /// message resource collection:
  137. ///
  138. /// service Messaging {
  139. /// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
  140. /// option (google.api.http) = {
  141. /// patch: "/v1/messages/{message_id}"
  142. /// body: "message"
  143. /// };
  144. /// }
  145. /// }
  146. /// message UpdateMessageRequest {
  147. /// string message_id = 1; // mapped to the URL
  148. /// Message message = 2; // mapped to the body
  149. /// }
  150. ///
  151. /// The following HTTP JSON to RPC mapping is enabled, where the
  152. /// representation of the JSON in the request body is determined by
  153. /// protos JSON encoding:
  154. ///
  155. /// HTTP | gRPC
  156. /// -----|-----
  157. /// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
  158. /// "123456" message { text: "Hi!" })`
  159. ///
  160. /// The special name `*` can be used in the body mapping to define that
  161. /// every field not bound by the path template should be mapped to the
  162. /// request body. This enables the following alternative definition of
  163. /// the update method:
  164. ///
  165. /// service Messaging {
  166. /// rpc UpdateMessage(Message) returns (Message) {
  167. /// option (google.api.http) = {
  168. /// patch: "/v1/messages/{message_id}"
  169. /// body: "*"
  170. /// };
  171. /// }
  172. /// }
  173. /// message Message {
  174. /// string message_id = 1;
  175. /// string text = 2;
  176. /// }
  177. ///
  178. ///
  179. /// The following HTTP JSON to RPC mapping is enabled:
  180. ///
  181. /// HTTP | gRPC
  182. /// -----|-----
  183. /// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
  184. /// "123456" text: "Hi!")`
  185. ///
  186. /// Note that when using `*` in the body mapping, it is not possible to
  187. /// have HTTP parameters, as all fields not bound by the path end in
  188. /// the body. This makes this option more rarely used in practice when
  189. /// defining REST APIs. The common usage of `*` is in custom methods
  190. /// which don't use the URL at all for transferring data.
  191. ///
  192. /// It is possible to define multiple HTTP methods for one RPC by using
  193. /// the `additional_bindings` option. Example:
  194. ///
  195. /// service Messaging {
  196. /// rpc GetMessage(GetMessageRequest) returns (Message) {
  197. /// option (google.api.http) = {
  198. /// get: "/v1/messages/{message_id}"
  199. /// additional_bindings {
  200. /// get: "/v1/users/{user_id}/messages/{message_id}"
  201. /// }
  202. /// };
  203. /// }
  204. /// }
  205. /// message GetMessageRequest {
  206. /// string message_id = 1;
  207. /// string user_id = 2;
  208. /// }
  209. ///
  210. /// This enables the following two alternative HTTP JSON to RPC mappings:
  211. ///
  212. /// HTTP | gRPC
  213. /// -----|-----
  214. /// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
  215. /// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
  216. /// "123456")`
  217. ///
  218. /// ## Rules for HTTP mapping
  219. ///
  220. /// 1. Leaf request fields (recursive expansion nested messages in the request
  221. /// message) are classified into three categories:
  222. /// - Fields referred by the path template. They are passed via the URL path.
  223. /// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
  224. /// request body.
  225. /// - All other fields are passed via the URL query parameters, and the
  226. /// parameter name is the field path in the request message. A repeated
  227. /// field can be represented as multiple query parameters under the same
  228. /// name.
  229. /// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
  230. /// are passed via URL path and HTTP request body.
  231. /// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
  232. /// fields are passed via URL path and URL query parameters.
  233. ///
  234. /// ### Path template syntax
  235. ///
  236. /// Template = "/" Segments [ Verb ] ;
  237. /// Segments = Segment { "/" Segment } ;
  238. /// Segment = "*" | "**" | LITERAL | Variable ;
  239. /// Variable = "{" FieldPath [ "=" Segments ] "}" ;
  240. /// FieldPath = IDENT { "." IDENT } ;
  241. /// Verb = ":" LITERAL ;
  242. ///
  243. /// The syntax `*` matches a single URL path segment. The syntax `**` matches
  244. /// zero or more URL path segments, which must be the last part of the URL path
  245. /// except the `Verb`.
  246. ///
  247. /// The syntax `Variable` matches part of the URL path as specified by its
  248. /// template. A variable template must not contain other variables. If a variable
  249. /// matches a single path segment, its template may be omitted, e.g. `{var}`
  250. /// is equivalent to `{var=*}`.
  251. ///
  252. /// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
  253. /// contains any reserved character, such characters should be percent-encoded
  254. /// before the matching.
  255. ///
  256. /// If a variable contains exactly one path segment, such as `"{var}"` or
  257. /// `"{var=*}"`, when such a variable is expanded into a URL path on the client
  258. /// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
  259. /// server side does the reverse decoding. Such variables show up in the
  260. /// [Discovery
  261. /// Document](https://developers.google.com/discovery/v1/reference/apis) as
  262. /// `{var}`.
  263. ///
  264. /// If a variable contains multiple path segments, such as `"{var=foo/*}"`
  265. /// or `"{var=**}"`, when such a variable is expanded into a URL path on the
  266. /// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
  267. /// The server side does the reverse decoding, except "%2F" and "%2f" are left
  268. /// unchanged. Such variables show up in the
  269. /// [Discovery
  270. /// Document](https://developers.google.com/discovery/v1/reference/apis) as
  271. /// `{+var}`.
  272. ///
  273. /// ## Using gRPC API Service Configuration
  274. ///
  275. /// gRPC API Service Configuration (service config) is a configuration language
  276. /// for configuring a gRPC service to become a user-facing product. The
  277. /// service config is simply the YAML representation of the `google.api.Service`
  278. /// proto message.
  279. ///
  280. /// As an alternative to annotating your proto file, you can configure gRPC
  281. /// transcoding in your service config YAML files. You do this by specifying a
  282. /// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
  283. /// effect as the proto annotation. This can be particularly useful if you
  284. /// have a proto that is reused in multiple services. Note that any transcoding
  285. /// specified in the service config will override any matching transcoding
  286. /// configuration in the proto.
  287. ///
  288. /// Example:
  289. ///
  290. /// http:
  291. /// rules:
  292. /// # Selects a gRPC method and applies HttpRule to it.
  293. /// - selector: example.v1.Messaging.GetMessage
  294. /// get: /v1/messages/{message_id}/{sub.subfield}
  295. ///
  296. /// ## Special notes
  297. ///
  298. /// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
  299. /// proto to JSON conversion must follow the [proto3
  300. /// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
  301. ///
  302. /// While the single segment variable follows the semantics of
  303. /// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
  304. /// Expansion, the multi segment variable **does not** follow RFC 6570 Section
  305. /// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
  306. /// does not expand special characters like `?` and `#`, which would lead
  307. /// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
  308. /// for multi segment variables.
  309. ///
  310. /// The path variables **must not** refer to any repeated or mapped field,
  311. /// because client libraries are not capable of handling such variable expansion.
  312. ///
  313. /// The path variables **must not** capture the leading "/" character. The reason
  314. /// is that the most common use case "{var}" does not capture the leading "/"
  315. /// character. For consistency, all path variables must share the same behavior.
  316. ///
  317. /// Repeated message fields must not be mapped to URL query parameters, because
  318. /// no client library can support such complicated mapping.
  319. ///
  320. /// If an API needs to use a JSON array for request or response body, it can map
  321. /// the request or response body to a repeated field. However, some gRPC
  322. /// Transcoding implementations may not support this feature.
  323. struct Google_Api_HttpRule {
  324. // SwiftProtobuf.Message conformance is added in an extension below. See the
  325. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  326. // methods supported on all messages.
  327. /// Selects a method to which this rule applies.
  328. ///
  329. /// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
  330. var selector: String = String()
  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. var pattern: Google_Api_HttpRule.OneOf_Pattern? = nil
  335. /// Maps to HTTP GET. Used for listing and getting information about
  336. /// resources.
  337. var get: String {
  338. get {
  339. if case .get(let v)? = pattern {return v}
  340. return String()
  341. }
  342. set {pattern = .get(newValue)}
  343. }
  344. /// Maps to HTTP PUT. Used for replacing a resource.
  345. var put: String {
  346. get {
  347. if case .put(let v)? = pattern {return v}
  348. return String()
  349. }
  350. set {pattern = .put(newValue)}
  351. }
  352. /// Maps to HTTP POST. Used for creating a resource or performing an action.
  353. var post: String {
  354. get {
  355. if case .post(let v)? = pattern {return v}
  356. return String()
  357. }
  358. set {pattern = .post(newValue)}
  359. }
  360. /// Maps to HTTP DELETE. Used for deleting a resource.
  361. var delete: String {
  362. get {
  363. if case .delete(let v)? = pattern {return v}
  364. return String()
  365. }
  366. set {pattern = .delete(newValue)}
  367. }
  368. /// Maps to HTTP PATCH. Used for updating a resource.
  369. var patch: String {
  370. get {
  371. if case .patch(let v)? = pattern {return v}
  372. return String()
  373. }
  374. set {pattern = .patch(newValue)}
  375. }
  376. /// The custom pattern is used for specifying an HTTP method that is not
  377. /// included in the `pattern` field, such as HEAD, or "*" to leave the
  378. /// HTTP method unspecified for this rule. The wild-card rule is useful
  379. /// for services that provide content to Web (HTML) clients.
  380. var custom: Google_Api_CustomHttpPattern {
  381. get {
  382. if case .custom(let v)? = pattern {return v}
  383. return Google_Api_CustomHttpPattern()
  384. }
  385. set {pattern = .custom(newValue)}
  386. }
  387. /// The name of the request field whose value is mapped to the HTTP request
  388. /// body, or `*` for mapping all request fields not captured by the path
  389. /// pattern to the HTTP body, or omitted for not having any HTTP request body.
  390. ///
  391. /// NOTE: the referred field must be present at the top-level of the request
  392. /// message type.
  393. var body: String = String()
  394. /// Optional. The name of the response field whose value is mapped to the HTTP
  395. /// response body. When omitted, the entire response message will be used
  396. /// as the HTTP response body.
  397. ///
  398. /// NOTE: The referred field must be present at the top-level of the response
  399. /// message type.
  400. var responseBody: String = String()
  401. /// Additional HTTP bindings for the selector. Nested bindings must
  402. /// not contain an `additional_bindings` field themselves (that is,
  403. /// the nesting may only be one level deep).
  404. var additionalBindings: [Google_Api_HttpRule] = []
  405. var unknownFields = SwiftProtobuf.UnknownStorage()
  406. /// Determines the URL pattern is matched by this rules. This pattern can be
  407. /// used with any of the {get|put|post|delete|patch} methods. A custom method
  408. /// can be defined using the 'custom' field.
  409. enum OneOf_Pattern: Equatable {
  410. /// Maps to HTTP GET. Used for listing and getting information about
  411. /// resources.
  412. case get(String)
  413. /// Maps to HTTP PUT. Used for replacing a resource.
  414. case put(String)
  415. /// Maps to HTTP POST. Used for creating a resource or performing an action.
  416. case post(String)
  417. /// Maps to HTTP DELETE. Used for deleting a resource.
  418. case delete(String)
  419. /// Maps to HTTP PATCH. Used for updating a resource.
  420. case patch(String)
  421. /// The custom pattern is used for specifying an HTTP method that is not
  422. /// included in the `pattern` field, such as HEAD, or "*" to leave the
  423. /// HTTP method unspecified for this rule. The wild-card rule is useful
  424. /// for services that provide content to Web (HTML) clients.
  425. case custom(Google_Api_CustomHttpPattern)
  426. #if !swift(>=4.1)
  427. static func ==(lhs: Google_Api_HttpRule.OneOf_Pattern, rhs: Google_Api_HttpRule.OneOf_Pattern) -> Bool {
  428. // The use of inline closures is to circumvent an issue where the compiler
  429. // allocates stack space for every case branch when no optimizations are
  430. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  431. switch (lhs, rhs) {
  432. case (.get, .get): return {
  433. guard case .get(let l) = lhs, case .get(let r) = rhs else { preconditionFailure() }
  434. return l == r
  435. }()
  436. case (.put, .put): return {
  437. guard case .put(let l) = lhs, case .put(let r) = rhs else { preconditionFailure() }
  438. return l == r
  439. }()
  440. case (.post, .post): return {
  441. guard case .post(let l) = lhs, case .post(let r) = rhs else { preconditionFailure() }
  442. return l == r
  443. }()
  444. case (.delete, .delete): return {
  445. guard case .delete(let l) = lhs, case .delete(let r) = rhs else { preconditionFailure() }
  446. return l == r
  447. }()
  448. case (.patch, .patch): return {
  449. guard case .patch(let l) = lhs, case .patch(let r) = rhs else { preconditionFailure() }
  450. return l == r
  451. }()
  452. case (.custom, .custom): return {
  453. guard case .custom(let l) = lhs, case .custom(let r) = rhs else { preconditionFailure() }
  454. return l == r
  455. }()
  456. default: return false
  457. }
  458. }
  459. #endif
  460. }
  461. init() {}
  462. }
  463. /// A custom pattern is used for defining custom HTTP verb.
  464. struct Google_Api_CustomHttpPattern {
  465. // SwiftProtobuf.Message conformance is added in an extension below. See the
  466. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  467. // methods supported on all messages.
  468. /// The name of this custom HTTP verb.
  469. var kind: String = String()
  470. /// The path matched by this custom verb.
  471. var path: String = String()
  472. var unknownFields = SwiftProtobuf.UnknownStorage()
  473. init() {}
  474. }
  475. #if swift(>=5.5) && canImport(_Concurrency)
  476. extension Google_Api_Http: @unchecked Sendable {}
  477. extension Google_Api_HttpRule: @unchecked Sendable {}
  478. extension Google_Api_HttpRule.OneOf_Pattern: @unchecked Sendable {}
  479. extension Google_Api_CustomHttpPattern: @unchecked Sendable {}
  480. #endif // swift(>=5.5) && canImport(_Concurrency)
  481. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  482. fileprivate let _protobuf_package = "google.api"
  483. extension Google_Api_Http: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  484. static let protoMessageName: String = _protobuf_package + ".Http"
  485. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  486. 1: .same(proto: "rules"),
  487. 2: .standard(proto: "fully_decode_reserved_expansion"),
  488. ]
  489. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  490. while let fieldNumber = try decoder.nextFieldNumber() {
  491. // The use of inline closures is to circumvent an issue where the compiler
  492. // allocates stack space for every case branch when no optimizations are
  493. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  494. switch fieldNumber {
  495. case 1: try { try decoder.decodeRepeatedMessageField(value: &self.rules) }()
  496. case 2: try { try decoder.decodeSingularBoolField(value: &self.fullyDecodeReservedExpansion) }()
  497. default: break
  498. }
  499. }
  500. }
  501. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  502. if !self.rules.isEmpty {
  503. try visitor.visitRepeatedMessageField(value: self.rules, fieldNumber: 1)
  504. }
  505. if self.fullyDecodeReservedExpansion != false {
  506. try visitor.visitSingularBoolField(value: self.fullyDecodeReservedExpansion, fieldNumber: 2)
  507. }
  508. try unknownFields.traverse(visitor: &visitor)
  509. }
  510. static func ==(lhs: Google_Api_Http, rhs: Google_Api_Http) -> Bool {
  511. if lhs.rules != rhs.rules {return false}
  512. if lhs.fullyDecodeReservedExpansion != rhs.fullyDecodeReservedExpansion {return false}
  513. if lhs.unknownFields != rhs.unknownFields {return false}
  514. return true
  515. }
  516. }
  517. extension Google_Api_HttpRule: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  518. static let protoMessageName: String = _protobuf_package + ".HttpRule"
  519. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  520. 1: .same(proto: "selector"),
  521. 2: .same(proto: "get"),
  522. 3: .same(proto: "put"),
  523. 4: .same(proto: "post"),
  524. 5: .same(proto: "delete"),
  525. 6: .same(proto: "patch"),
  526. 8: .same(proto: "custom"),
  527. 7: .same(proto: "body"),
  528. 12: .standard(proto: "response_body"),
  529. 11: .standard(proto: "additional_bindings"),
  530. ]
  531. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  532. while let fieldNumber = try decoder.nextFieldNumber() {
  533. // The use of inline closures is to circumvent an issue where the compiler
  534. // allocates stack space for every case branch when no optimizations are
  535. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  536. switch fieldNumber {
  537. case 1: try { try decoder.decodeSingularStringField(value: &self.selector) }()
  538. case 2: try {
  539. var v: String?
  540. try decoder.decodeSingularStringField(value: &v)
  541. if let v = v {
  542. if self.pattern != nil {try decoder.handleConflictingOneOf()}
  543. self.pattern = .get(v)
  544. }
  545. }()
  546. case 3: try {
  547. var v: String?
  548. try decoder.decodeSingularStringField(value: &v)
  549. if let v = v {
  550. if self.pattern != nil {try decoder.handleConflictingOneOf()}
  551. self.pattern = .put(v)
  552. }
  553. }()
  554. case 4: try {
  555. var v: String?
  556. try decoder.decodeSingularStringField(value: &v)
  557. if let v = v {
  558. if self.pattern != nil {try decoder.handleConflictingOneOf()}
  559. self.pattern = .post(v)
  560. }
  561. }()
  562. case 5: try {
  563. var v: String?
  564. try decoder.decodeSingularStringField(value: &v)
  565. if let v = v {
  566. if self.pattern != nil {try decoder.handleConflictingOneOf()}
  567. self.pattern = .delete(v)
  568. }
  569. }()
  570. case 6: try {
  571. var v: String?
  572. try decoder.decodeSingularStringField(value: &v)
  573. if let v = v {
  574. if self.pattern != nil {try decoder.handleConflictingOneOf()}
  575. self.pattern = .patch(v)
  576. }
  577. }()
  578. case 7: try { try decoder.decodeSingularStringField(value: &self.body) }()
  579. case 8: try {
  580. var v: Google_Api_CustomHttpPattern?
  581. var hadOneofValue = false
  582. if let current = self.pattern {
  583. hadOneofValue = true
  584. if case .custom(let m) = current {v = m}
  585. }
  586. try decoder.decodeSingularMessageField(value: &v)
  587. if let v = v {
  588. if hadOneofValue {try decoder.handleConflictingOneOf()}
  589. self.pattern = .custom(v)
  590. }
  591. }()
  592. case 11: try { try decoder.decodeRepeatedMessageField(value: &self.additionalBindings) }()
  593. case 12: try { try decoder.decodeSingularStringField(value: &self.responseBody) }()
  594. default: break
  595. }
  596. }
  597. }
  598. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  599. // The use of inline closures is to circumvent an issue where the compiler
  600. // allocates stack space for every if/case branch local when no optimizations
  601. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  602. // https://github.com/apple/swift-protobuf/issues/1182
  603. if !self.selector.isEmpty {
  604. try visitor.visitSingularStringField(value: self.selector, fieldNumber: 1)
  605. }
  606. switch self.pattern {
  607. case .get?: try {
  608. guard case .get(let v)? = self.pattern else { preconditionFailure() }
  609. try visitor.visitSingularStringField(value: v, fieldNumber: 2)
  610. }()
  611. case .put?: try {
  612. guard case .put(let v)? = self.pattern else { preconditionFailure() }
  613. try visitor.visitSingularStringField(value: v, fieldNumber: 3)
  614. }()
  615. case .post?: try {
  616. guard case .post(let v)? = self.pattern else { preconditionFailure() }
  617. try visitor.visitSingularStringField(value: v, fieldNumber: 4)
  618. }()
  619. case .delete?: try {
  620. guard case .delete(let v)? = self.pattern else { preconditionFailure() }
  621. try visitor.visitSingularStringField(value: v, fieldNumber: 5)
  622. }()
  623. case .patch?: try {
  624. guard case .patch(let v)? = self.pattern else { preconditionFailure() }
  625. try visitor.visitSingularStringField(value: v, fieldNumber: 6)
  626. }()
  627. default: break
  628. }
  629. if !self.body.isEmpty {
  630. try visitor.visitSingularStringField(value: self.body, fieldNumber: 7)
  631. }
  632. try { if case .custom(let v)? = self.pattern {
  633. try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
  634. } }()
  635. if !self.additionalBindings.isEmpty {
  636. try visitor.visitRepeatedMessageField(value: self.additionalBindings, fieldNumber: 11)
  637. }
  638. if !self.responseBody.isEmpty {
  639. try visitor.visitSingularStringField(value: self.responseBody, fieldNumber: 12)
  640. }
  641. try unknownFields.traverse(visitor: &visitor)
  642. }
  643. static func ==(lhs: Google_Api_HttpRule, rhs: Google_Api_HttpRule) -> Bool {
  644. if lhs.selector != rhs.selector {return false}
  645. if lhs.pattern != rhs.pattern {return false}
  646. if lhs.body != rhs.body {return false}
  647. if lhs.responseBody != rhs.responseBody {return false}
  648. if lhs.additionalBindings != rhs.additionalBindings {return false}
  649. if lhs.unknownFields != rhs.unknownFields {return false}
  650. return true
  651. }
  652. }
  653. extension Google_Api_CustomHttpPattern: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  654. static let protoMessageName: String = _protobuf_package + ".CustomHttpPattern"
  655. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  656. 1: .same(proto: "kind"),
  657. 2: .same(proto: "path"),
  658. ]
  659. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  660. while let fieldNumber = try decoder.nextFieldNumber() {
  661. // The use of inline closures is to circumvent an issue where the compiler
  662. // allocates stack space for every case branch when no optimizations are
  663. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  664. switch fieldNumber {
  665. case 1: try { try decoder.decodeSingularStringField(value: &self.kind) }()
  666. case 2: try { try decoder.decodeSingularStringField(value: &self.path) }()
  667. default: break
  668. }
  669. }
  670. }
  671. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  672. if !self.kind.isEmpty {
  673. try visitor.visitSingularStringField(value: self.kind, fieldNumber: 1)
  674. }
  675. if !self.path.isEmpty {
  676. try visitor.visitSingularStringField(value: self.path, fieldNumber: 2)
  677. }
  678. try unknownFields.traverse(visitor: &visitor)
  679. }
  680. static func ==(lhs: Google_Api_CustomHttpPattern, rhs: Google_Api_CustomHttpPattern) -> Bool {
  681. if lhs.kind != rhs.kind {return false}
  682. if lhs.path != rhs.path {return false}
  683. if lhs.unknownFields != rhs.unknownFields {return false}
  684. return true
  685. }
  686. }