mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The forge tree held the package scaffolding and none of the generated sources — 2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply absent, so anything depending on this copy had a package that compiled to nothing usable. Generated from the current API document rather than reconciled with the other copy: a client is a function of the spec, so regenerating answers "which history wins" without anyone having to choose. .spec-lock records which document, so the next reader can tell.
64 lines
2.5 KiB
Swift
64 lines
2.5 KiB
Swift
//
|
|
// CreateBody.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct CreateBody: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** ExposureEvent is the event that marks a subject as enrolled — the analysis denominator — defaulting to the SDK's $feature_flag_called marker. */
|
|
public var exposureEvent: String?
|
|
/** FlagKey names the assignment flag this experiment writes, defaulting to exp_<id>. It must be a slug. */
|
|
public var flagKey: String?
|
|
/** ID is the experiment's slug, claimed once per project. It must match [A-Za-z0-9][A-Za-z0-9._-]{0,127}. */
|
|
public var id: String
|
|
/** MetricEvent is the event that counts as a conversion — the analysis numerator. */
|
|
public var metricEvent: String
|
|
/** Name is free text for a reader; the id is what addresses the experiment. */
|
|
public var name: String?
|
|
/** SubjectKind is the unit assigned and measured: user (the default), org, session or audience. */
|
|
public var subjectKind: String?
|
|
/** Arms are the arms, at least two. Weights that are all zero become an even split; otherwise they must sum to 100, and at most one arm may be flagged control. */
|
|
public var variants: [Arm]
|
|
|
|
public init(exposureEvent: String? = nil, flagKey: String? = nil, id: String, metricEvent: String, name: String? = nil, subjectKind: String? = nil, variants: [Arm]) {
|
|
self.exposureEvent = exposureEvent
|
|
self.flagKey = flagKey
|
|
self.id = id
|
|
self.metricEvent = metricEvent
|
|
self.name = name
|
|
self.subjectKind = subjectKind
|
|
self.variants = variants
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case exposureEvent
|
|
case flagKey
|
|
case id
|
|
case metricEvent
|
|
case name
|
|
case subjectKind
|
|
case variants
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(exposureEvent, forKey: .exposureEvent)
|
|
try container.encodeIfPresent(flagKey, forKey: .flagKey)
|
|
try container.encode(id, forKey: .id)
|
|
try container.encode(metricEvent, forKey: .metricEvent)
|
|
try container.encodeIfPresent(name, forKey: .name)
|
|
try container.encodeIfPresent(subjectKind, forKey: .subjectKind)
|
|
try container.encode(variants, forKey: .variants)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension CreateBody: Identifiable {}
|