Releases: kean/Get
Get 2.0.1
Get 1.0.3
Get 2.0
This release is a quick follow-up to Get 1.0 that fixes some of the shortcomings of the original Request
type design.
Request
can now be initialized with either a string (path: String
) or a URL (url: URL
)- Replace separate
.get(...)
,.post(...)
, and other factory methods with a singleHTTPMethod
type. Example:Request(path: "/user", method: .patch)
- The first parameter in the
Request
initializer is nowpath
orurl
, notmethod
that has a default value - Add a new
Request
initializer that defaults to theVoid
response type unless you specify it explicitly - Make
body
property ofRequest
writable - Add
upload(for:data:)
method - #50, thanks to @soemarko - Replace
APIDelegate
client(_:makeURLFor:query:)
method withclient(_:makeURLForRequest:)
so that you have complete access to theRequest
- Remove APIs deprecated in Get 1.0
See #51 for the reasoning behind the
Request
changes
Get 2.0 (Beta 1)
This release is a quick follow-up to Get 1.0 that fixes some of the shortcomings of the original design of the Request
type.
Request
can now be initialized with either a string (path: String
) or a URL (url: URL
)- Replace separate
.get(...)
,.post(...)
, and other factory methods with a singleHTTPMethod
type. Example:Request(path: "/user", method: .patch)
- The first parameter in the
Request
initializer is nowpath
orurl
, notmethod
that has a default value - Add a new
Request
initializer that defaults to theVoid
response type unless you specify it explicitly - Make
body
property ofRequest
writable - Add
upload(for:data:)
method - #50, thanks to @soemarko - Replace
APIDelegate
client(_:makeURLFor:query:)
method withclient(_:makeURLForRequest:)
so that you have complete access to theRequest
- Remove APIs deprecated in Get 1.0
See #51 for the reasoning behind the
Request
changes
Get 1.0.2
What's Changed
- Revert back to supporting Swift 5.5 by @liamnichols in #47
New Contributors
- @liamnichols made their first contribution in #47
Full Changelog: 1.0.1...1.0.2
Get 1.0.1
Get 1.0
Get 1.0 is a big release that brings it on par with Moya+Alamofire while still keeping its API surface small and focused. This release also includes new reworked documentation generated using DocC, and many other improvements.
The first major change is the addition of two new parameters the existing send
method: delegate
and configure
:
public func send<T: Decodable>(
_ request: Request<T>,
delegate: URLSessionDataDelegate? = nil,
configure: ((inout URLRequest) -> Void)? = nil
) async throws -> Response<T>
With delegate
, you can modify the behavior of the underlying task, monitor the progress, etc. And with the new configure
closure, you get access to the entire URLRequest
API:
let user = try await client.send(.get("/user")) {
$0.cachePolicy = .reloadIgnoringLocalCacheData
}
The second major change is the addition of new methods: upload(...)
for uploading data from a file and download(...)
for downloading data to a file.
let response = try await client.download(for: .get("/user"))
let fileURL = response.location
try await client.upload(for: .post("/avatar"), fromFile: fileURL)
Changes
- Add a
delegate
parameter tosend()
method that sets task-specificURLSessionDataDelegate
- #38 - Add
configure
parameter tosend()
method that allows configuringURLRequest
before it is sent - Add support for downloading to a file with a new
download(for:delegate:configure:)
method - #40 - Add support for uploading data from a file with a new
upload(for:withFile:delegate:configure:)
method - Add an option to do more than one retry attempt using the reworked
client(_:shouldRetryRequest:attempts:error:)
delegate method (the method with an old signature is deprecated) - Add
client(_:validateResponse:data:request:)
toAPIClientDelegate
that allows to customize validation logic - Add
client(_:makeURLForRequest:)
method toAPIClientDelegate
to address #35 - Add
task
,originalRequest
,currentRequest
toResponse
- Add
APIClient/makeURLRequest(for:)
method to the client in case you need to createURLRequest
without initiating the download - Add a way to override
Content-Type
andAccept
headers using sessionhttpAdditionalHeaders
andRequest
headers - Add new
Request
factory methods that default toVoid
as a response type and streamline the existing methods - Add
withResponse(_:)
to allow changing request's response type - Add
sessionDelegateQueue
parameter toAPIClient.Configuration
- Add support for
sessionDelegate
fromAPIClient.Configuration
on Linux - Add public
configuration
andsession
properties toAPIClient
- Rename
Request/path
toRequest/url
making it clear that absolute URLs are also supported - Improve decoding/encoding performance by using
Task.detached
instead of using a separate actor for serialization - Remove send() -> Response<T?> variant
- Remove APIs deprecated in previous versions
Fixes
- Fix an issue with paths that don't start with
"/"
not being appended to thebaseURL
- Fix an issue with empty path not working. It is now treated the same way as "/"
Non-Code Changes
- Hide dependencies used only in test targets
- Documentation is now generated using DocC and is hosted on GitHub Pages
- Perform grammar check on CI
Get 1.0 (RC3)
- Update documentation
- Move decoding out of
performWithRetries
so its failure won't triggershouldRetry
- Fix an issue with
willSendRequest
throwing an error - Add
id
toRequest
init
- Add public
body
property toRequest
and remove deprecatedpath
- Remove
send() -> Response<T?>
variant
Get 1.0 (RC2)
Get 1.0 is a big release that brings it on par with Moya+Alamofire while still keeping its API surface small and focused. This release also includes new reworked documentation generated using DocC, and many other improvements.
The first major change is the addition of two new parameters the existing send
method: delegate
and configure
:
public func send<T: Decodable>(
_ request: Request<T>,
delegate: URLSessionDataDelegate? = nil,
configure: ((inout URLRequest) -> Void)? = nil
) async throws -> Response<T>
With delegate
, you can modify the behavior of the underlying task, monitor the progress, etc. And with the new configure
closure, you get access to the entire URLRequest
API:
let user = try await client.send(.get("/user")) {
$0.cachePolicy = .reloadIgnoringLocalCacheData
}
The second major change is the addition of new methods: upload(...)
for uploading data from a file and download(...)
for downloading data to a file.
let response = try await client.download(for: .get("/user"))
let fileURL = response.location
try await client.upload(for: .post("/avatar"), fromFile: fileURL)
Changes
- Add a
delegate
parameter tosend()
method that sets task-specificURLSessionDataDelegate
- #38 - Add
configure
parameter tosend()
method that allows configuringURLRequest
before it is sent - Add support for downloading to a file with a new
download(for:delegate:configure:)
method - #40 - Add support for uploading data from a file with a new
upload(for:withFile:delegate:configure:)
method - Add an option to do more than one retry attempt using the reworked
client(_:shouldRetryRequest:attempts:error:)
delegate method (the method with an old signature is deprecated) - Add
client(_:validateResponse:data:request:)
toAPIClientDelegate
that allows to customize validation logic - Add
client(_:makeURLForRequest:)
method toAPIClientDelegate
to address #35 - Add
task
,originalRequest
,currentRequest
toResponse
- Add
APIClient/makeURLRequest(for:)
method to the client in case you need to createURLRequest
without initiating the download - Add a way to override
Content-Type
andAccept
headers using sessionhttpAdditionalHeaders
andRequest
headers - Add new
Request
factory methods that default toVoid
as a response type and streamline the existing methods - Add
withResponse(_:)
to allow changing request's response type - Add
sessionDelegateQueue
parameter toAPIClient.Configuration
- Add support for
sessionDelegate
fromAPIClient.Configuration
on Linux - Add public
configuration
andsession
properties toAPIClient
- Rename
Request/path
toRequest/url
making it clear that absolute URLs are also supported - Improve decoding/encoding performance by using
Task.detached
instead of using a separate actor for serialization - Remove send() -> Response<T?> variant
- Remove APIs deprecated in previous versions
Fixes
- Fix an issue with paths that don't start with
"/"
not being appended to thebaseURL
- Fix an issue with empty path not working. It is now treated the same way as "/"
Non-Code Changes
- Hide dependencies used only in test targets
- Documentation is now generated using DocC and is hosted on GitHub Pages
- Perform grammar check on CI
Get 1.0 (RC1)
Get 1.0 beefs up the existing APIs by providing access to most of the underlying URLSession
APIs. This release also includes new documentation generated using DocC.
The main send
method now has two more options: delegate
and configure
:
public func send<T: Decodable>(
_ request: Request<T>,
delegate: URLSessionDataDelegate? = nil,
configure: ((inout URLRequest) -> Void)? = nil
) async throws -> Response<T>
Usage:
let user = try await client.send(.get("/user")) {
$0.cachePolicy = .reloadIgnoringLocalCacheData
}
Changes
- Add a
delegate
parameter tosend()
method that sets task-specificURLSessionDataDelegate
- #38 - Add
configure
parameter tosend()
method that allows configuringURLRequest
before its sent - Add support for download tasks with a new
download(for:delegate:configure)
method - #40 - Add an option to do more than one retry attempt using a reworked
client(_:shouldRetryRequest:attempts:error:)
delegate method - Add
client(_:makeURLForRequest:)
method to the client delegate to #35 - Add
sessionDelegateQueue
parameter toAPIClient.Configuration
- Add support for
sessionDelegate
fromAPIClient.Configuration
on Linux - Fix an issue with paths that don't start with
"/"
not being appended to thebaseURL
- Improve decoding/encoding performance by using
Task.detached
instead of using a separate actor for serialization - Remove APIs deprecated in previous versions
Non-Code Changes
- Hide dependencies used only in test targets
- Documentation is now generated using DocC and is hosted on GitHub Pages
- Perform grammar check on CI