Skip to content

Commit 43afefb

Browse files
committed
Update WebServiceProxy.
1 parent bf2f2c6 commit 43afefb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public func invoke<B: Encodable>(_ method: Method, path: String,
4242
arguments: [String: Sendable] = [:],
4343
body: B) async throws { ... }
4444

45-
public func invoke<T: Decodable>(_ method: Method, path: String,
45+
public func invoke<T: Decodable & SendableMetatype>(_ method: Method, path: String,
4646
arguments: [String: Sendable] = [:],
4747
content: Data? = nil,
4848
contentType: String? = nil) async throws -> T { ... }
4949

50-
public func invoke<B: Encodable, T: Decodable>(_ method: Method, path: String,
50+
public func invoke<B: Encodable, T: Decodable & SendableMetatype>(_ method: Method, path: String,
5151
arguments: [String: Sendable] = [:],
5252
body: B) async throws -> T { ... }
5353

@@ -67,7 +67,7 @@ All variants accept the following arguments:
6767
The first two versions execute a service method that does not return a value. The following two versions deserialize a service response of type `T` using `JSONDecoder`. The final version accepts a `ResponseHandler` callback to facilitate decoding of custom response content:
6868

6969
```swift
70-
public typealias ResponseHandler<T> = (_ content: Data, _ contentType: String?) throws -> T
70+
public typealias ResponseHandler<T> = @Sendable (_ content: Data, _ contentType: String?) throws -> T
7171
```
7272

7373
Three of the methods accept the following arguments for specifying custom request body content:

Sources/Echo/WebServiceProxy.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class WebServiceProxy {
3333
- parameter content: The response content.
3434
- parameter contentType: The response content type, or `nil` if the content type is not known.
3535
*/
36-
public typealias ResponseHandler<T> = (_ content: Data, _ contentType: String?) throws -> T
36+
public typealias ResponseHandler<T> = @Sendable (_ content: Data, _ contentType: String?) throws -> T
3737

3838
/**
3939
Creates a new web service proxy.
@@ -129,7 +129,7 @@ public class WebServiceProxy {
129129
- parameter contentType: The request content type, or `nil` for no content type.
130130
- returns The response body.
131131
*/
132-
public func invoke<T: Decodable>(_ method: Method, path: String,
132+
public func invoke<T: Decodable & SendableMetatype>(_ method: Method, path: String,
133133
arguments: [String: Sendable] = [:],
134134
content: Data? = nil,
135135
contentType: String? = nil) async throws -> T {
@@ -147,7 +147,7 @@ public class WebServiceProxy {
147147
- parameter body: The request body.
148148
- returns The response body.
149149
*/
150-
public func invoke<B: Encodable, T: Decodable>(_ method: Method, path: String,
150+
public func invoke<B: Encodable, T: Decodable & SendableMetatype>(_ method: Method, path: String,
151151
arguments: [String: Sendable] = [:],
152152
body: B) async throws -> T {
153153
return try await invoke(method, path: path,

0 commit comments

Comments
 (0)