Skip to content

Commit 6aa3e87

Browse files
rename Task -> IndexTask (#787)
1 parent 0b45179 commit 6aa3e87

File tree

20 files changed

+34
-34
lines changed

20 files changed

+34
-34
lines changed

Sources/AlgoliaSearchClient/Client/AccountClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct AccountClient {
3333
@discardableResult public static func copyIndex(source: Index,
3434
destination: Index,
3535
requestOptions: RequestOptions? = nil,
36-
completion: @escaping (Result<WaitableWrapper<[Task]>, Swift.Error>) -> Void) throws -> Operation {
36+
completion: @escaping (Result<WaitableWrapper<[IndexTask]>, Swift.Error>) -> Void) throws -> Operation {
3737
let operation = BlockOperation {
3838
completion(.init { try AccountClient.copyIndex(source: source, destination: destination, requestOptions: requestOptions) })
3939
}
@@ -54,7 +54,7 @@ public struct AccountClient {
5454

5555
@discardableResult public static func copyIndex(source: Index,
5656
destination: Index,
57-
requestOptions: RequestOptions? = nil) throws -> WaitableWrapper<[Task]> {
57+
requestOptions: RequestOptions? = nil) throws -> WaitableWrapper<[IndexTask]> {
5858

5959
guard source.applicationID != destination.applicationID else {
6060
throw Error.sameApplicationID
@@ -78,7 +78,7 @@ public struct AccountClient {
7878
let waitRules = try destination.saveRules(rules)
7979
let waitSettings = try destination.setSettings(settings)
8080

81-
let tasks: [Task] = [
81+
let tasks: [IndexTask] = [
8282
waitSynonyms,
8383
waitRules,
8484
waitSettings

Sources/AlgoliaSearchClient/Helpers/ResultCallback.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
import Foundation
99

1010
public typealias ResultCallback<T> = (Result<T, Error>) -> Void
11-
public typealias ResultTaskCallback<T: Task & Codable> = (Result<WaitableWrapper<T>, Error>) -> Void
11+
public typealias ResultTaskCallback<T: IndexTask & Codable> = (Result<WaitableWrapper<T>, Error>) -> Void
1212
public typealias ResultAppTaskCallback<T: AppTask & Codable> = (Result<WaitableWrapper<T>, Error>) -> Void
1313
public typealias ResultBatchesCallback = (Result<WaitableWrapper<BatchesResponse>, Error>) -> Void

Sources/AlgoliaSearchClient/Helpers/Wait/WaitableWrapper.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct WaitableWrapper<T> {
1919

2020
}
2121

22-
extension WaitableWrapper where T: Task {
22+
extension WaitableWrapper where T: IndexTask {
2323

2424
public var task: T {
2525
return wrapped
@@ -38,13 +38,13 @@ extension WaitableWrapper where T: Task {
3838

3939
}
4040

41-
extension WaitableWrapper where T == [Task] {
41+
extension WaitableWrapper where T == [IndexTask] {
4242

4343
public var tasks: T {
4444
return wrapped
4545
}
4646

47-
init(tasks: [Task], index: Index) {
47+
init(tasks: [IndexTask], index: Index) {
4848
self.wrapped = tasks
4949
self.tasksToWait = tasks.map { Waitable(index: index, taskID: $0.taskID) }
5050
}
@@ -70,7 +70,7 @@ extension WaitableWrapper where T: AppTask {
7070

7171
}
7272

73-
extension WaitableWrapper where T: Task & IndexNameContainer {
73+
extension WaitableWrapper where T: IndexTask & IndexNameContainer {
7474

7575
static func wrap(credentials: Credentials) -> (T) -> WaitableWrapper<T> {
7676
return { task in

Sources/AlgoliaSearchClient/Index/Index+Advanced.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import Foundation
99

1010
public extension Index {
1111

12-
// MARK: - Task status
12+
// MARK: - IndexTask status
1313

1414
/**
15-
Check the current TaskStatus of a given Task.
15+
Check the current TaskStatus of a given IndexTask.
1616

17-
- parameter taskID: of the indexing [Task].
17+
- parameter taskID: of the indexing [IndexTask].
1818
- parameter requestOptions: Configure request locally with [RequestOptions]
1919
*/
2020
@discardableResult func taskStatus(for taskID: TaskID,
@@ -25,9 +25,9 @@ public extension Index {
2525
}
2626

2727
/**
28-
Check the current TaskStatus of a given Task.
28+
Check the current TaskStatus of a given IndexTask.
2929

30-
- parameter taskID: of the indexing [Task].
30+
- parameter taskID: of the indexing [IndexTask].
3131
- parameter requestOptions: Configure request locally with [RequestOptions]
3232
*/
3333
@discardableResult func taskStatus(for taskID: TaskID,
@@ -39,7 +39,7 @@ public extension Index {
3939
// MARK: - Wait task
4040

4141
/**
42-
Wait for a Task to complete before executing the next line of code, to synchronize index updates.
42+
Wait for a IndexTask to complete before executing the next line of code, to synchronize index updates.
4343
All write operations in Algolia are asynchronous by design.
4444
It means that when you add or update an object to your index, our servers will reply to your request with
4545
a TaskID as soon as they understood the write operation.
@@ -63,7 +63,7 @@ public extension Index {
6363
}
6464

6565
/**
66-
Wait for a Task to complete before executing the next line of code, to synchronize index updates.
66+
Wait for a IndexTask to complete before executing the next line of code, to synchronize index updates.
6767
All write operations in Algolia are asynchronous by design.
6868
It means that when you add or update an object to your index, our servers will reply to your request with
6969
a TaskID as soon as they understood the write operation.

Sources/AlgoliaSearchClient/Index/Index.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ extension Index: TransportContainer {}
3535

3636
extension Index {
3737

38-
func execute<Command: AlgoliaCommand, Output: Codable & Task>(_ command: Command, completion: @escaping ResultTaskCallback<Output>) -> Operation & TransportTask {
38+
func execute<Command: AlgoliaCommand, Output: Codable & IndexTask>(_ command: Command, completion: @escaping ResultTaskCallback<Output>) -> Operation & TransportTask {
3939
transport.execute(command, transform: WaitableWrapper.wrap(with: self), completion: completion)
4040
}
4141

42-
func execute<Command: AlgoliaCommand, Output: Codable & Task>(_ command: Command) throws -> WaitableWrapper<Output> {
42+
func execute<Command: AlgoliaCommand, Output: Codable & IndexTask>(_ command: Command) throws -> WaitableWrapper<Output> {
4343
try transport.execute(command, transform: WaitableWrapper.wrap(with: self))
4444
}
4545

Sources/AlgoliaSearchClient/Models/Analytics/ABTest/Task/ABTestCreation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public struct ABTestCreation: Task, IndexNameContainer, Codable {
10+
public struct ABTestCreation: IndexTask, IndexNameContainer, Codable {
1111

1212
/// Generated ABTestID of the ABTest.
1313
public let abTestID: ABTestID

Sources/AlgoliaSearchClient/Models/Analytics/ABTest/Task/ABTestDeletion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public struct ABTestDeletion: Task, Codable, IndexNameContainer {
10+
public struct ABTestDeletion: IndexTask, Codable, IndexNameContainer {
1111

1212
/// Generated ABTestID of the ABTest.
1313
public let abTestID: ABTestID

Sources/AlgoliaSearchClient/Models/Analytics/ABTest/Task/ABTestRevision.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public struct ABTestRevision: Task, IndexNameContainer, Codable {
10+
public struct ABTestRevision: IndexTask, IndexNameContainer, Codable {
1111

1212
/// Generated ABTestID of the ABTest.
1313
public let abTestID: ABTestID

Sources/AlgoliaSearchClient/Models/Common/Revision.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public struct Revision: Task, Codable {
10+
public struct Revision: IndexTask, Codable {
1111

1212
/// Date at which the update happened.
1313
public let updatedAt: Date

Sources/AlgoliaSearchClient/Models/Search/Indexing/Batch/BatchResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public struct BatchResponse: Codable, Task {
10+
public struct BatchResponse: Codable, IndexTask {
1111

1212
public let taskID: TaskID
1313
public let objectIDs: [ObjectID?]

0 commit comments

Comments
 (0)