diff --git a/.editorconfig b/.editorconfig index 728893b..0819100 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,6 @@ trim_trailing_whitespace = true [*.{sh,swift-format,yaml}] indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2922e7a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "flagd-schemas"] + path = flagd-schemas + url = https://github.com/open-feature/flagd-schemas diff --git a/.licenseignore b/.licenseignore index adbc119..8905a79 100644 --- a/.licenseignore +++ b/.licenseignore @@ -7,3 +7,7 @@ *.txt *.yaml Package.swift +Makefile +.gitmodules +flagd-schemas/ +*/Generated/** diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8504794 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +# Code generation +# ----------------------------------------------------------------------------- +PROTO_ROOT = flagd-schemas/protobuf +PROTOS += $(PROTO_ROOT)/flagd/evaluation/v1/evaluation.proto +GEN_SWIFT_ROOT = Sources/Flagd/Generated +GEN_SWIFTS = $(patsubst $(PROTO_ROOT)/%.proto,$(GEN_SWIFT_ROOT)/%.pb.swift,$(PROTOS)) +GEN_GRPC_SWIFTS = $(subst $(PROTO_ROOT),$(GEN_SWIFT_ROOT),$(PROTOS:.proto=.grpc.swift)) +PROTOC_GEN_SWIFT = .build/debug/protoc-gen-swift +PROTOC_GEN_GRPC_SWIFT = .build/debug/protoc-gen-grpc-swift + +$(PROTOC_GEN_SWIFT): + swift build --product protoc-gen-swift + +$(PROTOC_GEN_GRPC_SWIFT): + swift build --product protoc-gen-grpc-swift + +$(GEN_SWIFTS): $(PROTOS) $(PROTOC_GEN_SWIFT) + @mkdir -pv $(GEN_SWIFT_ROOT) + protoc $(PROTOS) \ + --proto_path=$(PROTO_ROOT) \ + --plugin=$(PROTOC_GEN_SWIFT) \ + --swift_out=$(GEN_SWIFT_ROOT) \ + --swift_opt=Visibility=Internal \ + --experimental_allow_proto3_optional + +$(GEN_GRPC_SWIFTS): $(PROTOS) $(PROTOC_GEN_GRPC_SWIFT) + @mkdir -pv $(GEN_SWIFT_ROOT) + protoc $(PROTOS) \ + --proto_path=$(PROTO_ROOT) \ + --plugin=$(PROTOC_GEN_GRPC_SWIFT) \ + --plugin=$(PROTOC_GEN_SWIFT) \ + --swift_out=$(GEN_SWIFT_ROOT) \ + --swift_opt=Visibility=Internal \ + --grpc-swift_out=Client=true,Server=false:$(GEN_SWIFT_ROOT) + +.PHONY: generate +generate: $(GEN_SWIFTS) $(GEN_GRPC_SWIFTS) + +.PHONY: delete-generated-code +delete-generated-code: # Delete all pb.swift and .grpc.swift files. + @read -p "Delete all *.pb.swift and *.grpc.swift files in Sources/Flagd [y/N]" ans && [ $${ans:-N} = y ] + find Sources -name *.pb.swift -delete -o -name *.grpc.swift -delete diff --git a/Package.swift b/Package.swift index 8e79305..2eeefc9 100644 --- a/Package.swift +++ b/Package.swift @@ -13,13 +13,15 @@ let package = Package( .library(name: "Flagd", targets: ["Flagd"]) ], dependencies: [ - .package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main") + .package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.8.0"), ], targets: [ .target( name: "Flagd", dependencies: [ - .product(name: "OpenFeature", package: "swift-open-feature") + .product(name: "OpenFeature", package: "swift-open-feature"), + .product(name: "GRPC", package: "grpc-swift"), ] ), .testTarget( diff --git a/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.grpc.swift b/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.grpc.swift new file mode 100644 index 0000000..b41c709 --- /dev/null +++ b/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.grpc.swift @@ -0,0 +1,574 @@ +// +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the protocol buffer compiler. +// Source: flagd/evaluation/v1/evaluation.proto +// +import GRPC +import NIO +import NIOConcurrencyHelpers +import SwiftProtobuf + + +/// Service defines the exposed rpcs of flagd +/// +/// Usage: instantiate `Flagd_Evaluation_V1_ServiceClient`, then call methods of this protocol to make API calls. +internal protocol Flagd_Evaluation_V1_ServiceClientProtocol: GRPCClient { + var serviceName: String { get } + var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? { get } + + func resolveAll( + _ request: Flagd_Evaluation_V1_ResolveAllRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func resolveBoolean( + _ request: Flagd_Evaluation_V1_ResolveBooleanRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func resolveString( + _ request: Flagd_Evaluation_V1_ResolveStringRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func resolveFloat( + _ request: Flagd_Evaluation_V1_ResolveFloatRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func resolveInt( + _ request: Flagd_Evaluation_V1_ResolveIntRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func resolveObject( + _ request: Flagd_Evaluation_V1_ResolveObjectRequest, + callOptions: CallOptions? + ) -> UnaryCall + + func eventStream( + _ request: Flagd_Evaluation_V1_EventStreamRequest, + callOptions: CallOptions?, + handler: @escaping (Flagd_Evaluation_V1_EventStreamResponse) -> Void + ) -> ServerStreamingCall +} + +extension Flagd_Evaluation_V1_ServiceClientProtocol { + internal var serviceName: String { + return "flagd.evaluation.v1.Service" + } + + /// Unary call to ResolveAll + /// + /// - Parameters: + /// - request: Request to send to ResolveAll. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveAll( + _ request: Flagd_Evaluation_V1_ResolveAllRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveAll.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveAllInterceptors() ?? [] + ) + } + + /// Unary call to ResolveBoolean + /// + /// - Parameters: + /// - request: Request to send to ResolveBoolean. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveBoolean( + _ request: Flagd_Evaluation_V1_ResolveBooleanRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveBoolean.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveBooleanInterceptors() ?? [] + ) + } + + /// Unary call to ResolveString + /// + /// - Parameters: + /// - request: Request to send to ResolveString. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveString( + _ request: Flagd_Evaluation_V1_ResolveStringRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveString.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveStringInterceptors() ?? [] + ) + } + + /// Unary call to ResolveFloat + /// + /// - Parameters: + /// - request: Request to send to ResolveFloat. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveFloat( + _ request: Flagd_Evaluation_V1_ResolveFloatRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveFloat.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveFloatInterceptors() ?? [] + ) + } + + /// Unary call to ResolveInt + /// + /// - Parameters: + /// - request: Request to send to ResolveInt. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveInt( + _ request: Flagd_Evaluation_V1_ResolveIntRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveInt.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveIntInterceptors() ?? [] + ) + } + + /// Unary call to ResolveObject + /// + /// - Parameters: + /// - request: Request to send to ResolveObject. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + internal func resolveObject( + _ request: Flagd_Evaluation_V1_ResolveObjectRequest, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveObject.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveObjectInterceptors() ?? [] + ) + } + + /// Server streaming call to EventStream + /// + /// - Parameters: + /// - request: Request to send to EventStream. + /// - callOptions: Call options. + /// - handler: A closure called when each response is received from the server. + /// - Returns: A `ServerStreamingCall` with futures for the metadata and status. + internal func eventStream( + _ request: Flagd_Evaluation_V1_EventStreamRequest, + callOptions: CallOptions? = nil, + handler: @escaping (Flagd_Evaluation_V1_EventStreamResponse) -> Void + ) -> ServerStreamingCall { + return self.makeServerStreamingCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.eventStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeEventStreamInterceptors() ?? [], + handler: handler + ) + } +} + +@available(*, deprecated) +extension Flagd_Evaluation_V1_ServiceClient: @unchecked Sendable {} + +@available(*, deprecated, renamed: "Flagd_Evaluation_V1_ServiceNIOClient") +internal final class Flagd_Evaluation_V1_ServiceClient: Flagd_Evaluation_V1_ServiceClientProtocol { + private let lock = Lock() + private var _defaultCallOptions: CallOptions + private var _interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? + internal let channel: GRPCChannel + internal var defaultCallOptions: CallOptions { + get { self.lock.withLock { return self._defaultCallOptions } } + set { self.lock.withLockVoid { self._defaultCallOptions = newValue } } + } + internal var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? { + get { self.lock.withLock { return self._interceptors } } + set { self.lock.withLockVoid { self._interceptors = newValue } } + } + + /// Creates a client for the flagd.evaluation.v1.Service service. + /// + /// - Parameters: + /// - channel: `GRPCChannel` to the service host. + /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. + /// - interceptors: A factory providing interceptors for each RPC. + internal init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self._defaultCallOptions = defaultCallOptions + self._interceptors = interceptors + } +} + +internal struct Flagd_Evaluation_V1_ServiceNIOClient: Flagd_Evaluation_V1_ServiceClientProtocol { + internal var channel: GRPCChannel + internal var defaultCallOptions: CallOptions + internal var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? + + /// Creates a client for the flagd.evaluation.v1.Service service. + /// + /// - Parameters: + /// - channel: `GRPCChannel` to the service host. + /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. + /// - interceptors: A factory providing interceptors for each RPC. + internal init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self.defaultCallOptions = defaultCallOptions + self.interceptors = interceptors + } +} + +/// Service defines the exposed rpcs of flagd +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +internal protocol Flagd_Evaluation_V1_ServiceAsyncClientProtocol: GRPCClient { + static var serviceDescriptor: GRPCServiceDescriptor { get } + var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? { get } + + func makeResolveAllCall( + _ request: Flagd_Evaluation_V1_ResolveAllRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeResolveBooleanCall( + _ request: Flagd_Evaluation_V1_ResolveBooleanRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeResolveStringCall( + _ request: Flagd_Evaluation_V1_ResolveStringRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeResolveFloatCall( + _ request: Flagd_Evaluation_V1_ResolveFloatRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeResolveIntCall( + _ request: Flagd_Evaluation_V1_ResolveIntRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeResolveObjectCall( + _ request: Flagd_Evaluation_V1_ResolveObjectRequest, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeEventStreamCall( + _ request: Flagd_Evaluation_V1_EventStreamRequest, + callOptions: CallOptions? + ) -> GRPCAsyncServerStreamingCall +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Flagd_Evaluation_V1_ServiceAsyncClientProtocol { + internal static var serviceDescriptor: GRPCServiceDescriptor { + return Flagd_Evaluation_V1_ServiceClientMetadata.serviceDescriptor + } + + internal var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? { + return nil + } + + internal func makeResolveAllCall( + _ request: Flagd_Evaluation_V1_ResolveAllRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveAll.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveAllInterceptors() ?? [] + ) + } + + internal func makeResolveBooleanCall( + _ request: Flagd_Evaluation_V1_ResolveBooleanRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveBoolean.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveBooleanInterceptors() ?? [] + ) + } + + internal func makeResolveStringCall( + _ request: Flagd_Evaluation_V1_ResolveStringRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveString.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveStringInterceptors() ?? [] + ) + } + + internal func makeResolveFloatCall( + _ request: Flagd_Evaluation_V1_ResolveFloatRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveFloat.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveFloatInterceptors() ?? [] + ) + } + + internal func makeResolveIntCall( + _ request: Flagd_Evaluation_V1_ResolveIntRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveInt.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveIntInterceptors() ?? [] + ) + } + + internal func makeResolveObjectCall( + _ request: Flagd_Evaluation_V1_ResolveObjectRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveObject.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveObjectInterceptors() ?? [] + ) + } + + internal func makeEventStreamCall( + _ request: Flagd_Evaluation_V1_EventStreamRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncServerStreamingCall { + return self.makeAsyncServerStreamingCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.eventStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeEventStreamInterceptors() ?? [] + ) + } +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Flagd_Evaluation_V1_ServiceAsyncClientProtocol { + internal func resolveAll( + _ request: Flagd_Evaluation_V1_ResolveAllRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveAllResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveAll.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveAllInterceptors() ?? [] + ) + } + + internal func resolveBoolean( + _ request: Flagd_Evaluation_V1_ResolveBooleanRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveBooleanResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveBoolean.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveBooleanInterceptors() ?? [] + ) + } + + internal func resolveString( + _ request: Flagd_Evaluation_V1_ResolveStringRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveStringResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveString.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveStringInterceptors() ?? [] + ) + } + + internal func resolveFloat( + _ request: Flagd_Evaluation_V1_ResolveFloatRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveFloatResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveFloat.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveFloatInterceptors() ?? [] + ) + } + + internal func resolveInt( + _ request: Flagd_Evaluation_V1_ResolveIntRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveIntResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveInt.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveIntInterceptors() ?? [] + ) + } + + internal func resolveObject( + _ request: Flagd_Evaluation_V1_ResolveObjectRequest, + callOptions: CallOptions? = nil + ) async throws -> Flagd_Evaluation_V1_ResolveObjectResponse { + return try await self.performAsyncUnaryCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveObject.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeResolveObjectInterceptors() ?? [] + ) + } + + internal func eventStream( + _ request: Flagd_Evaluation_V1_EventStreamRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncResponseStream { + return self.performAsyncServerStreamingCall( + path: Flagd_Evaluation_V1_ServiceClientMetadata.Methods.eventStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeEventStreamInterceptors() ?? [] + ) + } +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +internal struct Flagd_Evaluation_V1_ServiceAsyncClient: Flagd_Evaluation_V1_ServiceAsyncClientProtocol { + internal var channel: GRPCChannel + internal var defaultCallOptions: CallOptions + internal var interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? + + internal init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self.defaultCallOptions = defaultCallOptions + self.interceptors = interceptors + } +} + +internal protocol Flagd_Evaluation_V1_ServiceClientInterceptorFactoryProtocol: Sendable { + + /// - Returns: Interceptors to use when invoking 'resolveAll'. + func makeResolveAllInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'resolveBoolean'. + func makeResolveBooleanInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'resolveString'. + func makeResolveStringInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'resolveFloat'. + func makeResolveFloatInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'resolveInt'. + func makeResolveIntInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'resolveObject'. + func makeResolveObjectInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'eventStream'. + func makeEventStreamInterceptors() -> [ClientInterceptor] +} + +internal enum Flagd_Evaluation_V1_ServiceClientMetadata { + internal static let serviceDescriptor = GRPCServiceDescriptor( + name: "Service", + fullName: "flagd.evaluation.v1.Service", + methods: [ + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveAll, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveBoolean, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveString, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveFloat, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveInt, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.resolveObject, + Flagd_Evaluation_V1_ServiceClientMetadata.Methods.eventStream, + ] + ) + + internal enum Methods { + internal static let resolveAll = GRPCMethodDescriptor( + name: "ResolveAll", + path: "/flagd.evaluation.v1.Service/ResolveAll", + type: GRPCCallType.unary + ) + + internal static let resolveBoolean = GRPCMethodDescriptor( + name: "ResolveBoolean", + path: "/flagd.evaluation.v1.Service/ResolveBoolean", + type: GRPCCallType.unary + ) + + internal static let resolveString = GRPCMethodDescriptor( + name: "ResolveString", + path: "/flagd.evaluation.v1.Service/ResolveString", + type: GRPCCallType.unary + ) + + internal static let resolveFloat = GRPCMethodDescriptor( + name: "ResolveFloat", + path: "/flagd.evaluation.v1.Service/ResolveFloat", + type: GRPCCallType.unary + ) + + internal static let resolveInt = GRPCMethodDescriptor( + name: "ResolveInt", + path: "/flagd.evaluation.v1.Service/ResolveInt", + type: GRPCCallType.unary + ) + + internal static let resolveObject = GRPCMethodDescriptor( + name: "ResolveObject", + path: "/flagd.evaluation.v1.Service/ResolveObject", + type: GRPCCallType.unary + ) + + internal static let eventStream = GRPCMethodDescriptor( + name: "EventStream", + path: "/flagd.evaluation.v1.Service/EventStream", + type: GRPCCallType.serverStreaming + ) + } +} + diff --git a/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.pb.swift b/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.pb.swift new file mode 100644 index 0000000..450cf4a --- /dev/null +++ b/Sources/Flagd/Generated/flagd/evaluation/v1/evaluation.pb.swift @@ -0,0 +1,1180 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// swiftlint:disable all +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: flagd/evaluation/v1/evaluation.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +///* +/// Flag evaluation API +/// +/// This proto forms the basis of a flag-evaluation API. +/// It supports single and bulk evaluation RPCs, and flags of various types, as well as establishing a stream for getting notifications about changes in a flag definition. +/// It supports the inclusion of a "context" with each evaluation, which may contain arbitrary attributes relevant to flag evaluation. + +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 +} + +/// Request body for bulk flag evaluation, used by the ResolveAll rpc. +struct Flagd_Evaluation_V1_ResolveAllRequest: Sendable { + // 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. + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for bulk flag evaluation, used by the ResolveAll rpc. +struct Flagd_Evaluation_V1_ResolveAllResponse: Sendable { + // 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. + + /// Object structure describing the evaluated flags for the provided context. + var flags: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// A variant type flag response. +struct Flagd_Evaluation_V1_AnyFlag: Sendable { + // 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 reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// The response value of the boolean flag evaluation, will be unset in the case of error. + var value: Flagd_Evaluation_V1_AnyFlag.OneOf_Value? = nil + + var boolValue: Bool { + get { + if case .boolValue(let v)? = value {return v} + return false + } + set {value = .boolValue(newValue)} + } + + var stringValue: String { + get { + if case .stringValue(let v)? = value {return v} + return String() + } + set {value = .stringValue(newValue)} + } + + var doubleValue: Double { + get { + if case .doubleValue(let v)? = value {return v} + return 0 + } + set {value = .doubleValue(newValue)} + } + + var objectValue: SwiftProtobuf.Google_Protobuf_Struct { + get { + if case .objectValue(let v)? = value {return v} + return SwiftProtobuf.Google_Protobuf_Struct() + } + set {value = .objectValue(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// The response value of the boolean flag evaluation, will be unset in the case of error. + enum OneOf_Value: Equatable, Sendable { + case boolValue(Bool) + case stringValue(String) + case doubleValue(Double) + case objectValue(SwiftProtobuf.Google_Protobuf_Struct) + + } + + init() {} +} + +/// Request body for boolean flag evaluation, used by the ResolveBoolean rpc. +struct Flagd_Evaluation_V1_ResolveBooleanRequest: Sendable { + // 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. + + /// Flag key of the requested flag. + var flagKey: String = String() + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for boolean flag evaluation. used by the ResolveBoolean rpc. +struct Flagd_Evaluation_V1_ResolveBooleanResponse: Sendable { + // 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 response value of the boolean flag evaluation, will be unset in the case of error. + var value: Bool = false + + /// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// Metadata for this evaluation + var metadata: SwiftProtobuf.Google_Protobuf_Struct { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + mutating func clearMetadata() {self._metadata = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Request body for string flag evaluation, used by the ResolveString rpc. +struct Flagd_Evaluation_V1_ResolveStringRequest: Sendable { + // 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. + + /// Flag key of the requested flag. + var flagKey: String = String() + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for string flag evaluation. used by the ResolveString rpc. +struct Flagd_Evaluation_V1_ResolveStringResponse: Sendable { + // 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 response value of the string flag evaluation, will be unset in the case of error. + var value: String = String() + + /// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// Metadata for this evaluation + var metadata: SwiftProtobuf.Google_Protobuf_Struct { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + mutating func clearMetadata() {self._metadata = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Request body for float flag evaluation, used by the ResolveFloat rpc. +struct Flagd_Evaluation_V1_ResolveFloatRequest: Sendable { + // 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. + + /// Flag key of the requested flag. + var flagKey: String = String() + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for float flag evaluation. used by the ResolveFloat rpc. +struct Flagd_Evaluation_V1_ResolveFloatResponse: Sendable { + // 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 response value of the float flag evaluation, will be empty in the case of error. + var value: Double = 0 + + /// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// Metadata for this evaluation + var metadata: SwiftProtobuf.Google_Protobuf_Struct { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + mutating func clearMetadata() {self._metadata = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Request body for int flag evaluation, used by the ResolveInt rpc. +struct Flagd_Evaluation_V1_ResolveIntRequest: Sendable { + // 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. + + /// Flag key of the requested flag. + var flagKey: String = String() + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for int flag evaluation. used by the ResolveInt rpc. +struct Flagd_Evaluation_V1_ResolveIntResponse: Sendable { + // 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 response value of the int flag evaluation, will be unset in the case of error. + var value: Int64 = 0 + + /// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// Metadata for this evaluation + var metadata: SwiftProtobuf.Google_Protobuf_Struct { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + mutating func clearMetadata() {self._metadata = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Request body for object flag evaluation, used by the ResolveObject rpc. +struct Flagd_Evaluation_V1_ResolveObjectRequest: Sendable { + // 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. + + /// Flag key of the requested flag. + var flagKey: String = String() + + /// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context + var context: SwiftProtobuf.Google_Protobuf_Struct { + get {return _context ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_context = newValue} + } + /// Returns true if `context` has been explicitly set. + var hasContext: Bool {return self._context != nil} + /// Clears the value of `context`. Subsequent reads from it will return its default value. + mutating func clearContext() {self._context = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _context: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for object flag evaluation. used by the ResolveObject rpc. +struct Flagd_Evaluation_V1_ResolveObjectResponse: Sendable { + // 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 response value of the object flag evaluation, will be unset in the case of error. + /// + /// NOTE: This structure will need to be decoded from google/protobuf/struct.proto before it is returned to the SDK + var value: SwiftProtobuf.Google_Protobuf_Struct { + get {return _value ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + mutating func clearValue() {self._value = nil} + + /// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details + var reason: String = String() + + /// The variant name of the returned flag value. + var variant: String = String() + + /// Metadata for this evaluation + var metadata: SwiftProtobuf.Google_Protobuf_Struct { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + mutating func clearMetadata() {self._metadata = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _value: SwiftProtobuf.Google_Protobuf_Struct? = nil + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Response body for the EventStream stream response +struct Flagd_Evaluation_V1_EventStreamResponse: Sendable { + // 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. + + /// String key indicating the type of event that is being received, for example, provider_ready or configuration_change + var type: String = String() + + /// Object structure for use when sending relevant metadata to provide context to the event. + /// Can be left unset when it is not required. + var data: SwiftProtobuf.Google_Protobuf_Struct { + get {return _data ?? SwiftProtobuf.Google_Protobuf_Struct()} + set {_data = newValue} + } + /// Returns true if `data` has been explicitly set. + var hasData: Bool {return self._data != nil} + /// Clears the value of `data`. Subsequent reads from it will return its default value. + mutating func clearData() {self._data = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _data: SwiftProtobuf.Google_Protobuf_Struct? = nil +} + +/// Empty stream request body +struct Flagd_Evaluation_V1_EventStreamRequest: Sendable { + // 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. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "flagd.evaluation.v1" + +extension Flagd_Evaluation_V1_ResolveAllRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveAllRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "context"), + ] + + mutating func decodeMessage(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.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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 + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveAllRequest, rhs: Flagd_Evaluation_V1_ResolveAllRequest) -> Bool { + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveAllResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveAllResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "flags"), + ] + + mutating func decodeMessage(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.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.flags) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.flags.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.flags, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveAllResponse, rhs: Flagd_Evaluation_V1_ResolveAllResponse) -> Bool { + if lhs.flags != rhs.flags {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_AnyFlag: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AnyFlag" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "reason"), + 2: .same(proto: "variant"), + 3: .standard(proto: "bool_value"), + 4: .standard(proto: "string_value"), + 5: .standard(proto: "double_value"), + 6: .standard(proto: "object_value"), + ] + + mutating func decodeMessage(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.reason) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 3: try { + var v: Bool? + try decoder.decodeSingularBoolField(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .boolValue(v) + } + }() + case 4: try { + var v: String? + try decoder.decodeSingularStringField(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .stringValue(v) + } + }() + case 5: try { + var v: Double? + try decoder.decodeSingularDoubleField(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .doubleValue(v) + } + }() + case 6: try { + var v: SwiftProtobuf.Google_Protobuf_Struct? + var hadOneofValue = false + if let current = self.value { + hadOneofValue = true + if case .objectValue(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.value = .objectValue(v) + } + }() + default: break + } + } + } + + func traverse(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.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 1) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 2) + } + switch self.value { + case .boolValue?: try { + guard case .boolValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + }() + case .stringValue?: try { + guard case .stringValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + }() + case .doubleValue?: try { + guard case .doubleValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularDoubleField(value: v, fieldNumber: 5) + }() + case .objectValue?: try { + guard case .objectValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_AnyFlag, rhs: Flagd_Evaluation_V1_AnyFlag) -> Bool { + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveBooleanRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveBooleanRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flag_key"), + 2: .same(proto: "context"), + ] + + mutating func decodeMessage(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.flagKey) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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.flagKey.isEmpty { + try visitor.visitSingularStringField(value: self.flagKey, fieldNumber: 1) + } + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveBooleanRequest, rhs: Flagd_Evaluation_V1_ResolveBooleanRequest) -> Bool { + if lhs.flagKey != rhs.flagKey {return false} + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveBooleanResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveBooleanResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "reason"), + 3: .same(proto: "variant"), + 4: .same(proto: "metadata"), + ] + + mutating func decodeMessage(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.decodeSingularBoolField(value: &self.value) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + default: break + } + } + } + + func traverse(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.value != false { + try visitor.visitSingularBoolField(value: self.value, fieldNumber: 1) + } + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 3) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveBooleanResponse, rhs: Flagd_Evaluation_V1_ResolveBooleanResponse) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveStringRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveStringRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flag_key"), + 2: .same(proto: "context"), + ] + + mutating func decodeMessage(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.flagKey) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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.flagKey.isEmpty { + try visitor.visitSingularStringField(value: self.flagKey, fieldNumber: 1) + } + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveStringRequest, rhs: Flagd_Evaluation_V1_ResolveStringRequest) -> Bool { + if lhs.flagKey != rhs.flagKey {return false} + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveStringResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveStringResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "reason"), + 3: .same(proto: "variant"), + 4: .same(proto: "metadata"), + ] + + mutating func decodeMessage(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.value) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + default: break + } + } + } + + func traverse(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.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 1) + } + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 3) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveStringResponse, rhs: Flagd_Evaluation_V1_ResolveStringResponse) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveFloatRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveFloatRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flag_key"), + 2: .same(proto: "context"), + ] + + mutating func decodeMessage(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.flagKey) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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.flagKey.isEmpty { + try visitor.visitSingularStringField(value: self.flagKey, fieldNumber: 1) + } + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveFloatRequest, rhs: Flagd_Evaluation_V1_ResolveFloatRequest) -> Bool { + if lhs.flagKey != rhs.flagKey {return false} + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveFloatResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveFloatResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "reason"), + 3: .same(proto: "variant"), + 4: .same(proto: "metadata"), + ] + + mutating func decodeMessage(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.decodeSingularDoubleField(value: &self.value) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + default: break + } + } + } + + func traverse(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.value.bitPattern != 0 { + try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 1) + } + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 3) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveFloatResponse, rhs: Flagd_Evaluation_V1_ResolveFloatResponse) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveIntRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveIntRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flag_key"), + 2: .same(proto: "context"), + ] + + mutating func decodeMessage(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.flagKey) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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.flagKey.isEmpty { + try visitor.visitSingularStringField(value: self.flagKey, fieldNumber: 1) + } + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveIntRequest, rhs: Flagd_Evaluation_V1_ResolveIntRequest) -> Bool { + if lhs.flagKey != rhs.flagKey {return false} + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveIntResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveIntResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "reason"), + 3: .same(proto: "variant"), + 4: .same(proto: "metadata"), + ] + + mutating func decodeMessage(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.decodeSingularInt64Field(value: &self.value) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + default: break + } + } + } + + func traverse(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.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 1) + } + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 3) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveIntResponse, rhs: Flagd_Evaluation_V1_ResolveIntResponse) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveObjectRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveObjectRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "flag_key"), + 2: .same(proto: "context"), + ] + + mutating func decodeMessage(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.flagKey) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._context) }() + default: break + } + } + } + + func traverse(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.flagKey.isEmpty { + try visitor.visitSingularStringField(value: self.flagKey, fieldNumber: 1) + } + try { if let v = self._context { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveObjectRequest, rhs: Flagd_Evaluation_V1_ResolveObjectRequest) -> Bool { + if lhs.flagKey != rhs.flagKey {return false} + if lhs._context != rhs._context {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_ResolveObjectResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResolveObjectResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .same(proto: "reason"), + 3: .same(proto: "variant"), + 4: .same(proto: "metadata"), + ] + + mutating func decodeMessage(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.decodeSingularMessageField(value: &self._value) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.variant) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + default: break + } + } + } + + func traverse(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 + try { if let v = self._value { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } + if !self.variant.isEmpty { + try visitor.visitSingularStringField(value: self.variant, fieldNumber: 3) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_ResolveObjectResponse, rhs: Flagd_Evaluation_V1_ResolveObjectResponse) -> Bool { + if lhs._value != rhs._value {return false} + if lhs.reason != rhs.reason {return false} + if lhs.variant != rhs.variant {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_EventStreamResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EventStreamResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "data"), + ] + + mutating func decodeMessage(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.type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._data) }() + default: break + } + } + } + + func traverse(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.type.isEmpty { + try visitor.visitSingularStringField(value: self.type, fieldNumber: 1) + } + try { if let v = self._data { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_EventStreamResponse, rhs: Flagd_Evaluation_V1_EventStreamResponse) -> Bool { + if lhs.type != rhs.type {return false} + if lhs._data != rhs._data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Flagd_Evaluation_V1_EventStreamRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EventStreamRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Flagd_Evaluation_V1_EventStreamRequest, rhs: Flagd_Evaluation_V1_EventStreamRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/flagd-schemas b/flagd-schemas new file mode 160000 index 0000000..76d611f --- /dev/null +++ b/flagd-schemas @@ -0,0 +1 @@ +Subproject commit 76d611fd94689d906af316105ac12670d40f7648