Skip to content

Commit cb2595d

Browse files
committed
fix: multipart testing
1 parent f8f7c32 commit cb2595d

File tree

8 files changed

+46
-39
lines changed

8 files changed

+46
-39
lines changed

Sources/Appwrite/Services/Account.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ open class Account: Service {
214214
}
215215

216216
///
217-
/// List Identities
217+
/// List identities
218218
///
219219
/// Get the list of identities for the currently logged in user.
220220
///
@@ -402,7 +402,7 @@ open class Account: Service {
402402
}
403403

404404
///
405-
/// Create Authenticator
405+
/// Create authenticator
406406
///
407407
/// Add an authenticator app to be used as an MFA factor. Verify the
408408
/// authenticator using the [verify
@@ -439,7 +439,7 @@ open class Account: Service {
439439
}
440440

441441
///
442-
/// Verify Authenticator
442+
/// Verify authenticator
443443
///
444444
/// Verify an authenticator app after adding it using the [add
445445
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
@@ -480,7 +480,7 @@ open class Account: Service {
480480
}
481481

482482
///
483-
/// Verify Authenticator
483+
/// Verify authenticator
484484
///
485485
/// Verify an authenticator app after adding it using the [add
486486
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
@@ -503,7 +503,7 @@ open class Account: Service {
503503
}
504504

505505
///
506-
/// Delete Authenticator
506+
/// Delete authenticator
507507
///
508508
/// Delete an authenticator for a user by ID.
509509
///
@@ -531,7 +531,7 @@ open class Account: Service {
531531
}
532532

533533
///
534-
/// Create MFA Challenge
534+
/// Create MFA challenge
535535
///
536536
/// Begin the process of MFA verification after sign-in. Finish the flow with
537537
/// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -568,7 +568,7 @@ open class Account: Service {
568568
}
569569

570570
///
571-
/// Create MFA Challenge (confirmation)
571+
/// Create MFA challenge (confirmation)
572572
///
573573
/// Complete the MFA challenge by providing the one-time password. Finish the
574574
/// process of MFA verification by providing the one-time password. To begin
@@ -604,7 +604,7 @@ open class Account: Service {
604604
}
605605

606606
///
607-
/// List Factors
607+
/// List factors
608608
///
609609
/// List the factors available on the account to be used as a MFA challange.
610610
///
@@ -635,7 +635,7 @@ open class Account: Service {
635635
}
636636

637637
///
638-
/// Get MFA Recovery Codes
638+
/// Get MFA recovery codes
639639
///
640640
/// Get recovery codes that can be used as backup for MFA flow. Before getting
641641
/// codes, they must be generated using
@@ -669,7 +669,7 @@ open class Account: Service {
669669
}
670670

671671
///
672-
/// Create MFA Recovery Codes
672+
/// Create MFA recovery codes
673673
///
674674
/// Generate recovery codes as backup for MFA flow. It's recommended to
675675
/// generate and show then immediately after user successfully adds their
@@ -704,7 +704,7 @@ open class Account: Service {
704704
}
705705

706706
///
707-
/// Regenerate MFA Recovery Codes
707+
/// Regenerate MFA recovery codes
708708
///
709709
/// Regenerate recovery codes that can be used as backup for MFA flow. Before
710710
/// regenerating codes, they must be first generated using

Sources/Appwrite/Services/Functions.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ open class Functions: Service {
720720
/// function execution process will start asynchronously.
721721
///
722722
/// @param String functionId
723-
/// @param String body
723+
/// @param payload body
724724
/// @param Bool async
725725
/// @param String path
726726
/// @param AppwriteEnums.ExecutionMethod method
@@ -731,17 +731,18 @@ open class Functions: Service {
731731
///
732732
open func createExecution(
733733
functionId: String,
734-
body: String? = nil,
734+
body: payload? = nil,
735735
async: Bool? = nil,
736736
path: String? = nil,
737737
method: AppwriteEnums.ExecutionMethod? = nil,
738738
headers: Any? = nil,
739-
scheduledAt: String? = nil
739+
scheduledAt: String? = nil,
740+
onProgress: ((UploadProgress) -> Void)? = nil
740741
) async throws -> AppwriteModels.Execution {
741742
let apiPath: String = "/functions/{functionId}/executions"
742743
.replacingOccurrences(of: "{functionId}", with: functionId)
743744

744-
let apiParams: [String: Any?] = [
745+
var apiParams: [String: Any?] = [
745746
"body": body,
746747
"async": async,
747748
"path": path,
@@ -750,20 +751,23 @@ open class Functions: Service {
750751
"scheduledAt": scheduledAt
751752
]
752753

753-
let apiHeaders: [String: String] = [
754-
"content-type": "application/json"
754+
var apiHeaders: [String: String] = [
755+
"content-type": "multipart/form-data"
755756
]
756757

757758
let converter: (Any) -> AppwriteModels.Execution = { response in
758759
return AppwriteModels.Execution.from(map: response as! [String: Any])
759760
}
760761

761-
return try await client.call(
762-
method: "POST",
762+
let idParamName: String? = nil
763+
return try await client.chunkedUpload(
763764
path: apiPath,
764-
headers: apiHeaders,
765-
params: apiParams,
766-
converter: converter
765+
headers: &apiHeaders,
766+
params: &apiParams,
767+
paramName: paramName,
768+
idParamName: idParamName,
769+
converter: converter,
770+
onProgress: onProgress
767771
)
768772
}
769773

Sources/Appwrite/Services/Locale.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ open class Locale: Service {
4545
}
4646

4747
///
48-
/// List Locale Codes
48+
/// List locale codes
4949
///
5050
/// List of all locale codes in [ISO
5151
/// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

Sources/Appwrite/Services/Storage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ open class Storage: Service {
426426
}
427427

428428
///
429-
/// Delete File
429+
/// Delete file
430430
///
431431
/// Delete a file by its unique ID. Only users with write permissions have
432432
/// access to delete this resource.

Sources/Appwrite/Services/Users.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ open class Users: Service {
305305
}
306306

307307
///
308-
/// List Identities
308+
/// List identities
309309
///
310310
/// Get identities for all users.
311311
///
@@ -1208,7 +1208,7 @@ open class Users: Service {
12081208
}
12091209

12101210
///
1211-
/// Delete Authenticator
1211+
/// Delete authenticator
12121212
///
12131213
/// Delete an authenticator app.
12141214
///
@@ -1246,7 +1246,7 @@ open class Users: Service {
12461246
}
12471247

12481248
///
1249-
/// Delete Authenticator
1249+
/// Delete authenticator
12501250
///
12511251
/// Delete an authenticator app.
12521252
///
@@ -1267,7 +1267,7 @@ open class Users: Service {
12671267
}
12681268

12691269
///
1270-
/// List Factors
1270+
/// List factors
12711271
///
12721272
/// List the factors available on the account to be used as a MFA challange.
12731273
///
@@ -1301,7 +1301,7 @@ open class Users: Service {
13011301
}
13021302

13031303
///
1304-
/// Get MFA Recovery Codes
1304+
/// Get MFA recovery codes
13051305
///
13061306
/// Get recovery codes that can be used as backup for MFA flow by User ID.
13071307
/// Before getting codes, they must be generated using
@@ -1338,7 +1338,7 @@ open class Users: Service {
13381338
}
13391339

13401340
///
1341-
/// Regenerate MFA Recovery Codes
1341+
/// Regenerate MFA recovery codes
13421342
///
13431343
/// Regenerate recovery codes that can be used as backup for MFA flow by User
13441344
/// ID. Before regenerating codes, they must be first generated using
@@ -1375,7 +1375,7 @@ open class Users: Service {
13751375
}
13761376

13771377
///
1378-
/// Create MFA Recovery Codes
1378+
/// Create MFA recovery codes
13791379
///
13801380
/// Generate recovery codes used as backup for MFA flow for User ID. Recovery
13811381
/// codes can be used as a MFA verification type in
@@ -1903,7 +1903,7 @@ open class Users: Service {
19031903
}
19041904

19051905
///
1906-
/// List User Targets
1906+
/// List user targets
19071907
///
19081908
/// List the messaging targets that are associated with a user.
19091909
///
@@ -1941,7 +1941,7 @@ open class Users: Service {
19411941
}
19421942

19431943
///
1944-
/// Create User Target
1944+
/// Create user target
19451945
///
19461946
/// Create a messaging target.
19471947
///
@@ -1991,7 +1991,7 @@ open class Users: Service {
19911991
}
19921992

19931993
///
1994-
/// Get User Target
1994+
/// Get user target
19951995
///
19961996
/// Get a user's push notification target by ID.
19971997
///
@@ -2028,7 +2028,7 @@ open class Users: Service {
20282028
}
20292029

20302030
///
2031-
/// Update User target
2031+
/// Update user target
20322032
///
20332033
/// Update a messaging target.
20342034
///

Sources/AppwriteEnums/Runtime.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public enum Runtime: String, Codable {
2121
case python311 = "python-3.11"
2222
case python312 = "python-3.12"
2323
case pythonMl311 = "python-ml-3.11"
24+
case deno121 = "deno-1.21"
25+
case deno124 = "deno-1.24"
26+
case deno135 = "deno-1.35"
2427
case deno140 = "deno-1.40"
2528
case dart215 = "dart-2.15"
2629
case dart216 = "dart-2.16"

Sources/AppwriteModels/Execution.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Execution {
3838
public let responseStatusCode: Int
3939

4040
/// HTTP response body. This will return empty unless execution is created as synchronous.
41-
public let responseBody: String
41+
public let responseBody: payload
4242

4343
/// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous.
4444
public let responseHeaders: [Headers]
@@ -68,7 +68,7 @@ public class Execution {
6868
requestPath: String,
6969
requestHeaders: [Headers],
7070
responseStatusCode: Int,
71-
responseBody: String,
71+
responseBody: payload,
7272
responseHeaders: [Headers],
7373
logs: String,
7474
errors: String,
@@ -129,7 +129,7 @@ public class Execution {
129129
requestPath: map["requestPath"] as! String,
130130
requestHeaders: (map["requestHeaders"] as! [[String: Any]]).map { Headers.from(map: $0) },
131131
responseStatusCode: map["responseStatusCode"] as! Int,
132-
responseBody: map["responseBody"] as! String,
132+
responseBody: map["responseBody"] as! payload,
133133
responseHeaders: (map["responseHeaders"] as! [[String: Any]]).map { Headers.from(map: $0) },
134134
logs: map["logs"] as! String,
135135
errors: map["errors"] as! String,

docs/examples/functions/create-execution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let functions = Functions(client)
1010

1111
let execution = try await functions.createExecution(
1212
functionId: "<FUNCTION_ID>",
13-
body: "<BODY>", // optional
13+
body: , // optional
1414
async: false, // optional
1515
path: "<PATH>", // optional
1616
method: .gET, // optional

0 commit comments

Comments
 (0)