Comments (3)
With the new APIs, you'll be able to use URLRequest
, but what if you want to, let's say, change only the cache policy?
func send<Response>(
_ request: Request<Response>,
cachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy
) async throws -> Response where Response: Decodable
from get.
Another options to cover the latest requirement:
public struct RequestOptions {
public var cachePolicy: URLRequest.CachePolicy?
public var timeoutInterval: TimeInterval?
// Etc
}
public protocol APIClient2 {
public func send<T: Decodable>(
_ request: Request<T>,
options: RequestOptions = .init(),
delegate: URLSessionDataDelegate? = nil
) async throws -> Response<T>
}
from get.
Going with RequestOptions
and also a low-level API to send URLRequest
and decoding a request.
from get.
Related Issues (20)
- CocoaPods support HOT 1
- Concurrency warning HOT 2
- can't get this to build to xcframeworks
- AnyEncodable
- send(_:) method always tries to decode empty response since newest version HOT 6
- Crashes with Swift 5.7 and Xcode14 HOT 6
- Add `MultiAPIClientDelegate`, a delegate that forwards calls to multiple underlying delegates. HOT 2
- How to handle 422 json error response? HOT 4
- Post processing of raw response in delegate, like client(,willSendRequest:) HOT 4
- Conforming to `Codable` HOT 2
- Problem with sending post requests HOT 1
- Add urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:) to DataLoader's implemented delegate callbacks HOT 1
- multipart/form-data integration? HOT 3
- Some methods of custom URLSessionDelegate are ignored by APIClient HOT 2
- multipart/form-data example
- Problem with Pulse
- How to globally set a common group of header HOT 1
- Is there a throttle feature to avoid duplicate call? HOT 1
- Error of No such module 'Get'
- Cookies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from get.