|
| 1 | +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on |
| 2 | +// https://github.com/algolia/api-clients-automation. DO NOT EDIT. |
| 3 | + |
| 4 | +import Foundation |
| 5 | +#if canImport(Core) |
| 6 | + import Core |
| 7 | +#endif |
| 8 | + |
| 9 | +/// API request body for updating a task. |
| 10 | +public struct TaskReplace: Codable, JSONEncodable { |
| 11 | + /// Universally unique identifier (UUID) of a destination resource. |
| 12 | + public var destinationID: String |
| 13 | + public var action: ActionType |
| 14 | + public var subscriptionAction: ActionType? |
| 15 | + /// Cron expression for the task's schedule. |
| 16 | + public var cron: String? |
| 17 | + /// Whether the task is enabled. |
| 18 | + public var enabled: Bool? |
| 19 | + /// Maximum accepted percentage of failures for a task run to finish successfully. |
| 20 | + public var failureThreshold: Int? |
| 21 | + public var input: TaskInput? |
| 22 | + /// Date of the last cursor in RFC 3339 format. |
| 23 | + public var cursor: String? |
| 24 | + public var notifications: Notifications? |
| 25 | + public var policies: Policies? |
| 26 | + |
| 27 | + public init( |
| 28 | + destinationID: String, |
| 29 | + action: ActionType, |
| 30 | + subscriptionAction: ActionType? = nil, |
| 31 | + cron: String? = nil, |
| 32 | + enabled: Bool? = nil, |
| 33 | + failureThreshold: Int? = nil, |
| 34 | + input: TaskInput? = nil, |
| 35 | + cursor: String? = nil, |
| 36 | + notifications: Notifications? = nil, |
| 37 | + policies: Policies? = nil |
| 38 | + ) { |
| 39 | + self.destinationID = destinationID |
| 40 | + self.action = action |
| 41 | + self.subscriptionAction = subscriptionAction |
| 42 | + self.cron = cron |
| 43 | + self.enabled = enabled |
| 44 | + self.failureThreshold = failureThreshold |
| 45 | + self.input = input |
| 46 | + self.cursor = cursor |
| 47 | + self.notifications = notifications |
| 48 | + self.policies = policies |
| 49 | + } |
| 50 | + |
| 51 | + public enum CodingKeys: String, CodingKey, CaseIterable { |
| 52 | + case destinationID |
| 53 | + case action |
| 54 | + case subscriptionAction |
| 55 | + case cron |
| 56 | + case enabled |
| 57 | + case failureThreshold |
| 58 | + case input |
| 59 | + case cursor |
| 60 | + case notifications |
| 61 | + case policies |
| 62 | + } |
| 63 | + |
| 64 | + // Encodable protocol methods |
| 65 | + |
| 66 | + public func encode(to encoder: Encoder) throws { |
| 67 | + var container = encoder.container(keyedBy: CodingKeys.self) |
| 68 | + try container.encode(self.destinationID, forKey: .destinationID) |
| 69 | + try container.encode(self.action, forKey: .action) |
| 70 | + try container.encodeIfPresent(self.subscriptionAction, forKey: .subscriptionAction) |
| 71 | + try container.encodeIfPresent(self.cron, forKey: .cron) |
| 72 | + try container.encodeIfPresent(self.enabled, forKey: .enabled) |
| 73 | + try container.encodeIfPresent(self.failureThreshold, forKey: .failureThreshold) |
| 74 | + try container.encodeIfPresent(self.input, forKey: .input) |
| 75 | + try container.encodeIfPresent(self.cursor, forKey: .cursor) |
| 76 | + try container.encodeIfPresent(self.notifications, forKey: .notifications) |
| 77 | + try container.encodeIfPresent(self.policies, forKey: .policies) |
| 78 | + } |
| 79 | +} |
| 80 | + |
| 81 | +extension TaskReplace: Equatable { |
| 82 | + public static func ==(lhs: TaskReplace, rhs: TaskReplace) -> Bool { |
| 83 | + lhs.destinationID == rhs.destinationID && |
| 84 | + lhs.action == rhs.action && |
| 85 | + lhs.subscriptionAction == rhs.subscriptionAction && |
| 86 | + lhs.cron == rhs.cron && |
| 87 | + lhs.enabled == rhs.enabled && |
| 88 | + lhs.failureThreshold == rhs.failureThreshold && |
| 89 | + lhs.input == rhs.input && |
| 90 | + lhs.cursor == rhs.cursor && |
| 91 | + lhs.notifications == rhs.notifications && |
| 92 | + lhs.policies == rhs.policies |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +extension TaskReplace: Hashable { |
| 97 | + public func hash(into hasher: inout Hasher) { |
| 98 | + hasher.combine(self.destinationID.hashValue) |
| 99 | + hasher.combine(self.action.hashValue) |
| 100 | + hasher.combine(self.subscriptionAction?.hashValue) |
| 101 | + hasher.combine(self.cron?.hashValue) |
| 102 | + hasher.combine(self.enabled?.hashValue) |
| 103 | + hasher.combine(self.failureThreshold?.hashValue) |
| 104 | + hasher.combine(self.input?.hashValue) |
| 105 | + hasher.combine(self.cursor?.hashValue) |
| 106 | + hasher.combine(self.notifications?.hashValue) |
| 107 | + hasher.combine(self.policies?.hashValue) |
| 108 | + } |
| 109 | +} |
0 commit comments