diff --git a/.github/workflows/soundness.yaml b/.github/workflows/soundness.yaml index 3789c31..4bcfb21 100644 --- a/.github/workflows/soundness.yaml +++ b/.github/workflows/soundness.yaml @@ -40,3 +40,15 @@ jobs: SWIFTLY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run format check run: ./scripts/check-swift-format.sh + + broken-symlinks-check: + name: Broken symlinks check + runs-on: ubuntu-latest + timeout-minutes: 1 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Run broken symlinks check + run: ./scripts/check-broken-symlinks.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..73c53fe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "protocol"] + path = protocol + url = https://github.com/open-feature/protocol diff --git a/.licenseignore b/.licenseignore index adbc119..606e6ce 100644 --- a/.licenseignore +++ b/.licenseignore @@ -1,9 +1,14 @@ .gitignore .licenseignore .unacceptablelanguageignore +.swiftformatignore .swift-format .editorconfig *.md *.txt *.yaml Package.swift +.gitmodules +protocol/ +Makefile +*/Generated/** diff --git a/.swiftformatignore b/.swiftformatignore new file mode 100644 index 0000000..1a7a1f8 --- /dev/null +++ b/.swiftformatignore @@ -0,0 +1 @@ +Sources/OFREP/Generated diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f67c744 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# Code generation +# ----------------------------------------------------------------------------- +OPENAPI_SPEC = protocol/service/openapi.yaml +OPENAPI_GEN_SWIFT = .build/debug/swift-openapi-generator +GEN_SWIFT_ROOT = Sources/OFREP/Generated +GEN_SWIFTS = $(GEN_SWIFT_ROOT)/Types.swift,$(GEN_SWIFT_ROOT)/Client.swift + +$(OPENAPI_GEN_SWIFT): + swift build --product swift-openapi-generator + +$(GEN_SWIFTS): $(OPENAPI_SPEC) $(OPENAPI_GEN_SWIFT) + @mkdir -pv $(GEN_SWIFT_ROOT) + $(OPENAPI_GEN_SWIFT) generate \ + $(OPENAPI_SPEC) \ + --mode types \ + --mode client \ + --output-directory $(GEN_SWIFT_ROOT) + +.PHONY: generate +generate: $(GEN_SWIFTS) diff --git a/Package.swift b/Package.swift index 7cd53f3..972c68f 100644 --- a/Package.swift +++ b/Package.swift @@ -13,13 +13,16 @@ let package = Package( .library(name: "OFREP", targets: ["OFREP"]) ], 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/apple/swift-openapi-generator.git", from: "1.0.0"), + .package(url: "https://github.com/apple/swift-openapi-runtime.git", from: "1.0.0"), ], targets: [ .target( name: "OFREP", dependencies: [ .product(name: "OpenFeature", package: "swift-open-feature"), + .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"), ] ), .testTarget( diff --git a/Sources/OFREP/Generated/Client.swift b/Sources/OFREP/Generated/Client.swift new file mode 100644 index 0000000..c2d3d24 --- /dev/null +++ b/Sources/OFREP/Generated/Client.swift @@ -0,0 +1,445 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +import struct Foundation.Data +import struct Foundation.Date +#endif +import HTTPTypes +/// OFREP define the protocol for remote flag evaluations +internal struct Client: APIProtocol { + /// The underlying HTTP client. + private let client: UniversalClient + /// Creates a new client. + /// - Parameters: + /// - serverURL: The server URL that the client connects to. Any server + /// URLs defined in the OpenAPI document are available as static methods + /// on the ``Servers`` type. + /// - configuration: A set of configuration values for the client. + /// - transport: A transport that performs HTTP operations. + /// - middlewares: A list of middlewares to call before the transport. + internal init( + serverURL: Foundation.URL, + configuration: Configuration = .init(), + transport: any ClientTransport, + middlewares: [any ClientMiddleware] = [] + ) { + self.client = .init( + serverURL: serverURL, + configuration: configuration, + transport: transport, + middlewares: middlewares + ) + } + private var converter: Converter { + client.converter + } + /// OFREP single flag evaluation contract + /// + /// OFREP single flag evaluation request. + /// The endpoint is called by the server providers to perform single flag evaluation. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags/{key}`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post`. + internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output { + try await client.send( + input: input, + forOperation: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ofrep/v1/evaluate/flags/{}", + parameters: [ + input.path.key + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case .none: + body = nil + case let .json(value): + body = try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.evaluationSuccess.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.evaluationFailure.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .badRequest(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.flagNotFound.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 401: + return .unauthorized(.init()) + case 403: + return .forbidden(.init()) + case 429: + let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests.Headers = .init(Retry_hyphen_After: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "Retry-After", + as: Foundation.Date.self + )) + return .tooManyRequests(.init(headers: headers)) + case 500: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.generalErrorResponse.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .internalServerError(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// OFREP bulk flag evaluation contract + /// + /// OFREP bulk evaluation request. + /// The endpoint is called by the client providers to evaluate all flags at once. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post`. + internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output { + try await client.send( + input: input, + forOperation: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ofrep/v1/evaluate/flags", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "If-None-Match", + value: input.headers.If_hyphen_None_hyphen_Match + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case .none: + body = nil + case let .json(value): + body = try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Headers = .init(ETag: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "ETag", + as: Swift.String.self + )) + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.bulkEvaluationSuccess.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init( + headers: headers, + body: body + )) + case 304: + return .notModified(.init()) + case 400: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.bulkEvaluationFailure.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .badRequest(.init(body: body)) + case 401: + return .unauthorized(.init()) + case 403: + return .forbidden(.init()) + case 429: + let headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests.Headers = .init(Retry_hyphen_After: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "Retry-After", + as: Foundation.Date.self + )) + return .tooManyRequests(.init(headers: headers)) + case 500: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.generalErrorResponse.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .internalServerError(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// OFREP provider configuration + /// + /// OFREP configuration is used to supply information about the remote flag management system and to set up the OpenFeature SDK providers. + /// The providers will contact this endpoint only if the client has opted in. + /// + /// + /// - Remark: HTTP `GET /ofrep/v1/configuration`. + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get`. + internal func get_sol_ofrep_sol_v1_sol_configuration(_ input: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input) async throws -> Operations.get_sol_ofrep_sol_v1_sol_configuration.Output { + try await client.send( + input: input, + forOperation: Operations.get_sol_ofrep_sol_v1_sol_configuration.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ofrep/v1/configuration", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "If-None-Match", + value: input.headers.If_hyphen_None_hyphen_Match + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Headers = .init(ETag: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "ETag", + as: Swift.String.self + )) + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.configurationResponse.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init( + headers: headers, + body: body + )) + case 304: + return .notModified(.init()) + case 401: + return .unauthorized(.init()) + case 403: + return .forbidden(.init()) + case 500: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.generalErrorResponse.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .internalServerError(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } +} diff --git a/Sources/OFREP/Generated/Types.swift b/Sources/OFREP/Generated/Types.swift new file mode 100644 index 0000000..373bf97 --- /dev/null +++ b/Sources/OFREP/Generated/Types.swift @@ -0,0 +1,1947 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +import struct Foundation.Data +import struct Foundation.Date +#endif +/// A type that performs HTTP operations defined by the OpenAPI document. +internal protocol APIProtocol: Sendable { + /// OFREP single flag evaluation contract + /// + /// OFREP single flag evaluation request. + /// The endpoint is called by the server providers to perform single flag evaluation. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags/{key}`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post`. + func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output + /// OFREP bulk flag evaluation contract + /// + /// OFREP bulk evaluation request. + /// The endpoint is called by the client providers to evaluate all flags at once. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post`. + func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags(_ input: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output + /// OFREP provider configuration + /// + /// OFREP configuration is used to supply information about the remote flag management system and to set up the OpenFeature SDK providers. + /// The providers will contact this endpoint only if the client has opted in. + /// + /// + /// - Remark: HTTP `GET /ofrep/v1/configuration`. + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get`. + func get_sol_ofrep_sol_v1_sol_configuration(_ input: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input) async throws -> Operations.get_sol_ofrep_sol_v1_sol_configuration.Output +} + +/// Convenience overloads for operation inputs. +extension APIProtocol { + /// OFREP single flag evaluation contract + /// + /// OFREP single flag evaluation request. + /// The endpoint is called by the server providers to perform single flag evaluation. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags/{key}`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post`. + internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_( + path: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Path, + headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Headers = .init(), + body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Body? = nil + ) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output { + try await post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input( + path: path, + headers: headers, + body: body + )) + } + /// OFREP bulk flag evaluation contract + /// + /// OFREP bulk evaluation request. + /// The endpoint is called by the client providers to evaluate all flags at once. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post`. + internal func post_sol_ofrep_sol_v1_sol_evaluate_sol_flags( + headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Headers = .init(), + body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Body? = nil + ) async throws -> Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output { + try await post_sol_ofrep_sol_v1_sol_evaluate_sol_flags(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input( + headers: headers, + body: body + )) + } + /// OFREP provider configuration + /// + /// OFREP configuration is used to supply information about the remote flag management system and to set up the OpenFeature SDK providers. + /// The providers will contact this endpoint only if the client has opted in. + /// + /// + /// - Remark: HTTP `GET /ofrep/v1/configuration`. + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get`. + internal func get_sol_ofrep_sol_v1_sol_configuration(headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input.Headers = .init()) async throws -> Operations.get_sol_ofrep_sol_v1_sol_configuration.Output { + try await get_sol_ofrep_sol_v1_sol_configuration(Operations.get_sol_ofrep_sol_v1_sol_configuration.Input(headers: headers)) + } +} + +/// Server URLs defined in the OpenAPI document. +internal enum Servers { + internal enum Server1 { + internal static func url() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "/", + variables: [] + ) + } + } + @available(*, deprecated, renamed: "Servers.Server1.url") + internal static func server1() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "/", + variables: [] + ) + } +} + +/// Types generated from the components section of the OpenAPI document. +internal enum Components { + /// Types generated from the `#/components/schemas` section of the OpenAPI document. + internal enum Schemas { + /// Evaluate multiple flags in one request + /// + /// - Remark: Generated from `#/components/schemas/bulkEvaluationRequest`. + internal struct bulkEvaluationRequest: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/bulkEvaluationRequest/context`. + internal var context: Components.Schemas.context? + /// Creates a new `bulkEvaluationRequest`. + /// + /// - Parameters: + /// - context: + internal init(context: Components.Schemas.context? = nil) { + self.context = context + } + internal enum CodingKeys: String, CodingKey { + case context + } + } + /// Success response for the bulk evaluation request + /// + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess`. + internal struct bulkEvaluationSuccess: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess/flagsPayload`. + internal enum flagsPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess/flagsPayload/case1`. + case evaluationSuccess(Components.Schemas.evaluationSuccess) + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess/flagsPayload/case2`. + case evaluationFailure(Components.Schemas.evaluationFailure) + internal init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self = .evaluationSuccess(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .evaluationFailure(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + internal func encode(to encoder: any Encoder) throws { + switch self { + case let .evaluationSuccess(value): + try value.encode(to: encoder) + case let .evaluationFailure(value): + try value.encode(to: encoder) + } + } + } + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess/flags`. + internal typealias flagsPayload = [Components.Schemas.bulkEvaluationSuccess.flagsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/bulkEvaluationSuccess/flags`. + internal var flags: Components.Schemas.bulkEvaluationSuccess.flagsPayload + /// Creates a new `bulkEvaluationSuccess`. + /// + /// - Parameters: + /// - flags: + internal init(flags: Components.Schemas.bulkEvaluationSuccess.flagsPayload) { + self.flags = flags + } + internal enum CodingKeys: String, CodingKey { + case flags + } + } + /// Bulk evaluation failure response + /// + /// - Remark: Generated from `#/components/schemas/bulkEvaluationFailure`. + internal struct bulkEvaluationFailure: Codable, Hashable, Sendable { + /// An appropriate code specific to the bulk evaluation error. See https://openfeature.dev/specification/types#error-code + /// + /// - Remark: Generated from `#/components/schemas/bulkEvaluationFailure/errorCode`. + internal var errorCode: Swift.String + /// Optional error details description for logging or other needs + /// + /// - Remark: Generated from `#/components/schemas/bulkEvaluationFailure/errorDetails`. + internal var errorDetails: Swift.String? + /// Creates a new `bulkEvaluationFailure`. + /// + /// - Parameters: + /// - errorCode: An appropriate code specific to the bulk evaluation error. See https://openfeature.dev/specification/types#error-code + /// - errorDetails: Optional error details description for logging or other needs + internal init( + errorCode: Swift.String, + errorDetails: Swift.String? = nil + ) { + self.errorCode = errorCode + self.errorDetails = errorDetails + } + internal enum CodingKeys: String, CodingKey { + case errorCode + case errorDetails + } + } + /// Flag evaluation request + /// + /// - Remark: Generated from `#/components/schemas/evaluationRequest`. + internal struct evaluationRequest: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationRequest/context`. + internal var context: Components.Schemas.context? + /// Creates a new `evaluationRequest`. + /// + /// - Parameters: + /// - context: + internal init(context: Components.Schemas.context? = nil) { + self.context = context + } + internal enum CodingKeys: String, CodingKey { + case context + } + } + /// Flag evaluation success response. + /// + /// - Remark: Generated from `#/components/schemas/evaluationSuccess`. + internal struct evaluationSuccess: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1`. + internal struct Value1Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/key`. + internal var key: Components.Schemas.key? + /// An OpenFeature reason for the evaluation + /// + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/reason`. + internal var reason: Swift.String? + /// Variant of the evaluated flag value + /// + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/variant`. + internal var variant: Swift.String? + /// Arbitrary metadata supporting flag evaluation + /// + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata`. + internal struct metadataPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata/additionalProperties`. + internal enum additionalPropertiesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata/additionalProperties/case1`. + case case1(Swift.Bool) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata/additionalProperties/case2`. + case case2(Swift.String) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata/additionalProperties/case3`. + case case3(Swift.Double) + internal init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self = .case1(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case2(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case3(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + internal func encode(to encoder: any Encoder) throws { + switch self { + case let .case1(value): + try encoder.encodeToSingleValueContainer(value) + case let .case2(value): + try encoder.encodeToSingleValueContainer(value) + case let .case3(value): + try encoder.encodeToSingleValueContainer(value) + } + } + } + /// A container of undocumented properties. + internal var additionalProperties: [String: Components.Schemas.evaluationSuccess.Value1Payload.metadataPayload.additionalPropertiesPayload] + /// Creates a new `metadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + internal init(additionalProperties: [String: Components.Schemas.evaluationSuccess.Value1Payload.metadataPayload.additionalPropertiesPayload] = .init()) { + self.additionalProperties = additionalProperties + } + internal init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + internal func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Arbitrary metadata supporting flag evaluation + /// + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1/metadata`. + internal var metadata: Components.Schemas.evaluationSuccess.Value1Payload.metadataPayload? + /// Creates a new `Value1Payload`. + /// + /// - Parameters: + /// - key: + /// - reason: An OpenFeature reason for the evaluation + /// - variant: Variant of the evaluated flag value + /// - metadata: Arbitrary metadata supporting flag evaluation + internal init( + key: Components.Schemas.key? = nil, + reason: Swift.String? = nil, + variant: Swift.String? = nil, + metadata: Components.Schemas.evaluationSuccess.Value1Payload.metadataPayload? = nil + ) { + self.key = key + self.reason = reason + self.variant = variant + self.metadata = metadata + } + internal enum CodingKeys: String, CodingKey { + case key + case reason + case variant + case metadata + } + } + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value1`. + internal var value1: Components.Schemas.evaluationSuccess.Value1Payload + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2`. + internal enum Value2Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2/case1`. + case booleanFlag(Components.Schemas.booleanFlag) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2/case2`. + case stringFlag(Components.Schemas.stringFlag) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2/case3`. + case integerFlag(Components.Schemas.integerFlag) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2/case4`. + case floatFlag(Components.Schemas.floatFlag) + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2/case5`. + case objectFlag(Components.Schemas.objectFlag) + internal init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self = .booleanFlag(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .stringFlag(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .integerFlag(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .floatFlag(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .objectFlag(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + internal func encode(to encoder: any Encoder) throws { + switch self { + case let .booleanFlag(value): + try value.encode(to: encoder) + case let .stringFlag(value): + try value.encode(to: encoder) + case let .integerFlag(value): + try value.encode(to: encoder) + case let .floatFlag(value): + try value.encode(to: encoder) + case let .objectFlag(value): + try value.encode(to: encoder) + } + } + } + /// - Remark: Generated from `#/components/schemas/evaluationSuccess/value2`. + internal var value2: Components.Schemas.evaluationSuccess.Value2Payload + /// Creates a new `evaluationSuccess`. + /// + /// - Parameters: + /// - value1: + /// - value2: + internal init( + value1: Components.Schemas.evaluationSuccess.Value1Payload, + value2: Components.Schemas.evaluationSuccess.Value2Payload + ) { + self.value1 = value1 + self.value2 = value2 + } + internal init(from decoder: any Decoder) throws { + value1 = try .init(from: decoder) + value2 = try .init(from: decoder) + } + internal func encode(to encoder: any Encoder) throws { + try value1.encode(to: encoder) + try value2.encode(to: encoder) + } + } + /// Flag evaluation failure response + /// + /// - Remark: Generated from `#/components/schemas/evaluationFailure`. + internal struct evaluationFailure: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/evaluationFailure/key`. + internal var key: Components.Schemas.key + /// OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code + /// + /// - Remark: Generated from `#/components/schemas/evaluationFailure/errorCode`. + internal enum errorCodePayload: String, Codable, Hashable, Sendable, CaseIterable { + case PARSE_ERROR = "PARSE_ERROR" + case TARGETING_KEY_MISSING = "TARGETING_KEY_MISSING" + case INVALID_CONTEXT = "INVALID_CONTEXT" + case GENERAL = "GENERAL" + } + /// OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code + /// + /// - Remark: Generated from `#/components/schemas/evaluationFailure/errorCode`. + internal var errorCode: Components.Schemas.evaluationFailure.errorCodePayload + /// - Remark: Generated from `#/components/schemas/evaluationFailure/errorDetails`. + internal var errorDetails: Components.Schemas.errorDetails? + /// Creates a new `evaluationFailure`. + /// + /// - Parameters: + /// - key: + /// - errorCode: OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code + /// - errorDetails: + internal init( + key: Components.Schemas.key, + errorCode: Components.Schemas.evaluationFailure.errorCodePayload, + errorDetails: Components.Schemas.errorDetails? = nil + ) { + self.key = key + self.errorCode = errorCode + self.errorDetails = errorDetails + } + internal enum CodingKeys: String, CodingKey { + case key + case errorCode + case errorDetails + } + } + /// Flag not found response + /// + /// - Remark: Generated from `#/components/schemas/flagNotFound`. + internal struct flagNotFound: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/flagNotFound/key`. + internal var key: Components.Schemas.key + /// - Remark: Generated from `#/components/schemas/flagNotFound/errorCode`. + internal enum errorCodePayload: String, Codable, Hashable, Sendable, CaseIterable { + case FLAG_NOT_FOUND = "FLAG_NOT_FOUND" + } + /// - Remark: Generated from `#/components/schemas/flagNotFound/errorCode`. + internal var errorCode: Components.Schemas.flagNotFound.errorCodePayload + /// - Remark: Generated from `#/components/schemas/flagNotFound/errorDetails`. + internal var errorDetails: Components.Schemas.errorDetails? + /// Creates a new `flagNotFound`. + /// + /// - Parameters: + /// - key: + /// - errorCode: + /// - errorDetails: + internal init( + key: Components.Schemas.key, + errorCode: Components.Schemas.flagNotFound.errorCodePayload, + errorDetails: Components.Schemas.errorDetails? = nil + ) { + self.key = key + self.errorCode = errorCode + self.errorDetails = errorDetails + } + internal enum CodingKeys: String, CodingKey { + case key + case errorCode + case errorDetails + } + } + /// A general error response from the service + /// + /// - Remark: Generated from `#/components/schemas/generalErrorResponse`. + internal struct generalErrorResponse: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/generalErrorResponse/errorDetails`. + internal var errorDetails: Components.Schemas.errorDetails? + /// Creates a new `generalErrorResponse`. + /// + /// - Parameters: + /// - errorDetails: + internal init(errorDetails: Components.Schemas.errorDetails? = nil) { + self.errorDetails = errorDetails + } + internal enum CodingKeys: String, CodingKey { + case errorDetails + } + } + /// Feature flag key + /// + /// - Remark: Generated from `#/components/schemas/key`. + internal typealias key = Swift.String + /// Context information for flag evaluation + /// + /// - Remark: Generated from `#/components/schemas/context`. + internal struct context: Codable, Hashable, Sendable { + /// A string logically identifying the subject of evaluation (end-user, service, etc). + /// + /// - Remark: Generated from `#/components/schemas/context/targetingKey`. + internal var targetingKey: Swift.String? + /// A container of undocumented properties. + internal var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `context`. + /// + /// - Parameters: + /// - targetingKey: A string logically identifying the subject of evaluation (end-user, service, etc). + /// - additionalProperties: A container of undocumented properties. + internal init( + targetingKey: Swift.String? = nil, + additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init() + ) { + self.targetingKey = targetingKey + self.additionalProperties = additionalProperties + } + internal enum CodingKeys: String, CodingKey { + case targetingKey + } + internal init(from decoder: any Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.targetingKey = try container.decodeIfPresent( + Swift.String.self, + forKey: .targetingKey + ) + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: [ + "targetingKey" + ]) + } + internal func encode(to encoder: any Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encodeIfPresent( + self.targetingKey, + forKey: .targetingKey + ) + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// A boolean typed flag value + /// + /// - Remark: Generated from `#/components/schemas/booleanFlag`. + internal struct booleanFlag: Codable, Hashable, Sendable { + /// Flag evaluation result + /// + /// - Remark: Generated from `#/components/schemas/booleanFlag/value`. + internal var value: Swift.Bool + /// Creates a new `booleanFlag`. + /// + /// - Parameters: + /// - value: Flag evaluation result + internal init(value: Swift.Bool) { + self.value = value + } + internal enum CodingKeys: String, CodingKey { + case value + } + } + /// A string typed flag value + /// + /// - Remark: Generated from `#/components/schemas/stringFlag`. + internal struct stringFlag: Codable, Hashable, Sendable { + /// Flag evaluation result + /// + /// - Remark: Generated from `#/components/schemas/stringFlag/value`. + internal var value: Swift.String + /// Creates a new `stringFlag`. + /// + /// - Parameters: + /// - value: Flag evaluation result + internal init(value: Swift.String) { + self.value = value + } + internal enum CodingKeys: String, CodingKey { + case value + } + } + /// An integer typed flag value + /// + /// - Remark: Generated from `#/components/schemas/integerFlag`. + internal struct integerFlag: Codable, Hashable, Sendable { + /// Flag evaluation result + /// + /// - Remark: Generated from `#/components/schemas/integerFlag/value`. + internal var value: Swift.Int + /// Creates a new `integerFlag`. + /// + /// - Parameters: + /// - value: Flag evaluation result + internal init(value: Swift.Int) { + self.value = value + } + internal enum CodingKeys: String, CodingKey { + case value + } + } + /// A float typed flag value + /// + /// - Remark: Generated from `#/components/schemas/floatFlag`. + internal struct floatFlag: Codable, Hashable, Sendable { + /// Flag evaluation result + /// + /// - Remark: Generated from `#/components/schemas/floatFlag/value`. + internal var value: Swift.Double + /// Creates a new `floatFlag`. + /// + /// - Parameters: + /// - value: Flag evaluation result + internal init(value: Swift.Double) { + self.value = value + } + internal enum CodingKeys: String, CodingKey { + case value + } + } + /// An object typed flag value + /// + /// - Remark: Generated from `#/components/schemas/objectFlag`. + internal struct objectFlag: Codable, Hashable, Sendable { + /// Flag evaluation result + /// + /// - Remark: Generated from `#/components/schemas/objectFlag/value`. + internal var value: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `objectFlag`. + /// + /// - Parameters: + /// - value: Flag evaluation result + internal init(value: OpenAPIRuntime.OpenAPIObjectContainer) { + self.value = value + } + internal enum CodingKeys: String, CodingKey { + case value + } + } + /// An error description for logging or other needs + /// + /// - Remark: Generated from `#/components/schemas/errorDetails`. + internal typealias errorDetails = Swift.String + /// OFREP metadata response + /// + /// - Remark: Generated from `#/components/schemas/configurationResponse`. + internal struct configurationResponse: Codable, Hashable, Sendable { + /// name of the flag management system + /// + /// - Remark: Generated from `#/components/schemas/configurationResponse/name`. + internal var name: Swift.String? + /// Capabilities of the flag management system and how to configure them in the provider. + /// + /// - Remark: Generated from `#/components/schemas/configurationResponse/capabilities`. + internal struct capabilitiesPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/configurationResponse/capabilities/cacheInvalidation`. + internal var cacheInvalidation: Components.Schemas.featureCacheInvalidation? + /// - Remark: Generated from `#/components/schemas/configurationResponse/capabilities/flagEvaluation`. + internal var flagEvaluation: Components.Schemas.flagEvaluation? + /// Creates a new `capabilitiesPayload`. + /// + /// - Parameters: + /// - cacheInvalidation: + /// - flagEvaluation: + internal init( + cacheInvalidation: Components.Schemas.featureCacheInvalidation? = nil, + flagEvaluation: Components.Schemas.flagEvaluation? = nil + ) { + self.cacheInvalidation = cacheInvalidation + self.flagEvaluation = flagEvaluation + } + internal enum CodingKeys: String, CodingKey { + case cacheInvalidation + case flagEvaluation + } + } + /// Capabilities of the flag management system and how to configure them in the provider. + /// + /// - Remark: Generated from `#/components/schemas/configurationResponse/capabilities`. + internal var capabilities: Components.Schemas.configurationResponse.capabilitiesPayload? + /// Creates a new `configurationResponse`. + /// + /// - Parameters: + /// - name: name of the flag management system + /// - capabilities: Capabilities of the flag management system and how to configure them in the provider. + internal init( + name: Swift.String? = nil, + capabilities: Components.Schemas.configurationResponse.capabilitiesPayload? = nil + ) { + self.name = name + self.capabilities = capabilities + } + internal enum CodingKeys: String, CodingKey { + case name + case capabilities + } + } + /// Configurations specific for flag evaluations in OFREP provider implementation + /// + /// - Remark: Generated from `#/components/schemas/flagEvaluation`. + internal struct flagEvaluation: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/flagEvaluation/supportedTypesPayload`. + internal enum supportedTypesPayloadPayload: String, Codable, Hashable, Sendable, CaseIterable { + case int = "int" + case float = "float" + case string = "string" + case boolean = "boolean" + case object = "object" + } + /// Evaluating a flag of unlisted type through the OFREP provider will result in an error and yield the default value. + /// However, when supportedTypes is undefined/empty, provider assumes that all flag evaluation types are supported by the flag management system + /// + /// + /// - Remark: Generated from `#/components/schemas/flagEvaluation/supportedTypes`. + internal typealias supportedTypesPayload = [Components.Schemas.flagEvaluation.supportedTypesPayloadPayload] + /// Evaluating a flag of unlisted type through the OFREP provider will result in an error and yield the default value. + /// However, when supportedTypes is undefined/empty, provider assumes that all flag evaluation types are supported by the flag management system + /// + /// + /// - Remark: Generated from `#/components/schemas/flagEvaluation/supportedTypes`. + internal var supportedTypes: Components.Schemas.flagEvaluation.supportedTypesPayload? + /// Creates a new `flagEvaluation`. + /// + /// - Parameters: + /// - supportedTypes: Evaluating a flag of unlisted type through the OFREP provider will result in an error and yield the default value. + internal init(supportedTypes: Components.Schemas.flagEvaluation.supportedTypesPayload? = nil) { + self.supportedTypes = supportedTypes + } + internal enum CodingKeys: String, CodingKey { + case supportedTypes + } + } + /// Configuration for the cache cacheInvalidation + /// + /// - Remark: Generated from `#/components/schemas/featureCacheInvalidation`. + internal struct featureCacheInvalidation: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/featureCacheInvalidation/polling`. + internal var polling: Components.Schemas.featureCacheInvalidationPolling? + /// Creates a new `featureCacheInvalidation`. + /// + /// - Parameters: + /// - polling: + internal init(polling: Components.Schemas.featureCacheInvalidationPolling? = nil) { + self.polling = polling + } + internal enum CodingKeys: String, CodingKey { + case polling + } + } + /// Configuration of the polling for the featureCacheInvalidation + /// + /// - Remark: Generated from `#/components/schemas/featureCacheInvalidationPolling`. + internal struct featureCacheInvalidationPolling: Codable, Hashable, Sendable { + /// set to true if the remote flag management system is supporting polling + /// + /// - Remark: Generated from `#/components/schemas/featureCacheInvalidationPolling/enabled`. + internal var enabled: Swift.Bool? + /// Minimum polling interval (in millisecond) supported by the flag management system. + /// The provider should ensure not to set any polling value under this minimum. + /// + /// + /// - Remark: Generated from `#/components/schemas/featureCacheInvalidationPolling/minPollingIntervalMs`. + internal var minPollingIntervalMs: Swift.Double? + /// Creates a new `featureCacheInvalidationPolling`. + /// + /// - Parameters: + /// - enabled: set to true if the remote flag management system is supporting polling + /// - minPollingIntervalMs: Minimum polling interval (in millisecond) supported by the flag management system. + internal init( + enabled: Swift.Bool? = nil, + minPollingIntervalMs: Swift.Double? = nil + ) { + self.enabled = enabled + self.minPollingIntervalMs = minPollingIntervalMs + } + internal enum CodingKeys: String, CodingKey { + case enabled + case minPollingIntervalMs + } + } + } + /// Types generated from the `#/components/parameters` section of the OpenAPI document. + internal enum Parameters {} + /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. + internal enum RequestBodies {} + /// Types generated from the `#/components/responses` section of the OpenAPI document. + internal enum Responses {} + /// Types generated from the `#/components/headers` section of the OpenAPI document. + internal enum Headers {} +} + +/// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. +internal enum Operations { + /// OFREP single flag evaluation contract + /// + /// OFREP single flag evaluation request. + /// The endpoint is called by the server providers to perform single flag evaluation. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags/{key}`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post`. + internal enum post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_ { + internal static let id: Swift.String = "post/ofrep/v1/evaluate/flags/{key}" + internal struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/path`. + internal struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/path/key`. + internal var key: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - key: + internal init(key: Swift.String) { + self.key = key + } + } + internal var path: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Path + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/header`. + internal struct Headers: Sendable, Hashable { + internal var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + internal init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + internal var headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Headers + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/requestBody`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/requestBody/content/application\/json`. + case json(Components.Schemas.evaluationRequest) + } + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Body? + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + internal init( + path: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Path, + headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Headers = .init(), + body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Input.Body? = nil + ) { + self.path = path + self.headers = headers + self.body = body + } + } + internal enum Output: Sendable, Hashable { + internal struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/200/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/200/content/application\/json`. + case json(Components.Schemas.evaluationSuccess) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.evaluationSuccess { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok.Body) { + self.body = body + } + } + /// OFREP successful evaluation response + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + internal var ok: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + internal struct BadRequest: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/400/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/400/content/application\/json`. + case json(Components.Schemas.evaluationFailure) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.evaluationFailure { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest.Body + /// Creates a new `BadRequest`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest.Body) { + self.body = body + } + } + /// Bad evaluation request + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + internal var badRequest: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + internal struct NotFound: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/404/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/404/content/application\/json`. + case json(Components.Schemas.flagNotFound) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.flagNotFound { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound.Body + /// Creates a new `NotFound`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound.Body) { + self.body = body + } + } + /// Flag not found + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + internal var notFound: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + internal struct Unauthorized: Sendable, Hashable { + /// Creates a new `Unauthorized`. + internal init() {} + } + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + case unauthorized(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Unauthorized) + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + internal static var unauthorized: Self { + .unauthorized(.init()) + } + /// The associated value of the enum case if `self` is `.unauthorized`. + /// + /// - Throws: An error if `self` is not `.unauthorized`. + /// - SeeAlso: `.unauthorized`. + internal var unauthorized: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Unauthorized { + get throws { + switch self { + case let .unauthorized(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unauthorized", + response: self + ) + } + } + } + internal struct Forbidden: Sendable, Hashable { + /// Creates a new `Forbidden`. + internal init() {} + } + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Forbidden) + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + internal static var forbidden: Self { + .forbidden(.init()) + } + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + internal var forbidden: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + internal struct TooManyRequests: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/429/headers`. + internal struct Headers: Sendable, Hashable { + /// Indicates when to retry the request again + /// + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/429/headers/Retry-After`. + internal var Retry_hyphen_After: Foundation.Date? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Retry_hyphen_After: Indicates when to retry the request again + internal init(Retry_hyphen_After: Foundation.Date? = nil) { + self.Retry_hyphen_After = Retry_hyphen_After + } + } + /// Received HTTP response headers + internal var headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests.Headers + /// Creates a new `TooManyRequests`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + internal init(headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests.Headers = .init()) { + self.headers = headers + } + } + /// Rate limit reached on the Flag Management System + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/429`. + /// + /// HTTP response code: `429 tooManyRequests`. + case tooManyRequests(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests) + /// The associated value of the enum case if `self` is `.tooManyRequests`. + /// + /// - Throws: An error if `self` is not `.tooManyRequests`. + /// - SeeAlso: `.tooManyRequests`. + internal var tooManyRequests: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.TooManyRequests { + get throws { + switch self { + case let .tooManyRequests(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "tooManyRequests", + response: self + ) + } + } + } + internal struct InternalServerError: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/500/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/{key}/POST/responses/500/content/application\/json`. + case json(Components.Schemas.generalErrorResponse) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.generalErrorResponse { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError.Body + /// Creates a new `InternalServerError`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError.Body) { + self.body = body + } + } + /// Internal server error + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/{key}/post/responses/500`. + /// + /// HTTP response code: `500 internalServerError`. + case internalServerError(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError) + /// The associated value of the enum case if `self` is `.internalServerError`. + /// + /// - Throws: An error if `self` is not `.internalServerError`. + /// - SeeAlso: `.internalServerError`. + internal var internalServerError: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags_sol__lcub_key_rcub_.Output.InternalServerError { + get throws { + switch self { + case let .internalServerError(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "internalServerError", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + internal enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + internal init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + internal var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + internal static var allCases: [Self] { + [ + .json + ] + } + } + } + /// OFREP bulk flag evaluation contract + /// + /// OFREP bulk evaluation request. + /// The endpoint is called by the client providers to evaluate all flags at once. + /// + /// + /// - Remark: HTTP `POST /ofrep/v1/evaluate/flags`. + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post`. + internal enum post_sol_ofrep_sol_v1_sol_evaluate_sol_flags { + internal static let id: Swift.String = "post/ofrep/v1/evaluate/flags" + internal struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/header`. + internal struct Headers: Sendable, Hashable { + /// The request will be processed only if ETag doesn't match any of the values listed. + /// + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/header/If-None-Match`. + internal var If_hyphen_None_hyphen_Match: Swift.String? + internal var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - If_hyphen_None_hyphen_Match: The request will be processed only if ETag doesn't match any of the values listed. + /// - accept: + internal init( + If_hyphen_None_hyphen_Match: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues() + ) { + self.If_hyphen_None_hyphen_Match = If_hyphen_None_hyphen_Match + self.accept = accept + } + } + internal var headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Headers + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/requestBody`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/requestBody/content/application\/json`. + case json(Components.Schemas.bulkEvaluationRequest) + } + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Body? + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + /// - body: + internal init( + headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Headers = .init(), + body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Input.Body? = nil + ) { + self.headers = headers + self.body = body + } + } + internal enum Output: Sendable, Hashable { + internal struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/200/headers`. + internal struct Headers: Sendable, Hashable { + /// Entity tag used for cache validation + /// + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/200/headers/ETag`. + internal var ETag: Swift.String? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - ETag: Entity tag used for cache validation + internal init(ETag: Swift.String? = nil) { + self.ETag = ETag + } + } + /// Received HTTP response headers + internal var headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Headers + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/200/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/200/content/application\/json`. + case json(Components.Schemas.bulkEvaluationSuccess) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.bulkEvaluationSuccess { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + /// - body: Received HTTP response body + internal init( + headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Headers = .init(), + body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok.Body + ) { + self.headers = headers + self.body = body + } + } + /// OFREP successful evaluation response + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + internal var ok: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + internal struct NotModified: Sendable, Hashable { + /// Creates a new `NotModified`. + internal init() {} + } + /// Bulk evaluation is not modified + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/304`. + /// + /// HTTP response code: `304 notModified`. + case notModified(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.NotModified) + /// Bulk evaluation is not modified + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/304`. + /// + /// HTTP response code: `304 notModified`. + internal static var notModified: Self { + .notModified(.init()) + } + /// The associated value of the enum case if `self` is `.notModified`. + /// + /// - Throws: An error if `self` is not `.notModified`. + /// - SeeAlso: `.notModified`. + internal var notModified: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.NotModified { + get throws { + switch self { + case let .notModified(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notModified", + response: self + ) + } + } + } + internal struct BadRequest: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/400/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/400/content/application\/json`. + case json(Components.Schemas.bulkEvaluationFailure) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.bulkEvaluationFailure { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest.Body + /// Creates a new `BadRequest`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest.Body) { + self.body = body + } + } + /// Bad evaluation request + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + internal var badRequest: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + internal struct Unauthorized: Sendable, Hashable { + /// Creates a new `Unauthorized`. + internal init() {} + } + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + case unauthorized(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Unauthorized) + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + internal static var unauthorized: Self { + .unauthorized(.init()) + } + /// The associated value of the enum case if `self` is `.unauthorized`. + /// + /// - Throws: An error if `self` is not `.unauthorized`. + /// - SeeAlso: `.unauthorized`. + internal var unauthorized: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Unauthorized { + get throws { + switch self { + case let .unauthorized(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unauthorized", + response: self + ) + } + } + } + internal struct Forbidden: Sendable, Hashable { + /// Creates a new `Forbidden`. + internal init() {} + } + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Forbidden) + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + internal static var forbidden: Self { + .forbidden(.init()) + } + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + internal var forbidden: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + internal struct TooManyRequests: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/429/headers`. + internal struct Headers: Sendable, Hashable { + /// Indicates when to retry the request again + /// + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/429/headers/Retry-After`. + internal var Retry_hyphen_After: Foundation.Date? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Retry_hyphen_After: Indicates when to retry the request again + internal init(Retry_hyphen_After: Foundation.Date? = nil) { + self.Retry_hyphen_After = Retry_hyphen_After + } + } + /// Received HTTP response headers + internal var headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests.Headers + /// Creates a new `TooManyRequests`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + internal init(headers: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests.Headers = .init()) { + self.headers = headers + } + } + /// Rate limit reached on the Flag Management System + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/429`. + /// + /// HTTP response code: `429 tooManyRequests`. + case tooManyRequests(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests) + /// The associated value of the enum case if `self` is `.tooManyRequests`. + /// + /// - Throws: An error if `self` is not `.tooManyRequests`. + /// - SeeAlso: `.tooManyRequests`. + internal var tooManyRequests: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.TooManyRequests { + get throws { + switch self { + case let .tooManyRequests(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "tooManyRequests", + response: self + ) + } + } + } + internal struct InternalServerError: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/500/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/evaluate/flags/POST/responses/500/content/application\/json`. + case json(Components.Schemas.generalErrorResponse) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.generalErrorResponse { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError.Body + /// Creates a new `InternalServerError`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError.Body) { + self.body = body + } + } + /// Internal server error + /// + /// - Remark: Generated from `#/paths//ofrep/v1/evaluate/flags/post/responses/500`. + /// + /// HTTP response code: `500 internalServerError`. + case internalServerError(Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError) + /// The associated value of the enum case if `self` is `.internalServerError`. + /// + /// - Throws: An error if `self` is not `.internalServerError`. + /// - SeeAlso: `.internalServerError`. + internal var internalServerError: Operations.post_sol_ofrep_sol_v1_sol_evaluate_sol_flags.Output.InternalServerError { + get throws { + switch self { + case let .internalServerError(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "internalServerError", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + internal enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + internal init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + internal var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + internal static var allCases: [Self] { + [ + .json + ] + } + } + } + /// OFREP provider configuration + /// + /// OFREP configuration is used to supply information about the remote flag management system and to set up the OpenFeature SDK providers. + /// The providers will contact this endpoint only if the client has opted in. + /// + /// + /// - Remark: HTTP `GET /ofrep/v1/configuration`. + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get`. + internal enum get_sol_ofrep_sol_v1_sol_configuration { + internal static let id: Swift.String = "get/ofrep/v1/configuration" + internal struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/header`. + internal struct Headers: Sendable, Hashable { + /// The request will be processed only if ETag doesn't match any of the values listed. + /// + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/header/If-None-Match`. + internal var If_hyphen_None_hyphen_Match: Swift.String? + internal var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - If_hyphen_None_hyphen_Match: The request will be processed only if ETag doesn't match any of the values listed. + /// - accept: + internal init( + If_hyphen_None_hyphen_Match: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues() + ) { + self.If_hyphen_None_hyphen_Match = If_hyphen_None_hyphen_Match + self.accept = accept + } + } + internal var headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + internal init(headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Input.Headers = .init()) { + self.headers = headers + } + } + internal enum Output: Sendable, Hashable { + internal struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/200/headers`. + internal struct Headers: Sendable, Hashable { + /// Entity tag used for cache validation + /// + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/200/headers/ETag`. + internal var ETag: Swift.String? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - ETag: Entity tag used for cache validation + internal init(ETag: Swift.String? = nil) { + self.ETag = ETag + } + } + /// Received HTTP response headers + internal var headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Headers + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/200/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/200/content/application\/json`. + case json(Components.Schemas.configurationResponse) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.configurationResponse { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + /// - body: Received HTTP response body + internal init( + headers: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Headers = .init(), + body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok.Body + ) { + self.headers = headers + self.body = body + } + } + /// OFREP metadata response + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + internal var ok: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + internal struct NotModified: Sendable, Hashable { + /// Creates a new `NotModified`. + internal init() {} + } + /// Flag Management System Metadata is not modified + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/304`. + /// + /// HTTP response code: `304 notModified`. + case notModified(Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.NotModified) + /// Flag Management System Metadata is not modified + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/304`. + /// + /// HTTP response code: `304 notModified`. + internal static var notModified: Self { + .notModified(.init()) + } + /// The associated value of the enum case if `self` is `.notModified`. + /// + /// - Throws: An error if `self` is not `.notModified`. + /// - SeeAlso: `.notModified`. + internal var notModified: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.NotModified { + get throws { + switch self { + case let .notModified(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notModified", + response: self + ) + } + } + } + internal struct Unauthorized: Sendable, Hashable { + /// Creates a new `Unauthorized`. + internal init() {} + } + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + case unauthorized(Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Unauthorized) + /// Unauthorized - You need credentials to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + internal static var unauthorized: Self { + .unauthorized(.init()) + } + /// The associated value of the enum case if `self` is `.unauthorized`. + /// + /// - Throws: An error if `self` is not `.unauthorized`. + /// - SeeAlso: `.unauthorized`. + internal var unauthorized: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Unauthorized { + get throws { + switch self { + case let .unauthorized(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unauthorized", + response: self + ) + } + } + } + internal struct Forbidden: Sendable, Hashable { + /// Creates a new `Forbidden`. + internal init() {} + } + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Forbidden) + /// Forbidden - You are not authorized to access the API + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + internal static var forbidden: Self { + .forbidden(.init()) + } + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + internal var forbidden: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + internal struct InternalServerError: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/500/content`. + internal enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ofrep/v1/configuration/GET/responses/500/content/application\/json`. + case json(Components.Schemas.generalErrorResponse) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + internal var json: Components.Schemas.generalErrorResponse { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + internal var body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError.Body + /// Creates a new `InternalServerError`. + /// + /// - Parameters: + /// - body: Received HTTP response body + internal init(body: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError.Body) { + self.body = body + } + } + /// Internal server error + /// + /// - Remark: Generated from `#/paths//ofrep/v1/configuration/get/responses/500`. + /// + /// HTTP response code: `500 internalServerError`. + case internalServerError(Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError) + /// The associated value of the enum case if `self` is `.internalServerError`. + /// + /// - Throws: An error if `self` is not `.internalServerError`. + /// - SeeAlso: `.internalServerError`. + internal var internalServerError: Operations.get_sol_ofrep_sol_v1_sol_configuration.Output.InternalServerError { + get throws { + switch self { + case let .internalServerError(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "internalServerError", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + internal enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + internal init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + internal var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + internal static var allCases: [Self] { + [ + .json + ] + } + } + } +} diff --git a/Tests/OFREPTests/FlagdProviderTests.swift b/Tests/OFREPTests/OFREPProviderTests.swift similarity index 100% rename from Tests/OFREPTests/FlagdProviderTests.swift rename to Tests/OFREPTests/OFREPProviderTests.swift diff --git a/protocol b/protocol new file mode 160000 index 0000000..deaec3d --- /dev/null +++ b/protocol @@ -0,0 +1 @@ +Subproject commit deaec3d57dd9089f118a88410a10f04fc8f3852b diff --git a/scripts/check-broken-symlinks.sh b/scripts/check-broken-symlinks.sh new file mode 100755 index 0000000..d042ffa --- /dev/null +++ b/scripts/check-broken-symlinks.sh @@ -0,0 +1,46 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift OpenFeature open source project +## +## Copyright (c) 2024 the Swift OpenFeature project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +##===----------------------------------------------------------------------===## +## +## This source file is part of the Swift.org open source project +## +## Copyright (c) 2024 Apple Inc. and the Swift project authors +## Licensed under Apache License v2.0 with Runtime Library Exception +## +## See https://swift.org/LICENSE.txt for license information +## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +## +##===----------------------------------------------------------------------===## + +set -euo pipefail + +log() { printf -- "** %s\n" "$*" >&2; } +error() { printf -- "** ERROR: %s\n" "$*" >&2; } +fatal() { error "$@"; exit 1; } + +log "Checking for broken symlinks..." +num_broken_symlinks=0 +while read -r -d '' file; do + if ! test -e "./${file}"; then + error "Broken symlink: ${file}" + ((num_broken_symlinks++)) + fi +done < <(git ls-files -z) + +if [ "${num_broken_symlinks}" -gt 0 ]; then + fatal "❌ Found ${num_broken_symlinks} symlinks." +fi + +log "✅ Found 0 symlinks."