Skip to content

Commit 6e7c5a6

Browse files
algolia-botshortcutsmillotp
committed
fix(specs): ingestion push task payload [skip-bc] (generated)
algolia/api-clients-automation#3607 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 7d447a8 commit 6e7c5a6

File tree

4 files changed

+105
-57
lines changed

4 files changed

+105
-57
lines changed

Sources/Ingestion/IngestionClient.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,18 +2486,18 @@ open class IngestionClient {
24862486
}
24872487

24882488
/// - parameter taskID: (path) Unique identifier of a task.
2489-
/// - parameter batchWriteParams: (body) Request body of a Search API `batch` request that will be pushed in the
2489+
/// - parameter pushTaskPayload: (body) Request body of a Search API `batch` request that will be pushed in the
24902490
/// Connectors pipeline.
24912491
/// - returns: RunResponse
24922492
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
24932493
open func pushTask(
24942494
taskID: String,
2495-
batchWriteParams: IngestionBatchWriteParams,
2495+
pushTaskPayload: PushTaskPayload,
24962496
requestOptions: RequestOptions? = nil
24972497
) async throws -> RunResponse {
24982498
let response: Response<RunResponse> = try await pushTaskWithHTTPInfo(
24992499
taskID: taskID,
2500-
batchWriteParams: batchWriteParams,
2500+
pushTaskPayload: pushTaskPayload,
25012501
requestOptions: requestOptions
25022502
)
25032503

@@ -2517,13 +2517,13 @@ open class IngestionClient {
25172517
//
25182518
// - parameter taskID: (path) Unique identifier of a task.
25192519
//
2520-
// - parameter batchWriteParams: (body) Request body of a Search API `batch` request that will be pushed in the
2520+
// - parameter pushTaskPayload: (body) Request body of a Search API `batch` request that will be pushed in the
25212521
// Connectors pipeline.
25222522
// - returns: RequestBuilder<RunResponse>
25232523

25242524
open func pushTaskWithHTTPInfo(
25252525
taskID: String,
2526-
batchWriteParams: IngestionBatchWriteParams,
2526+
pushTaskPayload: PushTaskPayload,
25272527
requestOptions userRequestOptions: RequestOptions? = nil
25282528
) async throws -> Response<RunResponse> {
25292529
guard !taskID.isEmpty else {
@@ -2540,7 +2540,7 @@ open class IngestionClient {
25402540
options: .literal,
25412541
range: nil
25422542
)
2543-
let body = batchWriteParams
2543+
let body = pushTaskPayload
25442544
let queryParameters: [String: Any?]? = nil
25452545

25462546
let nillableHeaders: [String: Any?]? = nil

Sources/Ingestion/Models/IngestionBatchWriteParams.swift

Lines changed: 0 additions & 39 deletions
This file was deleted.

Sources/Ingestion/Models/IngestionBatchRequest.swift renamed to Sources/Ingestion/Models/PushTaskPayload.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,39 @@ import Foundation
66
import Core
77
#endif
88

9-
public struct IngestionBatchRequest: Codable, JSONEncodable {
9+
public struct PushTaskPayload: Codable, JSONEncodable {
1010
public var action: IngestionAction
11-
/// Operation arguments (varies with specified `action`).
12-
public var body: AnyCodable
11+
public var records: [PushTaskRecords]
1312

14-
public init(action: IngestionAction, body: AnyCodable) {
13+
public init(action: IngestionAction, records: [PushTaskRecords]) {
1514
self.action = action
16-
self.body = body
15+
self.records = records
1716
}
1817

1918
public enum CodingKeys: String, CodingKey, CaseIterable {
2019
case action
21-
case body
20+
case records
2221
}
2322

2423
// Encodable protocol methods
2524

2625
public func encode(to encoder: Encoder) throws {
2726
var container = encoder.container(keyedBy: CodingKeys.self)
2827
try container.encode(self.action, forKey: .action)
29-
try container.encode(self.body, forKey: .body)
28+
try container.encode(self.records, forKey: .records)
3029
}
3130
}
3231

33-
extension IngestionBatchRequest: Equatable {
34-
public static func ==(lhs: IngestionBatchRequest, rhs: IngestionBatchRequest) -> Bool {
32+
extension PushTaskPayload: Equatable {
33+
public static func ==(lhs: PushTaskPayload, rhs: PushTaskPayload) -> Bool {
3534
lhs.action == rhs.action &&
36-
lhs.body == rhs.body
35+
lhs.records == rhs.records
3736
}
3837
}
3938

40-
extension IngestionBatchRequest: Hashable {
39+
extension PushTaskPayload: Hashable {
4140
public func hash(into hasher: inout Hasher) {
4241
hasher.combine(self.action.hashValue)
43-
hasher.combine(self.body.hashValue)
42+
hasher.combine(self.records.hashValue)
4443
}
4544
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
public struct PushTaskRecords: Codable, JSONEncodable {
10+
/// Unique record identifier.
11+
public var objectID: String
12+
13+
public init(objectID: String) {
14+
self.objectID = objectID
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case objectID
19+
}
20+
21+
public var additionalProperties: [String: AnyCodable] = [:]
22+
23+
public subscript(key: String) -> AnyCodable? {
24+
get {
25+
if let value = additionalProperties[key] {
26+
return value
27+
}
28+
return nil
29+
}
30+
31+
set {
32+
self.additionalProperties[key] = newValue
33+
}
34+
}
35+
36+
public init(from dictionary: [String: AnyCodable]) throws {
37+
guard let objectID = dictionary["objectID"]?.value as? String else {
38+
throw GenericError(description: "Failed to cast")
39+
}
40+
self.objectID = objectID
41+
for (key, value) in dictionary {
42+
switch key {
43+
case "objectID":
44+
continue
45+
default:
46+
self.additionalProperties[key] = value
47+
}
48+
}
49+
}
50+
51+
// Encodable protocol methods
52+
53+
public func encode(to encoder: Encoder) throws {
54+
var container = encoder.container(keyedBy: CodingKeys.self)
55+
try container.encode(self.objectID, forKey: .objectID)
56+
var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
57+
try additionalPropertiesContainer.encodeMap(self.additionalProperties)
58+
}
59+
60+
// Decodable protocol methods
61+
62+
public init(from decoder: Decoder) throws {
63+
let container = try decoder.container(keyedBy: CodingKeys.self)
64+
65+
self.objectID = try container.decode(String.self, forKey: .objectID)
66+
var nonAdditionalPropertyKeys = Set<String>()
67+
nonAdditionalPropertyKeys.insert("objectID")
68+
let additionalPropertiesContainer = try decoder.container(keyedBy: String.self)
69+
self.additionalProperties = try additionalPropertiesContainer.decodeMap(
70+
AnyCodable.self,
71+
excludedKeys: nonAdditionalPropertyKeys
72+
)
73+
}
74+
}
75+
76+
extension PushTaskRecords: Equatable {
77+
public static func ==(lhs: PushTaskRecords, rhs: PushTaskRecords) -> Bool {
78+
lhs.objectID == rhs.objectID
79+
&& lhs.additionalProperties == rhs.additionalProperties
80+
}
81+
}
82+
83+
extension PushTaskRecords: Hashable {
84+
public func hash(into hasher: inout Hasher) {
85+
hasher.combine(self.objectID.hashValue)
86+
hasher.combine(self.additionalProperties.hashValue)
87+
}
88+
}

0 commit comments

Comments
 (0)