Skip to content

Commit f29a784

Browse files
feat(specs): document runMetadata parameter (generated)
algolia/api-clients-automation#5087 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Devin Beeuwkes <46448173+DevinCodes@users.noreply.github.com>
1 parent f3219ed commit f29a784

File tree

3 files changed

+73
-8
lines changed

3 files changed

+73
-8
lines changed

Sources/Ingestion/IngestionClient.swift

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,11 +2805,17 @@ open class IngestionClient {
28052805
}
28062806

28072807
/// - parameter taskID: (path) Unique identifier of a task.
2808+
/// - parameter runTaskPayload: (body) (optional)
28082809
/// - returns: RunResponse
28092810
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
2810-
open func runTask(taskID: String, requestOptions: RequestOptions? = nil) async throws -> RunResponse {
2811+
open func runTask(
2812+
taskID: String,
2813+
runTaskPayload: RunTaskPayload? = nil,
2814+
requestOptions: RequestOptions? = nil
2815+
) async throws -> RunResponse {
28112816
let response: Response<RunResponse> = try await runTaskWithHTTPInfo(
28122817
taskID: taskID,
2818+
runTaskPayload: runTaskPayload,
28132819
requestOptions: requestOptions
28142820
)
28152821

@@ -2827,10 +2833,13 @@ open class IngestionClient {
28272833
// - editSettings
28282834
//
28292835
// - parameter taskID: (path) Unique identifier of a task.
2836+
//
2837+
// - parameter runTaskPayload: (body) (optional)
28302838
// - returns: RequestBuilder<RunResponse>
28312839

28322840
open func runTaskWithHTTPInfo(
28332841
taskID: String,
2842+
runTaskPayload: RunTaskPayload? = nil,
28342843
requestOptions userRequestOptions: RequestOptions? = nil
28352844
) async throws -> Response<RunResponse> {
28362845
guard !taskID.isEmpty else {
@@ -2847,7 +2856,7 @@ open class IngestionClient {
28472856
options: .literal,
28482857
range: nil
28492858
)
2850-
let body: AnyCodable? = nil
2859+
let body = runTaskPayload
28512860
let queryParameters: [String: Any?]? = nil
28522861

28532862
let nillableHeaders: [String: Any?]? = nil
@@ -2857,7 +2866,7 @@ open class IngestionClient {
28572866
return try await self.transporter.send(
28582867
method: "POST",
28592868
path: resourcePath,
2860-
data: body,
2869+
data: body ?? AnyCodable(),
28612870
requestOptions: RequestOptions(
28622871
headers: headers,
28632872
queryParameters: queryParameters
@@ -2866,12 +2875,18 @@ open class IngestionClient {
28662875
}
28672876

28682877
/// - parameter taskID: (path) Unique identifier of a task.
2878+
/// - parameter runTaskPayload: (body) (optional)
28692879
/// - returns: RunResponse
28702880
@available(*, deprecated, message: "This operation is deprecated.")
28712881
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
2872-
open func runTaskV1(taskID: String, requestOptions: RequestOptions? = nil) async throws -> RunResponse {
2882+
open func runTaskV1(
2883+
taskID: String,
2884+
runTaskPayload: RunTaskPayload? = nil,
2885+
requestOptions: RequestOptions? = nil
2886+
) async throws -> RunResponse {
28732887
let response: Response<RunResponse> = try await runTaskV1WithHTTPInfo(
28742888
taskID: taskID,
2889+
runTaskPayload: runTaskPayload,
28752890
requestOptions: requestOptions
28762891
)
28772892

@@ -2890,11 +2905,14 @@ open class IngestionClient {
28902905
/// - editSettings
28912906
///
28922907
/// - parameter taskID: (path) Unique identifier of a task.
2908+
///
2909+
/// - parameter runTaskPayload: (body) (optional)
28932910
/// - returns: RequestBuilder<RunResponse>
28942911
@available(*, deprecated, message: "This operation is deprecated.")
28952912

28962913
open func runTaskV1WithHTTPInfo(
28972914
taskID: String,
2915+
runTaskPayload: RunTaskPayload? = nil,
28982916
requestOptions userRequestOptions: RequestOptions? = nil
28992917
) async throws -> Response<RunResponse> {
29002918
guard !taskID.isEmpty else {
@@ -2911,7 +2929,7 @@ open class IngestionClient {
29112929
options: .literal,
29122930
range: nil
29132931
)
2914-
let body: AnyCodable? = nil
2932+
let body = runTaskPayload
29152933
let queryParameters: [String: Any?]? = nil
29162934

29172935
let nillableHeaders: [String: Any?]? = nil
@@ -2921,7 +2939,7 @@ open class IngestionClient {
29212939
return try await self.transporter.send(
29222940
method: "POST",
29232941
path: resourcePath,
2924-
data: body,
2942+
data: body ?? AnyCodable(),
29252943
requestOptions: RequestOptions(
29262944
headers: headers,
29272945
queryParameters: queryParameters

Sources/Ingestion/Models/RunSourcePayload.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,29 @@ public struct RunSourcePayload: Codable, JSONEncodable {
1414
/// List of entityIDs to update.
1515
public var entityIDs: [String]?
1616
public var entityType: EntityType?
17+
/// Additional information that will be passed to the created runs.
18+
public var runMetadata: [String: AnyCodable]?
1719

1820
public init(
1921
indexToInclude: [String]? = nil,
2022
indexToExclude: [String]? = nil,
2123
entityIDs: [String]? = nil,
22-
entityType: EntityType? = nil
24+
entityType: EntityType? = nil,
25+
runMetadata: [String: AnyCodable]? = nil
2326
) {
2427
self.indexToInclude = indexToInclude
2528
self.indexToExclude = indexToExclude
2629
self.entityIDs = entityIDs
2730
self.entityType = entityType
31+
self.runMetadata = runMetadata
2832
}
2933

3034
public enum CodingKeys: String, CodingKey, CaseIterable {
3135
case indexToInclude
3236
case indexToExclude
3337
case entityIDs
3438
case entityType
39+
case runMetadata
3540
}
3641

3742
// Encodable protocol methods
@@ -42,6 +47,7 @@ public struct RunSourcePayload: Codable, JSONEncodable {
4247
try container.encodeIfPresent(self.indexToExclude, forKey: .indexToExclude)
4348
try container.encodeIfPresent(self.entityIDs, forKey: .entityIDs)
4449
try container.encodeIfPresent(self.entityType, forKey: .entityType)
50+
try container.encodeIfPresent(self.runMetadata, forKey: .runMetadata)
4551
}
4652
}
4753

@@ -50,7 +56,8 @@ extension RunSourcePayload: Equatable {
5056
lhs.indexToInclude == rhs.indexToInclude &&
5157
lhs.indexToExclude == rhs.indexToExclude &&
5258
lhs.entityIDs == rhs.entityIDs &&
53-
lhs.entityType == rhs.entityType
59+
lhs.entityType == rhs.entityType &&
60+
lhs.runMetadata == rhs.runMetadata
5461
}
5562
}
5663

@@ -60,5 +67,6 @@ extension RunSourcePayload: Hashable {
6067
hasher.combine(self.indexToExclude?.hashValue)
6168
hasher.combine(self.entityIDs?.hashValue)
6269
hasher.combine(self.entityType?.hashValue)
70+
hasher.combine(self.runMetadata?.hashValue)
6371
}
6472
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 RunTaskPayload: Codable, JSONEncodable {
10+
/// Additional information that will be passed to the created run.
11+
public var runMetadata: [String: AnyCodable]?
12+
13+
public init(runMetadata: [String: AnyCodable]? = nil) {
14+
self.runMetadata = runMetadata
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case runMetadata
19+
}
20+
21+
// Encodable protocol methods
22+
23+
public func encode(to encoder: Encoder) throws {
24+
var container = encoder.container(keyedBy: CodingKeys.self)
25+
try container.encodeIfPresent(self.runMetadata, forKey: .runMetadata)
26+
}
27+
}
28+
29+
extension RunTaskPayload: Equatable {
30+
public static func ==(lhs: RunTaskPayload, rhs: RunTaskPayload) -> Bool {
31+
lhs.runMetadata == rhs.runMetadata
32+
}
33+
}
34+
35+
extension RunTaskPayload: Hashable {
36+
public func hash(into hasher: inout Hasher) {
37+
hasher.combine(self.runMetadata?.hashValue)
38+
}
39+
}

0 commit comments

Comments
 (0)