diff --git a/QuizTrain/Network/ObjectAPI.swift b/QuizTrain/Network/ObjectAPI.swift index f2d5cec..db15466 100644 --- a/QuizTrain/Network/ObjectAPI.swift +++ b/QuizTrain/Network/ObjectAPI.swift @@ -308,7 +308,7 @@ extension ObjectAPI { handler closures when complete. Swift inference auto-detects which process(...) method to call. - The value passed to a Outcome.succeeded and .failed cases varies. See + The value passed to a Outcome.success and .failed cases varies. See method comments for details. If handle429TooManyRequestErrors is true and the API returned a 429 Too @@ -323,8 +323,8 @@ extension ObjectAPI { /** Process API.RequestOutcome's to delete an object. - - Outcome.succeeded receives an API.DataResponse. - - Outcome.failed receives a RequestError. + - Outcome.success receives an API.DataResponse. + - Outcome.failure receives a RequestError. */ fileprivate func process(_ apiRequestOutcome: API.RequestOutcome, retryHandler: @escaping (() -> Void), completionHandler: @escaping (Outcome) -> Void) { @@ -352,9 +352,9 @@ extension ObjectAPI { /** Process API.RequestOutcome's to get a single object. - - Outcome.succeeded receives an object deserialized from + - Outcome.success receives an object deserialized from API.RequestOutcome. - - Outcome.failed receives a DataRequestError. + - Outcome.failure receives a DataRequestError. */ fileprivate func process(_ apiRequestOutcome: API.RequestOutcome, retryHandler: @escaping (() -> Void), completionHandler: @escaping (Outcome) -> Void) { @@ -382,9 +382,9 @@ extension ObjectAPI { /** Process API.RequestOutcome's to get multiple objects. - - Outcome.succeeded receives 0+ object(s) deserialized from + - Outcome.success receives 0+ object(s) deserialized from API.RequestOutcome. - - Outcome.failed receives a DataRequestError. + - Outcome.failure receives a DataRequestError. */ fileprivate func process(_ apiRequestOutcome: API.RequestOutcome, retryHandler: @escaping (() -> Void), completionHandler: @escaping (Outcome<[ObjectType], DataRequestError>) -> Void) { @@ -413,9 +413,9 @@ extension ObjectAPI { Process API.RequestOutcome's to add or update an object returning a new added/updated object if successful. - - Outcome.succeeded receives an object deserialized from + - Outcome.success receives an object deserialized from API.RequestOutcome. - - Outcome.failed receives an UpdateRequestError. + - Outcome.failure receives an UpdateRequestError. */ fileprivate func process(_ apiRequestOutcome: API.RequestOutcome, retryHandler: @escaping (() -> Void), completionHandler: @escaping (Outcome) -> Void) { @@ -448,9 +448,9 @@ extension ObjectAPI { Process API.RequestOutcome's to add or update multiple objects returning an array of the added/updated objects if successful. - - Outcome.succeeded receives an array of objects deserialized from + - Outcome.success receives an array of objects deserialized from API.RequestOutcome. - - Outcome.failed receives an UpdateRequestError. + - Outcome.failure receives an UpdateRequestError. */ fileprivate func process(_ apiRequestOutcome: API.RequestOutcome, retryHandler: @escaping (() -> Void), completionHandler: @escaping (Outcome<[ObjectType], UpdateRequestError>) -> Void) { diff --git a/README.md b/README.md index 8002fe5..fe86f71 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.getCases(inProjectWithId: 5) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let cases): + case .success(let cases): print(cases) // Do something with cases. } } @@ -46,9 +46,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.addCase(newCase, to: section) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let `case`): + case .success(let `case`): print(`case`.title) // Do something with the newly created `case`. } } @@ -61,9 +61,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.updateSuite(suite) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let updatedSuite): + case .success(let updatedSuite): print(updatedSuite.description) // "Updated description for this suite." print(updatedSuite.name) // "Updated name of this suite." } @@ -75,9 +75,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.deleteSection(section) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(_): // nil on successful deletes + case .success(_): // nil on successful deletes print("The section has been successfully deleted.") } } @@ -88,9 +88,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.closePlan(plan) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let closedPlan): + case .success(let closedPlan): print(closedPlan.isCompleted) // true print(closedPlan.completedOn) // timestamp } @@ -102,9 +102,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s milestone.parent(objectAPI) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let optionalParent): + case .success(let optionalParent): if let parent = optionalParent { print("Milestone \(milestone.id) has a parent with an id of \(parent.id).") } else { @@ -119,9 +119,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.getRuns(inProjectWithId: 3, filteredBy: filters) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let completedRuns): + case .success(let completedRuns): for completedRun in completedRuns { print(completedRun.isCompleted) // true } @@ -136,9 +136,9 @@ Below shows a limited number of examples. For all examples see [ObjectAPITests.s objectAPI.getPlans(in: project, filteredBy: filters) { (outcome) in switch outcome { - case .failed(let error): + case .failure(let error): print(error.debugDescription) - case .succeeded(let plans): // There will be 5 or less plans. + case .success(let plans): // There will be 5 or less plans. for plan in plans { print(plan.name) }