| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730 |
- // DO NOT EDIT.
- // swift-format-ignore-file
- //
- // Generated by the Swift generator plugin for the protocol buffer compiler.
- // Source: google/api/http.proto
- //
- // For information on using the generated types, please see the documentation:
- // https://github.com/apple/swift-protobuf/
- // Copyright 2015 Google LLC
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- import Foundation
- import SwiftProtobuf
- // If the compiler emits an error on this type, it is because this file
- // was generated by a version of the `protoc` Swift plug-in that is
- // incompatible with the version of SwiftProtobuf to which you are linking.
- // Please ensure that you are building against the same version of the API
- // that was used to generate this file.
- fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
- struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
- typealias Version = _2
- }
- /// Defines the HTTP configuration for an API service. It contains a list of
- /// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
- /// to one or more HTTP REST API methods.
- struct Google_Api_Http {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- /// A list of HTTP configuration rules that apply to individual API methods.
- ///
- /// **NOTE:** All service configuration rules follow "last one wins" order.
- var rules: [Google_Api_HttpRule] = []
- /// When set to true, URL path parameters will be fully URI-decoded except in
- /// cases of single segment matches in reserved expansion, where "%2F" will be
- /// left encoded.
- ///
- /// The default behavior is to not decode RFC 6570 reserved characters in multi
- /// segment matches.
- var fullyDecodeReservedExpansion: Bool = false
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// # gRPC Transcoding
- ///
- /// gRPC Transcoding is a feature for mapping between a gRPC method and one or
- /// more HTTP REST endpoints. It allows developers to build a single API service
- /// that supports both gRPC APIs and REST APIs. Many systems, including [Google
- /// APIs](https://github.com/googleapis/googleapis),
- /// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
- /// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
- /// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
- /// and use it for large scale production services.
- ///
- /// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
- /// how different portions of the gRPC request message are mapped to the URL
- /// path, URL query parameters, and HTTP request body. It also controls how the
- /// gRPC response message is mapped to the HTTP response body. `HttpRule` is
- /// typically specified as an `google.api.http` annotation on the gRPC method.
- ///
- /// Each mapping specifies a URL path template and an HTTP method. The path
- /// template may refer to one or more fields in the gRPC request message, as long
- /// as each field is a non-repeated field with a primitive (non-message) type.
- /// The path template controls how fields of the request message are mapped to
- /// the URL path.
- ///
- /// Example:
- ///
- /// service Messaging {
- /// rpc GetMessage(GetMessageRequest) returns (Message) {
- /// option (google.api.http) = {
- /// get: "/v1/{name=messages/*}"
- /// };
- /// }
- /// }
- /// message GetMessageRequest {
- /// string name = 1; // Mapped to URL path.
- /// }
- /// message Message {
- /// string text = 1; // The resource content.
- /// }
- ///
- /// This enables an HTTP REST to gRPC mapping as below:
- ///
- /// HTTP | gRPC
- /// -----|-----
- /// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
- ///
- /// Any fields in the request message which are not bound by the path template
- /// automatically become HTTP query parameters if there is no HTTP request body.
- /// For example:
- ///
- /// service Messaging {
- /// rpc GetMessage(GetMessageRequest) returns (Message) {
- /// option (google.api.http) = {
- /// get:"/v1/messages/{message_id}"
- /// };
- /// }
- /// }
- /// message GetMessageRequest {
- /// message SubMessage {
- /// string subfield = 1;
- /// }
- /// string message_id = 1; // Mapped to URL path.
- /// int64 revision = 2; // Mapped to URL query parameter `revision`.
- /// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
- /// }
- ///
- /// This enables a HTTP JSON to RPC mapping as below:
- ///
- /// HTTP | gRPC
- /// -----|-----
- /// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
- /// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
- /// "foo"))`
- ///
- /// Note that fields which are mapped to URL query parameters must have a
- /// primitive type or a repeated primitive type or a non-repeated message type.
- /// In the case of a repeated type, the parameter can be repeated in the URL
- /// as `...?param=A¶m=B`. In the case of a message type, each field of the
- /// message is mapped to a separate parameter, such as
- /// `...?foo.a=A&foo.b=B&foo.c=C`.
- ///
- /// For HTTP methods that allow a request body, the `body` field
- /// specifies the mapping. Consider a REST update method on the
- /// message resource collection:
- ///
- /// service Messaging {
- /// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
- /// option (google.api.http) = {
- /// patch: "/v1/messages/{message_id}"
- /// body: "message"
- /// };
- /// }
- /// }
- /// message UpdateMessageRequest {
- /// string message_id = 1; // mapped to the URL
- /// Message message = 2; // mapped to the body
- /// }
- ///
- /// The following HTTP JSON to RPC mapping is enabled, where the
- /// representation of the JSON in the request body is determined by
- /// protos JSON encoding:
- ///
- /// HTTP | gRPC
- /// -----|-----
- /// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
- /// "123456" message { text: "Hi!" })`
- ///
- /// The special name `*` can be used in the body mapping to define that
- /// every field not bound by the path template should be mapped to the
- /// request body. This enables the following alternative definition of
- /// the update method:
- ///
- /// service Messaging {
- /// rpc UpdateMessage(Message) returns (Message) {
- /// option (google.api.http) = {
- /// patch: "/v1/messages/{message_id}"
- /// body: "*"
- /// };
- /// }
- /// }
- /// message Message {
- /// string message_id = 1;
- /// string text = 2;
- /// }
- ///
- ///
- /// The following HTTP JSON to RPC mapping is enabled:
- ///
- /// HTTP | gRPC
- /// -----|-----
- /// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
- /// "123456" text: "Hi!")`
- ///
- /// Note that when using `*` in the body mapping, it is not possible to
- /// have HTTP parameters, as all fields not bound by the path end in
- /// the body. This makes this option more rarely used in practice when
- /// defining REST APIs. The common usage of `*` is in custom methods
- /// which don't use the URL at all for transferring data.
- ///
- /// It is possible to define multiple HTTP methods for one RPC by using
- /// the `additional_bindings` option. Example:
- ///
- /// service Messaging {
- /// rpc GetMessage(GetMessageRequest) returns (Message) {
- /// option (google.api.http) = {
- /// get: "/v1/messages/{message_id}"
- /// additional_bindings {
- /// get: "/v1/users/{user_id}/messages/{message_id}"
- /// }
- /// };
- /// }
- /// }
- /// message GetMessageRequest {
- /// string message_id = 1;
- /// string user_id = 2;
- /// }
- ///
- /// This enables the following two alternative HTTP JSON to RPC mappings:
- ///
- /// HTTP | gRPC
- /// -----|-----
- /// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
- /// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
- /// "123456")`
- ///
- /// ## Rules for HTTP mapping
- ///
- /// 1. Leaf request fields (recursive expansion nested messages in the request
- /// message) are classified into three categories:
- /// - Fields referred by the path template. They are passed via the URL path.
- /// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
- /// request body.
- /// - All other fields are passed via the URL query parameters, and the
- /// parameter name is the field path in the request message. A repeated
- /// field can be represented as multiple query parameters under the same
- /// name.
- /// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
- /// are passed via URL path and HTTP request body.
- /// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
- /// fields are passed via URL path and URL query parameters.
- ///
- /// ### Path template syntax
- ///
- /// Template = "/" Segments [ Verb ] ;
- /// Segments = Segment { "/" Segment } ;
- /// Segment = "*" | "**" | LITERAL | Variable ;
- /// Variable = "{" FieldPath [ "=" Segments ] "}" ;
- /// FieldPath = IDENT { "." IDENT } ;
- /// Verb = ":" LITERAL ;
- ///
- /// The syntax `*` matches a single URL path segment. The syntax `**` matches
- /// zero or more URL path segments, which must be the last part of the URL path
- /// except the `Verb`.
- ///
- /// The syntax `Variable` matches part of the URL path as specified by its
- /// template. A variable template must not contain other variables. If a variable
- /// matches a single path segment, its template may be omitted, e.g. `{var}`
- /// is equivalent to `{var=*}`.
- ///
- /// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
- /// contains any reserved character, such characters should be percent-encoded
- /// before the matching.
- ///
- /// If a variable contains exactly one path segment, such as `"{var}"` or
- /// `"{var=*}"`, when such a variable is expanded into a URL path on the client
- /// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
- /// server side does the reverse decoding. Such variables show up in the
- /// [Discovery
- /// Document](https://developers.google.com/discovery/v1/reference/apis) as
- /// `{var}`.
- ///
- /// If a variable contains multiple path segments, such as `"{var=foo/*}"`
- /// or `"{var=**}"`, when such a variable is expanded into a URL path on the
- /// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
- /// The server side does the reverse decoding, except "%2F" and "%2f" are left
- /// unchanged. Such variables show up in the
- /// [Discovery
- /// Document](https://developers.google.com/discovery/v1/reference/apis) as
- /// `{+var}`.
- ///
- /// ## Using gRPC API Service Configuration
- ///
- /// gRPC API Service Configuration (service config) is a configuration language
- /// for configuring a gRPC service to become a user-facing product. The
- /// service config is simply the YAML representation of the `google.api.Service`
- /// proto message.
- ///
- /// As an alternative to annotating your proto file, you can configure gRPC
- /// transcoding in your service config YAML files. You do this by specifying a
- /// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
- /// effect as the proto annotation. This can be particularly useful if you
- /// have a proto that is reused in multiple services. Note that any transcoding
- /// specified in the service config will override any matching transcoding
- /// configuration in the proto.
- ///
- /// Example:
- ///
- /// http:
- /// rules:
- /// # Selects a gRPC method and applies HttpRule to it.
- /// - selector: example.v1.Messaging.GetMessage
- /// get: /v1/messages/{message_id}/{sub.subfield}
- ///
- /// ## Special notes
- ///
- /// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
- /// proto to JSON conversion must follow the [proto3
- /// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
- ///
- /// While the single segment variable follows the semantics of
- /// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
- /// Expansion, the multi segment variable **does not** follow RFC 6570 Section
- /// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
- /// does not expand special characters like `?` and `#`, which would lead
- /// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
- /// for multi segment variables.
- ///
- /// The path variables **must not** refer to any repeated or mapped field,
- /// because client libraries are not capable of handling such variable expansion.
- ///
- /// The path variables **must not** capture the leading "/" character. The reason
- /// is that the most common use case "{var}" does not capture the leading "/"
- /// character. For consistency, all path variables must share the same behavior.
- ///
- /// Repeated message fields must not be mapped to URL query parameters, because
- /// no client library can support such complicated mapping.
- ///
- /// If an API needs to use a JSON array for request or response body, it can map
- /// the request or response body to a repeated field. However, some gRPC
- /// Transcoding implementations may not support this feature.
- struct Google_Api_HttpRule {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- /// Selects a method to which this rule applies.
- ///
- /// Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
- var selector: String = String()
- /// Determines the URL pattern is matched by this rules. This pattern can be
- /// used with any of the {get|put|post|delete|patch} methods. A custom method
- /// can be defined using the 'custom' field.
- var pattern: Google_Api_HttpRule.OneOf_Pattern? = nil
- /// Maps to HTTP GET. Used for listing and getting information about
- /// resources.
- var get: String {
- get {
- if case .get(let v)? = pattern {return v}
- return String()
- }
- set {pattern = .get(newValue)}
- }
- /// Maps to HTTP PUT. Used for replacing a resource.
- var put: String {
- get {
- if case .put(let v)? = pattern {return v}
- return String()
- }
- set {pattern = .put(newValue)}
- }
- /// Maps to HTTP POST. Used for creating a resource or performing an action.
- var post: String {
- get {
- if case .post(let v)? = pattern {return v}
- return String()
- }
- set {pattern = .post(newValue)}
- }
- /// Maps to HTTP DELETE. Used for deleting a resource.
- var delete: String {
- get {
- if case .delete(let v)? = pattern {return v}
- return String()
- }
- set {pattern = .delete(newValue)}
- }
- /// Maps to HTTP PATCH. Used for updating a resource.
- var patch: String {
- get {
- if case .patch(let v)? = pattern {return v}
- return String()
- }
- set {pattern = .patch(newValue)}
- }
- /// The custom pattern is used for specifying an HTTP method that is not
- /// included in the `pattern` field, such as HEAD, or "*" to leave the
- /// HTTP method unspecified for this rule. The wild-card rule is useful
- /// for services that provide content to Web (HTML) clients.
- var custom: Google_Api_CustomHttpPattern {
- get {
- if case .custom(let v)? = pattern {return v}
- return Google_Api_CustomHttpPattern()
- }
- set {pattern = .custom(newValue)}
- }
- /// The name of the request field whose value is mapped to the HTTP request
- /// body, or `*` for mapping all request fields not captured by the path
- /// pattern to the HTTP body, or omitted for not having any HTTP request body.
- ///
- /// NOTE: the referred field must be present at the top-level of the request
- /// message type.
- var body: String = String()
- /// Optional. The name of the response field whose value is mapped to the HTTP
- /// response body. When omitted, the entire response message will be used
- /// as the HTTP response body.
- ///
- /// NOTE: The referred field must be present at the top-level of the response
- /// message type.
- var responseBody: String = String()
- /// Additional HTTP bindings for the selector. Nested bindings must
- /// not contain an `additional_bindings` field themselves (that is,
- /// the nesting may only be one level deep).
- var additionalBindings: [Google_Api_HttpRule] = []
- var unknownFields = SwiftProtobuf.UnknownStorage()
- /// Determines the URL pattern is matched by this rules. This pattern can be
- /// used with any of the {get|put|post|delete|patch} methods. A custom method
- /// can be defined using the 'custom' field.
- enum OneOf_Pattern: Equatable {
- /// Maps to HTTP GET. Used for listing and getting information about
- /// resources.
- case get(String)
- /// Maps to HTTP PUT. Used for replacing a resource.
- case put(String)
- /// Maps to HTTP POST. Used for creating a resource or performing an action.
- case post(String)
- /// Maps to HTTP DELETE. Used for deleting a resource.
- case delete(String)
- /// Maps to HTTP PATCH. Used for updating a resource.
- case patch(String)
- /// The custom pattern is used for specifying an HTTP method that is not
- /// included in the `pattern` field, such as HEAD, or "*" to leave the
- /// HTTP method unspecified for this rule. The wild-card rule is useful
- /// for services that provide content to Web (HTML) clients.
- case custom(Google_Api_CustomHttpPattern)
- #if !swift(>=4.1)
- static func ==(lhs: Google_Api_HttpRule.OneOf_Pattern, rhs: Google_Api_HttpRule.OneOf_Pattern) -> Bool {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch (lhs, rhs) {
- case (.get, .get): return {
- guard case .get(let l) = lhs, case .get(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- case (.put, .put): return {
- guard case .put(let l) = lhs, case .put(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- case (.post, .post): return {
- guard case .post(let l) = lhs, case .post(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- case (.delete, .delete): return {
- guard case .delete(let l) = lhs, case .delete(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- case (.patch, .patch): return {
- guard case .patch(let l) = lhs, case .patch(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- case (.custom, .custom): return {
- guard case .custom(let l) = lhs, case .custom(let r) = rhs else { preconditionFailure() }
- return l == r
- }()
- default: return false
- }
- }
- #endif
- }
- init() {}
- }
- /// A custom pattern is used for defining custom HTTP verb.
- struct Google_Api_CustomHttpPattern {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- /// The name of this custom HTTP verb.
- var kind: String = String()
- /// The path matched by this custom verb.
- var path: String = String()
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- #if swift(>=5.5) && canImport(_Concurrency)
- extension Google_Api_Http: @unchecked Sendable {}
- extension Google_Api_HttpRule: @unchecked Sendable {}
- extension Google_Api_HttpRule.OneOf_Pattern: @unchecked Sendable {}
- extension Google_Api_CustomHttpPattern: @unchecked Sendable {}
- #endif // swift(>=5.5) && canImport(_Concurrency)
- // MARK: - Code below here is support for the SwiftProtobuf runtime.
- fileprivate let _protobuf_package = "google.api"
- extension Google_Api_Http: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".Http"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "rules"),
- 2: .standard(proto: "fully_decode_reserved_expansion"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeRepeatedMessageField(value: &self.rules) }()
- case 2: try { try decoder.decodeSingularBoolField(value: &self.fullyDecodeReservedExpansion) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.rules.isEmpty {
- try visitor.visitRepeatedMessageField(value: self.rules, fieldNumber: 1)
- }
- if self.fullyDecodeReservedExpansion != false {
- try visitor.visitSingularBoolField(value: self.fullyDecodeReservedExpansion, fieldNumber: 2)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Google_Api_Http, rhs: Google_Api_Http) -> Bool {
- if lhs.rules != rhs.rules {return false}
- if lhs.fullyDecodeReservedExpansion != rhs.fullyDecodeReservedExpansion {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Google_Api_HttpRule: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".HttpRule"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "selector"),
- 2: .same(proto: "get"),
- 3: .same(proto: "put"),
- 4: .same(proto: "post"),
- 5: .same(proto: "delete"),
- 6: .same(proto: "patch"),
- 8: .same(proto: "custom"),
- 7: .same(proto: "body"),
- 12: .standard(proto: "response_body"),
- 11: .standard(proto: "additional_bindings"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularStringField(value: &self.selector) }()
- case 2: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if self.pattern != nil {try decoder.handleConflictingOneOf()}
- self.pattern = .get(v)
- }
- }()
- case 3: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if self.pattern != nil {try decoder.handleConflictingOneOf()}
- self.pattern = .put(v)
- }
- }()
- case 4: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if self.pattern != nil {try decoder.handleConflictingOneOf()}
- self.pattern = .post(v)
- }
- }()
- case 5: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if self.pattern != nil {try decoder.handleConflictingOneOf()}
- self.pattern = .delete(v)
- }
- }()
- case 6: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if self.pattern != nil {try decoder.handleConflictingOneOf()}
- self.pattern = .patch(v)
- }
- }()
- case 7: try { try decoder.decodeSingularStringField(value: &self.body) }()
- case 8: try {
- var v: Google_Api_CustomHttpPattern?
- var hadOneofValue = false
- if let current = self.pattern {
- hadOneofValue = true
- if case .custom(let m) = current {v = m}
- }
- try decoder.decodeSingularMessageField(value: &v)
- if let v = v {
- if hadOneofValue {try decoder.handleConflictingOneOf()}
- self.pattern = .custom(v)
- }
- }()
- case 11: try { try decoder.decodeRepeatedMessageField(value: &self.additionalBindings) }()
- case 12: try { try decoder.decodeSingularStringField(value: &self.responseBody) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every if/case branch local when no optimizations
- // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
- // https://github.com/apple/swift-protobuf/issues/1182
- if !self.selector.isEmpty {
- try visitor.visitSingularStringField(value: self.selector, fieldNumber: 1)
- }
- switch self.pattern {
- case .get?: try {
- guard case .get(let v)? = self.pattern else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 2)
- }()
- case .put?: try {
- guard case .put(let v)? = self.pattern else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 3)
- }()
- case .post?: try {
- guard case .post(let v)? = self.pattern else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 4)
- }()
- case .delete?: try {
- guard case .delete(let v)? = self.pattern else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 5)
- }()
- case .patch?: try {
- guard case .patch(let v)? = self.pattern else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 6)
- }()
- default: break
- }
- if !self.body.isEmpty {
- try visitor.visitSingularStringField(value: self.body, fieldNumber: 7)
- }
- try { if case .custom(let v)? = self.pattern {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
- } }()
- if !self.additionalBindings.isEmpty {
- try visitor.visitRepeatedMessageField(value: self.additionalBindings, fieldNumber: 11)
- }
- if !self.responseBody.isEmpty {
- try visitor.visitSingularStringField(value: self.responseBody, fieldNumber: 12)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Google_Api_HttpRule, rhs: Google_Api_HttpRule) -> Bool {
- if lhs.selector != rhs.selector {return false}
- if lhs.pattern != rhs.pattern {return false}
- if lhs.body != rhs.body {return false}
- if lhs.responseBody != rhs.responseBody {return false}
- if lhs.additionalBindings != rhs.additionalBindings {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Google_Api_CustomHttpPattern: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".CustomHttpPattern"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "kind"),
- 2: .same(proto: "path"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularStringField(value: &self.kind) }()
- case 2: try { try decoder.decodeSingularStringField(value: &self.path) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.kind.isEmpty {
- try visitor.visitSingularStringField(value: self.kind, fieldNumber: 1)
- }
- if !self.path.isEmpty {
- try visitor.visitSingularStringField(value: self.path, fieldNumber: 2)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Google_Api_CustomHttpPattern, rhs: Google_Api_CustomHttpPattern) -> Bool {
- if lhs.kind != rhs.kind {return false}
- if lhs.path != rhs.path {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
|