http.pb.swift 28 KB

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