WIP: Adding async await API to GET, POST, PUT, PATCH, DELETE and simple request.#91
Open
SimonNumberTwo wants to merge 10 commits intodevelopfrom
Open
WIP: Adding async await API to GET, POST, PUT, PATCH, DELETE and simple request.#91SimonNumberTwo wants to merge 10 commits intodevelopfrom
SimonNumberTwo wants to merge 10 commits intodevelopfrom
Conversation
added 6 commits
January 8, 2022 22:47
mrylmz
suggested changes
Jan 14, 2022
| } | ||
|
|
||
| public final class Client { | ||
| public typealias RequestResult<ResponseType> = (HTTPURLResponse?, Result<ResponseType, Error>) |
Contributor
There was a problem hiding this comment.
What is the difference to RequestCompletion? Looks like you have the same type signature for it.
Collaborator
Author
There was a problem hiding this comment.
The RequestCompletion is a completion function but the RequestResult is simply a return value. I would like to keep it as is to be more explicit. Furthermore I restructured the code so these type aliases are in the correct place.
| return nil | ||
| } | ||
|
|
||
| @available(iOS 15.0, macOS 12.0, *) |
Contributor
There was a problem hiding this comment.
Consider moving the Version restricted parts into an extension.
Collaborator
Author
There was a problem hiding this comment.
Restructured the Client.
added 4 commits
January 28, 2022 13:39
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With this PR the developers are able to use async await within their apps for network requests. It adds an API for GET, POST, PUT, PATCH, DELETE and a simple request. The body and response handling is adjusted to match the one where completion blocks are being used. Furthermore the possibility to use Combine was added to be able to include async network calls within a chain. Also, which can be discussed is the fact that retrying was added to the
Taskconcurrency mechanism. Maybe we also want this for the completion API or we simply remove it as it won't be used for now.The state of the MR is currently WIP as we haven't yet decided what to do with the synchronous execution. Furthermore this is just a proposal which should be discussed within this PR.
Additional Notes
The API is currently only available for iOS 13.0 and macOS 10.15 apps due to additional backward compatibility of
URLSession.dataTask.