Skip to content

Commit ea1e578

Browse files
chore: generated code for commit fe6f5eda. [skip ci]
algolia/api-clients-automation@fe6f5ed Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 7ce836a commit ea1e578

File tree

8 files changed

+1296
-394
lines changed

8 files changed

+1296
-394
lines changed

Sources/Ingestion/IngestionClient.swift

Lines changed: 920 additions & 373 deletions
Large diffs are not rendered by default.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
/// Configured tasks and pagination information.
10+
public struct ListTasksResponseV1: Codable, JSONEncodable {
11+
public var tasks: [TaskV1]
12+
public var pagination: Pagination
13+
14+
public init(tasks: [TaskV1], pagination: Pagination) {
15+
self.tasks = tasks
16+
self.pagination = pagination
17+
}
18+
19+
public enum CodingKeys: String, CodingKey, CaseIterable {
20+
case tasks
21+
case pagination
22+
}
23+
24+
// Encodable protocol methods
25+
26+
public func encode(to encoder: Encoder) throws {
27+
var container = encoder.container(keyedBy: CodingKeys.self)
28+
try container.encode(self.tasks, forKey: .tasks)
29+
try container.encode(self.pagination, forKey: .pagination)
30+
}
31+
}
32+
33+
extension ListTasksResponseV1: Equatable {
34+
public static func ==(lhs: ListTasksResponseV1, rhs: ListTasksResponseV1) -> Bool {
35+
lhs.tasks == rhs.tasks &&
36+
lhs.pagination == rhs.pagination
37+
}
38+
}
39+
40+
extension ListTasksResponseV1: Hashable {
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(self.tasks.hashValue)
43+
hasher.combine(self.pagination.hashValue)
44+
}
45+
}

Sources/Ingestion/Models/Task.swift

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ public struct Task: Codable, JSONEncodable {
1313
public var sourceID: String
1414
/// Universally unique identifier (UUID) of a destination resource.
1515
public var destinationID: String
16-
public var trigger: Trigger
16+
/// Cron expression for the task's schedule.
17+
public var cron: String?
18+
/// The last time the scheduled task ran in RFC 3339 format.
19+
public var lastRun: String?
20+
/// The next scheduled run of the task in RFC 3339 format.
21+
public var nextRun: String?
1722
public var input: TaskInput?
1823
/// Whether the task is enabled.
1924
public var enabled: Bool
@@ -31,7 +36,9 @@ public struct Task: Codable, JSONEncodable {
3136
taskID: String,
3237
sourceID: String,
3338
destinationID: String,
34-
trigger: Trigger,
39+
cron: String? = nil,
40+
lastRun: String? = nil,
41+
nextRun: String? = nil,
3542
input: TaskInput? = nil,
3643
enabled: Bool,
3744
failureThreshold: Int? = nil,
@@ -43,7 +50,9 @@ public struct Task: Codable, JSONEncodable {
4350
self.taskID = taskID
4451
self.sourceID = sourceID
4552
self.destinationID = destinationID
46-
self.trigger = trigger
53+
self.cron = cron
54+
self.lastRun = lastRun
55+
self.nextRun = nextRun
4756
self.input = input
4857
self.enabled = enabled
4958
self.failureThreshold = failureThreshold
@@ -57,7 +66,9 @@ public struct Task: Codable, JSONEncodable {
5766
case taskID
5867
case sourceID
5968
case destinationID
60-
case trigger
69+
case cron
70+
case lastRun
71+
case nextRun
6172
case input
6273
case enabled
6374
case failureThreshold
@@ -74,7 +85,9 @@ public struct Task: Codable, JSONEncodable {
7485
try container.encode(self.taskID, forKey: .taskID)
7586
try container.encode(self.sourceID, forKey: .sourceID)
7687
try container.encode(self.destinationID, forKey: .destinationID)
77-
try container.encode(self.trigger, forKey: .trigger)
88+
try container.encodeIfPresent(self.cron, forKey: .cron)
89+
try container.encodeIfPresent(self.lastRun, forKey: .lastRun)
90+
try container.encodeIfPresent(self.nextRun, forKey: .nextRun)
7891
try container.encodeIfPresent(self.input, forKey: .input)
7992
try container.encode(self.enabled, forKey: .enabled)
8093
try container.encodeIfPresent(self.failureThreshold, forKey: .failureThreshold)
@@ -90,7 +103,9 @@ extension Task: Equatable {
90103
lhs.taskID == rhs.taskID &&
91104
lhs.sourceID == rhs.sourceID &&
92105
lhs.destinationID == rhs.destinationID &&
93-
lhs.trigger == rhs.trigger &&
106+
lhs.cron == rhs.cron &&
107+
lhs.lastRun == rhs.lastRun &&
108+
lhs.nextRun == rhs.nextRun &&
94109
lhs.input == rhs.input &&
95110
lhs.enabled == rhs.enabled &&
96111
lhs.failureThreshold == rhs.failureThreshold &&
@@ -106,7 +121,9 @@ extension Task: Hashable {
106121
hasher.combine(self.taskID.hashValue)
107122
hasher.combine(self.sourceID.hashValue)
108123
hasher.combine(self.destinationID.hashValue)
109-
hasher.combine(self.trigger.hashValue)
124+
hasher.combine(self.cron?.hashValue)
125+
hasher.combine(self.lastRun?.hashValue)
126+
hasher.combine(self.nextRun?.hashValue)
110127
hasher.combine(self.input?.hashValue)
111128
hasher.combine(self.enabled.hashValue)
112129
hasher.combine(self.failureThreshold?.hashValue)

Sources/Ingestion/Models/TaskCreate.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ public struct TaskCreate: Codable, JSONEncodable {
1212
public var sourceID: String
1313
/// Universally unique identifier (UUID) of a destination resource.
1414
public var destinationID: String
15-
public var trigger: TaskCreateTrigger
1615
public var action: ActionType
16+
/// Cron expression for the task's schedule.
17+
public var cron: String?
1718
/// Whether the task is enabled.
1819
public var enabled: Bool?
1920
/// Maximum accepted percentage of failures for a task run to finish successfully.
@@ -25,17 +26,17 @@ public struct TaskCreate: Codable, JSONEncodable {
2526
public init(
2627
sourceID: String,
2728
destinationID: String,
28-
trigger: TaskCreateTrigger,
2929
action: ActionType,
30+
cron: String? = nil,
3031
enabled: Bool? = nil,
3132
failureThreshold: Int? = nil,
3233
input: TaskInput? = nil,
3334
cursor: String? = nil
3435
) {
3536
self.sourceID = sourceID
3637
self.destinationID = destinationID
37-
self.trigger = trigger
3838
self.action = action
39+
self.cron = cron
3940
self.enabled = enabled
4041
self.failureThreshold = failureThreshold
4142
self.input = input
@@ -45,8 +46,8 @@ public struct TaskCreate: Codable, JSONEncodable {
4546
public enum CodingKeys: String, CodingKey, CaseIterable {
4647
case sourceID
4748
case destinationID
48-
case trigger
4949
case action
50+
case cron
5051
case enabled
5152
case failureThreshold
5253
case input
@@ -59,8 +60,8 @@ public struct TaskCreate: Codable, JSONEncodable {
5960
var container = encoder.container(keyedBy: CodingKeys.self)
6061
try container.encode(self.sourceID, forKey: .sourceID)
6162
try container.encode(self.destinationID, forKey: .destinationID)
62-
try container.encode(self.trigger, forKey: .trigger)
6363
try container.encode(self.action, forKey: .action)
64+
try container.encodeIfPresent(self.cron, forKey: .cron)
6465
try container.encodeIfPresent(self.enabled, forKey: .enabled)
6566
try container.encodeIfPresent(self.failureThreshold, forKey: .failureThreshold)
6667
try container.encodeIfPresent(self.input, forKey: .input)
@@ -72,8 +73,8 @@ extension TaskCreate: Equatable {
7273
public static func ==(lhs: TaskCreate, rhs: TaskCreate) -> Bool {
7374
lhs.sourceID == rhs.sourceID &&
7475
lhs.destinationID == rhs.destinationID &&
75-
lhs.trigger == rhs.trigger &&
7676
lhs.action == rhs.action &&
77+
lhs.cron == rhs.cron &&
7778
lhs.enabled == rhs.enabled &&
7879
lhs.failureThreshold == rhs.failureThreshold &&
7980
lhs.input == rhs.input &&
@@ -85,8 +86,8 @@ extension TaskCreate: Hashable {
8586
public func hash(into hasher: inout Hasher) {
8687
hasher.combine(self.sourceID.hashValue)
8788
hasher.combine(self.destinationID.hashValue)
88-
hasher.combine(self.trigger.hashValue)
8989
hasher.combine(self.action.hashValue)
90+
hasher.combine(self.cron?.hashValue)
9091
hasher.combine(self.enabled?.hashValue)
9192
hasher.combine(self.failureThreshold?.hashValue)
9293
hasher.combine(self.input?.hashValue)
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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 creating a task using the V1 shape, please use methods and types that don&#39;t contain the V1
10+
/// suffix.
11+
@available(*, deprecated, message: "This schema is deprecated.")
12+
public struct TaskCreateV1: Codable, JSONEncodable {
13+
/// Universally uniqud identifier (UUID) of a source.
14+
public var sourceID: String
15+
/// Universally unique identifier (UUID) of a destination resource.
16+
public var destinationID: String
17+
public var trigger: TaskCreateTrigger
18+
public var action: ActionType
19+
/// Whether the task is enabled.
20+
public var enabled: Bool?
21+
/// Maximum accepted percentage of failures for a task run to finish successfully.
22+
public var failureThreshold: Int?
23+
public var input: TaskInput?
24+
/// Date of the last cursor in RFC 3339 format.
25+
public var cursor: String?
26+
27+
public init(
28+
sourceID: String,
29+
destinationID: String,
30+
trigger: TaskCreateTrigger,
31+
action: ActionType,
32+
enabled: Bool? = nil,
33+
failureThreshold: Int? = nil,
34+
input: TaskInput? = nil,
35+
cursor: String? = nil
36+
) {
37+
self.sourceID = sourceID
38+
self.destinationID = destinationID
39+
self.trigger = trigger
40+
self.action = action
41+
self.enabled = enabled
42+
self.failureThreshold = failureThreshold
43+
self.input = input
44+
self.cursor = cursor
45+
}
46+
47+
public enum CodingKeys: String, CodingKey, CaseIterable {
48+
case sourceID
49+
case destinationID
50+
case trigger
51+
case action
52+
case enabled
53+
case failureThreshold
54+
case input
55+
case cursor
56+
}
57+
58+
// Encodable protocol methods
59+
60+
public func encode(to encoder: Encoder) throws {
61+
var container = encoder.container(keyedBy: CodingKeys.self)
62+
try container.encode(self.sourceID, forKey: .sourceID)
63+
try container.encode(self.destinationID, forKey: .destinationID)
64+
try container.encode(self.trigger, forKey: .trigger)
65+
try container.encode(self.action, forKey: .action)
66+
try container.encodeIfPresent(self.enabled, forKey: .enabled)
67+
try container.encodeIfPresent(self.failureThreshold, forKey: .failureThreshold)
68+
try container.encodeIfPresent(self.input, forKey: .input)
69+
try container.encodeIfPresent(self.cursor, forKey: .cursor)
70+
}
71+
}
72+
73+
extension TaskCreateV1: Equatable {
74+
public static func ==(lhs: TaskCreateV1, rhs: TaskCreateV1) -> Bool {
75+
lhs.sourceID == rhs.sourceID &&
76+
lhs.destinationID == rhs.destinationID &&
77+
lhs.trigger == rhs.trigger &&
78+
lhs.action == rhs.action &&
79+
lhs.enabled == rhs.enabled &&
80+
lhs.failureThreshold == rhs.failureThreshold &&
81+
lhs.input == rhs.input &&
82+
lhs.cursor == rhs.cursor
83+
}
84+
}
85+
86+
extension TaskCreateV1: Hashable {
87+
public func hash(into hasher: inout Hasher) {
88+
hasher.combine(self.sourceID.hashValue)
89+
hasher.combine(self.destinationID.hashValue)
90+
hasher.combine(self.trigger.hashValue)
91+
hasher.combine(self.action.hashValue)
92+
hasher.combine(self.enabled?.hashValue)
93+
hasher.combine(self.failureThreshold?.hashValue)
94+
hasher.combine(self.input?.hashValue)
95+
hasher.combine(self.cursor?.hashValue)
96+
}
97+
}

Sources/Ingestion/Models/TaskUpdate.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import Foundation
1010
public struct TaskUpdate: Codable, JSONEncodable {
1111
/// Universally unique identifier (UUID) of a destination resource.
1212
public var destinationID: String?
13-
public var trigger: TriggerUpdateInput?
13+
/// Cron expression for the task's schedule.
14+
public var cron: String?
1415
public var input: TaskInput?
1516
/// Whether the task is enabled.
1617
public var enabled: Bool?
@@ -19,21 +20,21 @@ public struct TaskUpdate: Codable, JSONEncodable {
1920

2021
public init(
2122
destinationID: String? = nil,
22-
trigger: TriggerUpdateInput? = nil,
23+
cron: String? = nil,
2324
input: TaskInput? = nil,
2425
enabled: Bool? = nil,
2526
failureThreshold: Int? = nil
2627
) {
2728
self.destinationID = destinationID
28-
self.trigger = trigger
29+
self.cron = cron
2930
self.input = input
3031
self.enabled = enabled
3132
self.failureThreshold = failureThreshold
3233
}
3334

3435
public enum CodingKeys: String, CodingKey, CaseIterable {
3536
case destinationID
36-
case trigger
37+
case cron
3738
case input
3839
case enabled
3940
case failureThreshold
@@ -44,7 +45,7 @@ public struct TaskUpdate: Codable, JSONEncodable {
4445
public func encode(to encoder: Encoder) throws {
4546
var container = encoder.container(keyedBy: CodingKeys.self)
4647
try container.encodeIfPresent(self.destinationID, forKey: .destinationID)
47-
try container.encodeIfPresent(self.trigger, forKey: .trigger)
48+
try container.encodeIfPresent(self.cron, forKey: .cron)
4849
try container.encodeIfPresent(self.input, forKey: .input)
4950
try container.encodeIfPresent(self.enabled, forKey: .enabled)
5051
try container.encodeIfPresent(self.failureThreshold, forKey: .failureThreshold)
@@ -54,7 +55,7 @@ public struct TaskUpdate: Codable, JSONEncodable {
5455
extension TaskUpdate: Equatable {
5556
public static func ==(lhs: TaskUpdate, rhs: TaskUpdate) -> Bool {
5657
lhs.destinationID == rhs.destinationID &&
57-
lhs.trigger == rhs.trigger &&
58+
lhs.cron == rhs.cron &&
5859
lhs.input == rhs.input &&
5960
lhs.enabled == rhs.enabled &&
6061
lhs.failureThreshold == rhs.failureThreshold
@@ -64,7 +65,7 @@ extension TaskUpdate: Equatable {
6465
extension TaskUpdate: Hashable {
6566
public func hash(into hasher: inout Hasher) {
6667
hasher.combine(self.destinationID?.hashValue)
67-
hasher.combine(self.trigger?.hashValue)
68+
hasher.combine(self.cron?.hashValue)
6869
hasher.combine(self.input?.hashValue)
6970
hasher.combine(self.enabled?.hashValue)
7071
hasher.combine(self.failureThreshold?.hashValue)

0 commit comments

Comments
 (0)