@arrirpc/codegen-swift 0.67.0 → 0.68.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -9
- package/dist/index.cjs +8 -3
- package/dist/index.mjs +8 -3
- package/package.json +2 -2
package/README.md
CHANGED
@@ -61,9 +61,13 @@ then add `ArriClient` as a dependency to your target
|
|
61
61
|
let client = MyClient(
|
62
62
|
baseURL: "https://example.com",
|
63
63
|
delegate: DefaultRequestDelegate(),
|
64
|
-
headers {
|
64
|
+
headers: {
|
65
65
|
var headers: Dictionary<String, String> = Dictionary()
|
66
66
|
return headers
|
67
|
+
},
|
68
|
+
// optional
|
69
|
+
onError: { err in
|
70
|
+
// do something
|
67
71
|
}
|
68
72
|
)
|
69
73
|
|
@@ -156,14 +160,14 @@ await task.result
|
|
156
160
|
|
157
161
|
#### Available Event Source Options
|
158
162
|
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
164
|
-
-
|
165
|
-
-
|
166
|
-
-
|
163
|
+
- `onMessage` - Closure that fires whenever a "message" event is received from the server. This is the only required option.
|
164
|
+
- `onRequest` - Closure that fires when a request has been created but has not been executed yet.
|
165
|
+
- `onRequestError` - Closure that fires when there was an error in creating the request (i.e. a malformed URL), or if we were unable to connect to the server. (i.e a `connectionRefused` error)
|
166
|
+
- `onResponse` - Closure that fires when we receive a response from the server
|
167
|
+
- `onResponseError` - Closure that fires when the server has not responded with status code from `200` - `299` or the `Content-Type` header does not contain `text/event-stream`
|
168
|
+
- `onClose` - Closure that fires when the EventSource is closed. (This will only fire if the EventSource was already able successfully receive a response from the server.)
|
169
|
+
- `maxRetryCount` - Limit the number of times that the EventSource tries to reconnect to the server. When set to `nil` it will retry indefinitely. (Default is `nil`)
|
170
|
+
- `maxRetryInterval` - Set the max delay time between retries in milliseconds. Default is `30000`.
|
167
171
|
|
168
172
|
## Additional Notes
|
169
173
|
|
package/dist/index.cjs
CHANGED
@@ -1126,7 +1126,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
|
|
1126
1126
|
method: "${schema.method.toUpperCase()}",
|
1127
1127
|
headers: self.headers,
|
1128
1128
|
clientVersion: "${context.clientVersion}",
|
1129
|
-
${params ? `params: params` : "params: EmptyArriModel()"}
|
1129
|
+
${params ? `params: params` : "params: EmptyArriModel()"},
|
1130
|
+
onError: onError
|
1130
1131
|
)
|
1131
1132
|
${response ? `return result` : ""}
|
1132
1133
|
}`;
|
@@ -1213,20 +1214,24 @@ public class ${serviceName} {
|
|
1213
1214
|
let baseURL: String
|
1214
1215
|
let delegate: ArriRequestDelegate
|
1215
1216
|
let headers: () -> Dictionary<String, String>
|
1217
|
+
let onError: (Error) -> Void
|
1216
1218
|
${services.map((service) => ` public let ${service.key}: ${service.typeName}`).join("\n")}
|
1217
1219
|
public init(
|
1218
1220
|
baseURL: String,
|
1219
1221
|
delegate: ArriRequestDelegate,
|
1220
|
-
headers: @escaping () -> Dictionary<String, String
|
1222
|
+
headers: @escaping () -> Dictionary<String, String>,
|
1223
|
+
onError: @escaping ((Error) -> Void) = { _ -> Void in }
|
1221
1224
|
) {
|
1222
1225
|
self.baseURL = baseURL
|
1223
1226
|
self.delegate = delegate
|
1224
1227
|
self.headers = headers
|
1228
|
+
self.onError = onError
|
1225
1229
|
${services.map(
|
1226
1230
|
(service) => ` self.${service.key} = ${service.typeName}(
|
1227
1231
|
baseURL: baseURL,
|
1228
1232
|
delegate: delegate,
|
1229
|
-
headers: headers
|
1233
|
+
headers: headers,
|
1234
|
+
onError: onError
|
1230
1235
|
)`
|
1231
1236
|
).join("\n")}
|
1232
1237
|
}
|
package/dist/index.mjs
CHANGED
@@ -1120,7 +1120,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
|
|
1120
1120
|
method: "${schema.method.toUpperCase()}",
|
1121
1121
|
headers: self.headers,
|
1122
1122
|
clientVersion: "${context.clientVersion}",
|
1123
|
-
${params ? `params: params` : "params: EmptyArriModel()"}
|
1123
|
+
${params ? `params: params` : "params: EmptyArriModel()"},
|
1124
|
+
onError: onError
|
1124
1125
|
)
|
1125
1126
|
${response ? `return result` : ""}
|
1126
1127
|
}`;
|
@@ -1207,20 +1208,24 @@ public class ${serviceName} {
|
|
1207
1208
|
let baseURL: String
|
1208
1209
|
let delegate: ArriRequestDelegate
|
1209
1210
|
let headers: () -> Dictionary<String, String>
|
1211
|
+
let onError: (Error) -> Void
|
1210
1212
|
${services.map((service) => ` public let ${service.key}: ${service.typeName}`).join("\n")}
|
1211
1213
|
public init(
|
1212
1214
|
baseURL: String,
|
1213
1215
|
delegate: ArriRequestDelegate,
|
1214
|
-
headers: @escaping () -> Dictionary<String, String
|
1216
|
+
headers: @escaping () -> Dictionary<String, String>,
|
1217
|
+
onError: @escaping ((Error) -> Void) = { _ -> Void in }
|
1215
1218
|
) {
|
1216
1219
|
self.baseURL = baseURL
|
1217
1220
|
self.delegate = delegate
|
1218
1221
|
self.headers = headers
|
1222
|
+
self.onError = onError
|
1219
1223
|
${services.map(
|
1220
1224
|
(service) => ` self.${service.key} = ${service.typeName}(
|
1221
1225
|
baseURL: baseURL,
|
1222
1226
|
delegate: delegate,
|
1223
|
-
headers: headers
|
1227
|
+
headers: headers,
|
1228
|
+
onError: onError
|
1224
1229
|
)`
|
1225
1230
|
).join("\n")}
|
1226
1231
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arrirpc/codegen-swift",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.68.0",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": {
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"dist"
|
23
23
|
],
|
24
24
|
"dependencies": {
|
25
|
-
"@arrirpc/codegen-utils": "0.
|
25
|
+
"@arrirpc/codegen-utils": "0.68.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {}
|
28
28
|
}
|