Skip to content

Releases: kean/Get

Get 2.0.1

13 Sep 11:57
Compare
Choose a tag to compare
  • Add support for Xcode 14 (fix build issue on macOS)

Get 1.0.3

13 Sep 22:07
Compare
Choose a tag to compare
  • Add Xcode 14 support to the previous release (Get 1.x)

Get 2.0

27 Aug 01:06
d2ded85
Compare
Choose a tag to compare

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 single HTTPMethod type. Example: Request(path: "/user", method: .patch)
  • The first parameter in the Request initializer is now path or url, not method that has a default value
  • Add a new Request initializer that defaults to the Void response type unless you specify it explicitly
  • Make body property of Request writable
  • Add upload(for:data:) method - #50, thanks to @soemarko
  • Replace APIDelegate client(_:makeURLFor:query:) method with client(_:makeURLForRequest:) so that you have complete access to the Request
  • Remove APIs deprecated in Get 1.0

See #51 for the reasoning behind the Request changes

Get 2.0 (Beta 1)

19 Aug 01:01
df7bc14
Compare
Choose a tag to compare
Get 2.0 (Beta 1) Pre-release
Pre-release

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 single HTTPMethod type. Example: Request(path: "/user", method: .patch)
  • The first parameter in the Request initializer is now path or url, not method that has a default value
  • Add a new Request initializer that defaults to the Void response type unless you specify it explicitly
  • Make body property of Request writable
  • Add upload(for:data:) method - #50, thanks to @soemarko
  • Replace APIDelegate client(_:makeURLFor:query:) method with client(_:makeURLForRequest:) so that you have complete access to the Request
  • Remove APIs deprecated in Get 1.0

See #51 for the reasoning behind the Request changes

Get 1.0.2

04 Aug 01:06
db5248c
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 1.0.1...1.0.2

Get 1.0.1

26 Jul 22:22
Compare
Choose a tag to compare
  • Add @discardableResult to all upload() and send() methods

Get 1.0

26 Jul 21:23
Compare
Choose a tag to compare

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 to send() method that sets task-specific URLSessionDataDelegate - #38
  • Add configure parameter to send() method that allows configuring URLRequest 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:) to APIClientDelegate that allows to customize validation logic
  • Add client(_:makeURLForRequest:) method to APIClientDelegate to address #35
  • Add task, originalRequest, currentRequest to Response
  • Add APIClient/makeURLRequest(for:) method to the client in case you need to create URLRequest without initiating the download
  • Add a way to override Content-Type and Accept headers using session httpAdditionalHeaders and Request headers
  • Add new Request factory methods that default to Void as a response type and streamline the existing methods
  • Add withResponse(_:) to allow changing request's response type
  • Add sessionDelegateQueue parameter to APIClient.Configuration
  • Add support for sessionDelegate from APIClient.Configuration on Linux
  • Add public configuration and session properties to APIClient
  • Rename Request/path to Request/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 the baseURL
  • 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)

11 Jul 21:56
Compare
Choose a tag to compare
Get 1.0 (RC3) Pre-release
Pre-release
  • Update documentation
  • Move decoding out of performWithRetries so its failure won't trigger shouldRetry
  • Fix an issue with willSendRequest throwing an error
  • Add id to Request init
  • Add public body property to Request and remove deprecated path
  • Remove send() -> Response<T?> variant

Get 1.0 (RC2)

11 Jul 02:54
Compare
Choose a tag to compare
Get 1.0 (RC2) Pre-release
Pre-release

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 to send() method that sets task-specific URLSessionDataDelegate - #38
  • Add configure parameter to send() method that allows configuring URLRequest 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:) to APIClientDelegate that allows to customize validation logic
  • Add client(_:makeURLForRequest:) method to APIClientDelegate to address #35
  • Add task, originalRequest, currentRequest to Response
  • Add APIClient/makeURLRequest(for:) method to the client in case you need to create URLRequest without initiating the download
  • Add a way to override Content-Type and Accept headers using session httpAdditionalHeaders and Request headers
  • Add new Request factory methods that default to Void as a response type and streamline the existing methods
  • Add withResponse(_:) to allow changing request's response type
  • Add sessionDelegateQueue parameter to APIClient.Configuration
  • Add support for sessionDelegate from APIClient.Configuration on Linux
  • Add public configuration and session properties to APIClient
  • Rename Request/path to Request/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 the baseURL
  • 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)

09 Jul 21:46
e62a1cc
Compare
Choose a tag to compare
Get 1.0 (RC1) Pre-release
Pre-release

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 to send() method that sets task-specific URLSessionDataDelegate - #38
  • Add configure parameter to send() method that allows configuring URLRequest 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 to APIClient.Configuration
  • Add support for sessionDelegate from APIClient.Configuration on Linux
  • Fix an issue with paths that don't start with "/" not being appended to the baseURL
  • 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