diff --git a/Sources/DeveloperAPI/Generated/Types.swift b/Sources/DeveloperAPI/Generated/Types.swift index f23522a..8eb2741 100644 --- a/Sources/DeveloperAPI/Generated/Types.swift +++ b/Sources/DeveloperAPI/Generated/Types.swift @@ -5116,13 +5116,60 @@ public enum Components { /// - Remark: Generated from `#/components/schemas/CapabilityOption`. public struct CapabilityOption: Codable, Hashable, Sendable { /// - Remark: Generated from `#/components/schemas/CapabilityOption/key`. - @frozen public enum KeyPayload: String, Codable, Hashable, Sendable, CaseIterable { - case xcode5 = "XCODE_5" - case xcode6 = "XCODE_6" - case completeProtection = "COMPLETE_PROTECTION" - case protectedUnlessOpen = "PROTECTED_UNLESS_OPEN" - case protectedUntilFirstUserAuth = "PROTECTED_UNTIL_FIRST_USER_AUTH" - case primaryAppConsent = "PRIMARY_APP_CONSENT" + public struct KeyPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/CapabilityOption/key/value1`. + @frozen public enum Value1Payload: String, Codable, Hashable, Sendable, CaseIterable { + case xcode5 = "XCODE_5" + case xcode6 = "XCODE_6" + case completeProtection = "COMPLETE_PROTECTION" + case protectedUnlessOpen = "PROTECTED_UNLESS_OPEN" + case protectedUntilFirstUserAuth = "PROTECTED_UNTIL_FIRST_USER_AUTH" + case primaryAppConsent = "PRIMARY_APP_CONSENT" + } + /// - Remark: Generated from `#/components/schemas/CapabilityOption/key/value1`. + public var value1: Components.Schemas.CapabilityOption.KeyPayload.Value1Payload? + /// - Remark: Generated from `#/components/schemas/CapabilityOption/key/value2`. + public var value2: Swift.String? + /// Creates a new `KeyPayload`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.CapabilityOption.KeyPayload.Value1Payload? = nil, + value2: Swift.String? = nil + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self.value1 = try decoder.decodeFromSingleValueContainer() + } catch { + errors.append(error) + } + do { + self.value2 = try decoder.decodeFromSingleValueContainer() + } catch { + errors.append(error) + } + try Swift.DecodingError.verifyAtLeastOneSchemaIsNotNil( + [ + self.value1, + self.value2 + ], + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Encoder) throws { + try encoder.encodeFirstNonNilValueToSingleValueContainer([ + self.value1, + self.value2 + ]) + } } /// - Remark: Generated from `#/components/schemas/CapabilityOption/key`. public var key: Components.Schemas.CapabilityOption.KeyPayload? @@ -5172,10 +5219,57 @@ public enum Components { /// - Remark: Generated from `#/components/schemas/CapabilitySetting`. public struct CapabilitySetting: Codable, Hashable, Sendable { /// - Remark: Generated from `#/components/schemas/CapabilitySetting/key`. - @frozen public enum KeyPayload: String, Codable, Hashable, Sendable, CaseIterable { - case icloudVersion = "ICLOUD_VERSION" - case dataProtectionPermissionLevel = "DATA_PROTECTION_PERMISSION_LEVEL" - case appleIdAuthAppConsent = "APPLE_ID_AUTH_APP_CONSENT" + public struct KeyPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/CapabilitySetting/key/value1`. + @frozen public enum Value1Payload: String, Codable, Hashable, Sendable, CaseIterable { + case icloudVersion = "ICLOUD_VERSION" + case dataProtectionPermissionLevel = "DATA_PROTECTION_PERMISSION_LEVEL" + case appleIdAuthAppConsent = "APPLE_ID_AUTH_APP_CONSENT" + } + /// - Remark: Generated from `#/components/schemas/CapabilitySetting/key/value1`. + public var value1: Components.Schemas.CapabilitySetting.KeyPayload.Value1Payload? + /// - Remark: Generated from `#/components/schemas/CapabilitySetting/key/value2`. + public var value2: Swift.String? + /// Creates a new `KeyPayload`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.CapabilitySetting.KeyPayload.Value1Payload? = nil, + value2: Swift.String? = nil + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Decoder) throws { + var errors: [any Error] = [] + do { + self.value1 = try decoder.decodeFromSingleValueContainer() + } catch { + errors.append(error) + } + do { + self.value2 = try decoder.decodeFromSingleValueContainer() + } catch { + errors.append(error) + } + try Swift.DecodingError.verifyAtLeastOneSchemaIsNotNil( + [ + self.value1, + self.value2 + ], + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Encoder) throws { + try encoder.encodeFirstNonNilValueToSingleValueContainer([ + self.value1, + self.value2 + ]) + } } /// - Remark: Generated from `#/components/schemas/CapabilitySetting/key`. public var key: Components.Schemas.CapabilitySetting.KeyPayload? diff --git a/Sources/DeveloperAPI/patch.js b/Sources/DeveloperAPI/patch.js index 8c6aed0..c14ad35 100644 --- a/Sources/DeveloperAPI/patch.js +++ b/Sources/DeveloperAPI/patch.js @@ -74,6 +74,8 @@ function patch(schema) { // misses some cases that they do, actually, return. // https://swiftpackageindex.com/apple/swift-openapi-generator/1.7.2/documentation/swift-openapi-generator/useful-openapi-patterns#Open-enums-and-oneOfs makeOpen(schemas.BundleIdPlatform); + makeOpen(schemas.CapabilityOption.properties.key); + makeOpen(schemas.CapabilitySetting.properties.key); makeOpen(schemas.CapabilityType); makeOpen(schemas.CertificateType); makeOpen(schemas.Device.properties.attributes.properties.deviceClass); diff --git a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift index 0cc57f3..6f5e208 100644 --- a/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift +++ b/Sources/XKit/DeveloperServices/App IDs/Entitlements/DeveloperServicesCapability.swift @@ -39,7 +39,7 @@ extension Entitlement { extension DataProtectionEntitlement: EntitlementWithCapability { var capability: DeveloperServicesCapability { - let option: Components.Schemas.CapabilityOption.KeyPayload = switch self { + let option: Components.Schemas.CapabilityOption.KeyPayload.Value1Payload = switch self { case .complete: .completeProtection case .unlessOpen: .protectedUnlessOpen case .untilFirstAuth: .protectedUntilFirstUserAuth @@ -49,8 +49,8 @@ extension DataProtectionEntitlement: EntitlementWithCapability { isFree: true, settings: [ .init( - key: .dataProtectionPermissionLevel, - options: [.init(key: option)] + key: .init(.dataProtectionPermissionLevel), + options: [.init(key: .init(option))] ) ] ) diff --git a/Sources/XKit/DeveloperServices/OpenAPI/OpenAPIExtensibleEnum.swift b/Sources/XKit/DeveloperServices/OpenAPI/OpenAPIExtensibleEnum.swift index 7a6f586..ea846b9 100644 --- a/Sources/XKit/DeveloperServices/OpenAPI/OpenAPIExtensibleEnum.swift +++ b/Sources/XKit/DeveloperServices/OpenAPI/OpenAPIExtensibleEnum.swift @@ -20,6 +20,8 @@ extension OpenAPIExtensibleEnum { } extension Components.Schemas.BundleIdPlatform: OpenAPIExtensibleEnum {} +extension Components.Schemas.CapabilityOption.KeyPayload: OpenAPIExtensibleEnum {} +extension Components.Schemas.CapabilitySetting.KeyPayload: OpenAPIExtensibleEnum {} extension Components.Schemas.CapabilityType: OpenAPIExtensibleEnum {} extension Components.Schemas.CertificateType: OpenAPIExtensibleEnum {} extension Components.Schemas.Device.AttributesPayload.DeviceClassPayload: OpenAPIExtensibleEnum {}