Skip to content

Commit 30490c4

Browse files
committed
Release candidate for 1.5.x
1 parent 95517a3 commit 30490c4

File tree

7 files changed

+90
-9
lines changed

7 files changed

+90
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies:
3131

3232
```swift
3333
dependencies: [
34-
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "5.0.0-rc.5"),
34+
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "5.0.0-rc.6"),
3535
],
3636
```
3737

Sources/Appwrite/Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ open class Client {
2323
"x-sdk-name": "Apple",
2424
"x-sdk-platform": "client",
2525
"x-sdk-language": "apple",
26-
"x-sdk-version": "5.0.0-rc.5",
26+
"x-sdk-version": "5.0.0-rc.6",
2727
"x-appwrite-response-format": "1.5.0"
2828
]
2929

Sources/Appwrite/Services/Account.swift

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ open class Account: Service {
350350
///
351351
/// Update MFA
352352
///
353+
/// Enable or disable MFA on an account.
354+
///
353355
/// @param Bool mfa
354356
/// @throws Exception
355357
/// @return array
@@ -384,6 +386,8 @@ open class Account: Service {
384386
///
385387
/// Update MFA
386388
///
389+
/// Enable or disable MFA on an account.
390+
///
387391
/// @param Bool mfa
388392
/// @throws Exception
389393
/// @return array
@@ -433,6 +437,8 @@ open class Account: Service {
433437
///
434438
/// Create MFA Challenge (confirmation)
435439
///
440+
/// Complete the MFA challenge by providing the one-time password.
441+
///
436442
/// @param String challengeId
437443
/// @param String otp
438444
/// @throws Exception
@@ -463,6 +469,8 @@ open class Account: Service {
463469
///
464470
/// List Factors
465471
///
472+
/// List the factors available on the account to be used as a MFA challange.
473+
///
466474
/// @throws Exception
467475
/// @return array
468476
///
@@ -492,6 +500,11 @@ open class Account: Service {
492500
///
493501
/// Add Authenticator
494502
///
503+
/// Add an authenticator app to be used as an MFA factor. Verify the
504+
/// authenticator using the [verify
505+
/// authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
506+
/// method.
507+
///
495508
/// @param AppwriteEnums.AuthenticatorType type
496509
/// @throws Exception
497510
/// @return array
@@ -524,6 +537,10 @@ open class Account: Service {
524537
///
525538
/// Verify Authenticator
526539
///
540+
/// Verify an authenticator app after adding it using the [add
541+
/// authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
542+
/// method.
543+
///
527544
/// @param AppwriteEnums.AuthenticatorType type
528545
/// @param String otp
529546
/// @throws Exception
@@ -561,6 +578,10 @@ open class Account: Service {
561578
///
562579
/// Verify Authenticator
563580
///
581+
/// Verify an authenticator app after adding it using the [add
582+
/// authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
583+
/// method.
584+
///
564585
/// @param AppwriteEnums.AuthenticatorType type
565586
/// @param String otp
566587
/// @throws Exception
@@ -580,6 +601,8 @@ open class Account: Service {
580601
///
581602
/// Delete Authenticator
582603
///
604+
/// Delete an authenticator for a user by ID.
605+
///
583606
/// @param AppwriteEnums.AuthenticatorType type
584607
/// @param String otp
585608
/// @throws Exception
@@ -617,6 +640,8 @@ open class Account: Service {
617640
///
618641
/// Delete Authenticator
619642
///
643+
/// Delete an authenticator for a user by ID.
644+
///
620645
/// @param AppwriteEnums.AuthenticatorType type
621646
/// @param String otp
622647
/// @throws Exception
@@ -1158,7 +1183,7 @@ open class Account: Service {
11581183
}
11591184

11601185
///
1161-
/// Create session (deprecated)
1186+
/// Update magic URL session
11621187
///
11631188
/// Use this endpoint to create a session from token. Provide the **userId**
11641189
/// and **secret** parameters from the successful response of authentication
@@ -1254,6 +1279,46 @@ open class Account: Service {
12541279
return true
12551280
}
12561281

1282+
///
1283+
/// Update phone session
1284+
///
1285+
/// Use this endpoint to create a session from token. Provide the **userId**
1286+
/// and **secret** parameters from the successful response of authentication
1287+
/// flows initiated by token creation. For example, magic URL and phone login.
1288+
///
1289+
/// @param String userId
1290+
/// @param String secret
1291+
/// @throws Exception
1292+
/// @return array
1293+
///
1294+
open func updatePhoneSession(
1295+
userId: String,
1296+
secret: String
1297+
) async throws -> AppwriteModels.Session {
1298+
let apiPath: String = "/account/sessions/phone"
1299+
1300+
let apiParams: [String: Any?] = [
1301+
"userId": userId,
1302+
"secret": secret
1303+
]
1304+
1305+
let apiHeaders: [String: String] = [
1306+
"content-type": "application/json"
1307+
]
1308+
1309+
let converter: (Any) -> AppwriteModels.Session = { response in
1310+
return AppwriteModels.Session.from(map: response as! [String: Any])
1311+
}
1312+
1313+
return try await client.call(
1314+
method: "PUT",
1315+
path: apiPath,
1316+
headers: apiHeaders,
1317+
params: apiParams,
1318+
converter: converter
1319+
)
1320+
}
1321+
12571322
///
12581323
/// Create session
12591324
///
@@ -1330,7 +1395,7 @@ open class Account: Service {
13301395
}
13311396

13321397
///
1333-
/// Update (or renew) a session
1398+
/// Update (or renew) session
13341399
///
13351400
/// Extend session's expiry to increase it's lifespan. Extending a session is
13361401
/// useful when session length is short such as 5 minutes.
@@ -1448,7 +1513,7 @@ open class Account: Service {
14481513
}
14491514

14501515
///
1451-
/// Create a push target
1516+
/// Create push target
14521517
///
14531518
/// @param String targetId
14541519
/// @param String identifier
@@ -1487,7 +1552,7 @@ open class Account: Service {
14871552
}
14881553

14891554
///
1490-
/// Update a push target
1555+
/// Update push target
14911556
///
14921557
/// @param String targetId
14931558
/// @param String identifier
@@ -1523,7 +1588,7 @@ open class Account: Service {
15231588
}
15241589

15251590
///
1526-
/// Delete a push target
1591+
/// Delete push target
15271592
///
15281593
/// @param String targetId
15291594
/// @throws Exception

Sources/Appwrite/Services/Messaging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import AppwriteModels
99
open class Messaging: Service {
1010

1111
///
12-
/// Create a subscriber
12+
/// Create subscriber
1313
///
1414
/// Create a new subscriber.
1515
///
@@ -50,7 +50,7 @@ open class Messaging: Service {
5050
}
5151

5252
///
53-
/// Delete a subscriber
53+
/// Delete subscriber
5454
///
5555
/// Delete a subscriber by its unique ID.
5656
///
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Appwrite
2+
3+
let client = Client()
4+
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
5+
.setProject("5df5acd0d48c2") // Your project ID
6+
7+
let account = Account(client)
8+
9+
let session = try await account.updatePhoneSession(
10+
userId: "<USER_ID>",
11+
secret: "<SECRET>"
12+
)
13+

docs/examples/functions/create-execution.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Appwrite
2+
import AppwriteEnums
23

34
let client = Client()
45
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint

docs/examples/storage/get-file-preview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import Appwrite
2+
import AppwriteEnums
3+
import AppwriteEnums
24

35
let client = Client()
46
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint

0 commit comments

Comments
 (0)