-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladislav Alekseev
committed
Sep 28, 2020
1 parent
ac7e50f
commit abd2741
Showing
26 changed files
with
286 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Dispatch | ||
import Foundation | ||
import QueueModels | ||
import Types | ||
|
||
public protocol JobDeleter { | ||
func delete( | ||
jobId: JobId, | ||
callbackQueue: DispatchQueue, | ||
completion: @escaping (Either<(), Error>) -> () | ||
) | ||
} |
32 changes: 32 additions & 0 deletions
32
Sources/QueueClient/Clients/JobDeleter/JobDeleterImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Dispatch | ||
import Foundation | ||
import QueueModels | ||
import RESTMethods | ||
import RequestSender | ||
import Types | ||
|
||
public final class JobDeleterImpl: JobDeleter { | ||
private let requestSender: RequestSender | ||
|
||
public init(requestSender: RequestSender) { | ||
self.requestSender = requestSender | ||
} | ||
|
||
public func delete( | ||
jobId: JobId, | ||
callbackQueue: DispatchQueue, | ||
completion: @escaping (Either<(), Error>) -> () | ||
) { | ||
let request = JobDeleteRequest( | ||
payload: JobDeletePayload( | ||
jobId: jobId | ||
) | ||
) | ||
requestSender.sendRequestWithCallback( | ||
request: request, | ||
callbackQueue: callbackQueue | ||
) { (result: Either<JobDeleteResponse, RequestSenderError>) in | ||
completion(result.mapResult { _ in () }) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Sources/QueueClient/Clients/JobResultsFetcher/JobResultsFetcher.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Dispatch | ||
import Foundation | ||
import QueueModels | ||
import Types | ||
|
||
public protocol JobResultsFetcher { | ||
func fetch( | ||
jobId: JobId, | ||
callbackQueue: DispatchQueue, | ||
completion: @escaping (Either<JobResults, Error>) -> () | ||
) | ||
} |
35 changes: 35 additions & 0 deletions
35
Sources/QueueClient/Clients/JobResultsFetcher/JobResultsFetcherImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Foundation | ||
import QueueModels | ||
import RESTMethods | ||
import RequestSender | ||
import Types | ||
|
||
public final class JobResultsFetcherImpl: JobResultsFetcher { | ||
private let requestSender: RequestSender | ||
|
||
public init(requestSender: RequestSender) { | ||
self.requestSender = requestSender | ||
} | ||
|
||
public func fetch( | ||
jobId: JobId, | ||
callbackQueue: DispatchQueue, | ||
completion: @escaping (Either<JobResults, Error>) -> () | ||
) { | ||
let request = JobResultRequest( | ||
payload: JobResultsPayload( | ||
jobId: jobId | ||
) | ||
) | ||
|
||
requestSender.sendRequestWithCallback( | ||
request: request, | ||
callbackQueue: callbackQueue, | ||
callback: { (response: Either<JobResultsResponse, RequestSenderError>) in | ||
completion( | ||
response.mapResult { $0.jobResults } | ||
) | ||
} | ||
) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.