Skip to content

Commit e4e48de

Browse files
committed
Release candidate for 1.5.x
1 parent 3f9e1e7 commit e4e48de

28 files changed

+172
-119
lines changed

README.md

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

3434
```swift
3535
dependencies: [
36-
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "5.0.0-rc.5"),
36+
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "5.0.0-rc.6"),
3737
],
3838
```
3939

Sources/Appwrite/Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open class Client {
2121
"x-sdk-name": "Swift",
2222
"x-sdk-platform": "server",
2323
"x-sdk-language": "swift",
24-
"x-sdk-version": "5.0.0-rc.5",
24+
"x-sdk-version": "5.0.0-rc.6",
2525
"x-appwrite-response-format": "1.5.0"
2626
]
2727

Sources/Appwrite/Services/Account.swift

Lines changed: 48 additions & 38 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
@@ -1198,57 +1223,42 @@ open class Account: Service {
11981223
}
11991224

12001225
///
1201-
/// Create OAuth2 session
1226+
/// Update phone session
12021227
///
1203-
/// Allow the user to login to their account using the OAuth2 provider of their
1204-
/// choice. Each OAuth2 provider should be enabled from the Appwrite console
1205-
/// first. Use the success and failure arguments to provide a redirect URL's
1206-
/// back to your app when login is completed.
1207-
///
1208-
/// If there is already an active session, the new session will be attached to
1209-
/// the logged-in account. If there are no active sessions, the server will
1210-
/// attempt to look for a user with the same email address as the email
1211-
/// received from the OAuth2 provider and attach the new session to the
1212-
/// existing user. If no matching user is found - the server will create a new
1213-
/// user.
1214-
///
1215-
/// A user is limited to 10 active sessions at a time by default. [Learn more
1216-
/// about session
1217-
/// limits](https://appwrite.io/docs/authentication-security#limits).
1218-
///
1228+
/// Use this endpoint to create a session from token. Provide the **userId**
1229+
/// and **secret** parameters from the successful response of authentication
1230+
/// flows initiated by token creation. For example, magic URL and phone login.
12191231
///
1220-
/// @param AppwriteEnums.OAuthProvider provider
1221-
/// @param String success
1222-
/// @param String failure
1223-
/// @param [String] scopes
1232+
/// @param String userId
1233+
/// @param String secret
12241234
/// @throws Exception
12251235
/// @return array
12261236
///
1227-
open func createOAuth2Session(
1228-
provider: AppwriteEnums.OAuthProvider,
1229-
success: String? = nil,
1230-
failure: String? = nil,
1231-
scopes: [String]? = nil
1232-
) async throws -> String? {
1233-
let apiPath: String = "/account/sessions/oauth2/{provider}"
1234-
.replacingOccurrences(of: "{provider}", with: provider.rawValue)
1237+
open func updatePhoneSession(
1238+
userId: String,
1239+
secret: String
1240+
) async throws -> AppwriteModels.Session {
1241+
let apiPath: String = "/account/sessions/phone"
12351242

12361243
let apiParams: [String: Any?] = [
1237-
"success": success,
1238-
"failure": failure,
1239-
"scopes": scopes,
1240-
"project": client.config["project"]
1244+
"userId": userId,
1245+
"secret": secret
12411246
]
12421247

12431248
let apiHeaders: [String: String] = [
12441249
"content-type": "application/json"
12451250
]
12461251

1247-
return try await client.redirect(
1248-
method: "GET",
1252+
let converter: (Any) -> AppwriteModels.Session = { response in
1253+
return AppwriteModels.Session.from(map: response as! [String: Any])
1254+
}
1255+
1256+
return try await client.call(
1257+
method: "PUT",
12491258
path: apiPath,
12501259
headers: apiHeaders,
1251-
params: apiParams
1260+
params: apiParams,
1261+
converter: converter
12521262
)
12531263
}
12541264

@@ -1328,7 +1338,7 @@ open class Account: Service {
13281338
}
13291339

13301340
///
1331-
/// Update (or renew) a session
1341+
/// Update (or renew) session
13321342
///
13331343
/// Extend session's expiry to increase it's lifespan. Extending a session is
13341344
/// useful when session length is short such as 5 minutes.

Sources/Appwrite/Services/Databases.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ open class Databases: Service {
412412
///
413413
/// List attributes
414414
///
415+
/// List attributes in the collection.
416+
///
415417
/// @param String databaseId
416418
/// @param String collectionId
417419
/// @param [String] queries
@@ -502,6 +504,9 @@ open class Databases: Service {
502504
///
503505
/// Update boolean attribute
504506
///
507+
/// Update a boolean attribute. Changing the `default` value will not update
508+
/// already existing documents.
509+
///
505510
/// @param String databaseId
506511
/// @param String collectionId
507512
/// @param String key
@@ -547,6 +552,8 @@ open class Databases: Service {
547552
///
548553
/// Create datetime attribute
549554
///
555+
/// Create a date time attribute according to the ISO 8601 standard.
556+
///
550557
/// @param String databaseId
551558
/// @param String collectionId
552559
/// @param String key
@@ -595,6 +602,9 @@ open class Databases: Service {
595602
///
596603
/// Update dateTime attribute
597604
///
605+
/// Update a date time attribute. Changing the `default` value will not update
606+
/// already existing documents.
607+
///
598608
/// @param String databaseId
599609
/// @param String collectionId
600610
/// @param String key
@@ -740,6 +750,10 @@ open class Databases: Service {
740750
///
741751
/// Create enum attribute
742752
///
753+
/// Create an enumeration attribute. The `elements` param acts as a white-list
754+
/// of accepted values for this attribute.
755+
///
756+
///
743757
/// @param String databaseId
744758
/// @param String collectionId
745759
/// @param String key
@@ -1433,6 +1447,8 @@ open class Databases: Service {
14331447
///
14341448
/// Get attribute
14351449
///
1450+
/// Get attribute by ID.
1451+
///
14361452
/// @param String databaseId
14371453
/// @param String collectionId
14381454
/// @param String key
@@ -1465,6 +1481,8 @@ open class Databases: Service {
14651481
///
14661482
/// Delete attribute
14671483
///
1484+
/// Deletes an attribute.
1485+
///
14681486
/// @param String databaseId
14691487
/// @param String collectionId
14701488
/// @param String key
@@ -1883,6 +1901,8 @@ open class Databases: Service {
18831901
///
18841902
/// List indexes
18851903
///
1904+
/// List indexes in the collection.
1905+
///
18861906
/// @param String databaseId
18871907
/// @param String collectionId
18881908
/// @param [String] queries
@@ -1922,6 +1942,10 @@ open class Databases: Service {
19221942
///
19231943
/// Create index
19241944
///
1945+
/// Creates an index on the attributes listed. Your index should include all
1946+
/// the attributes you will query in a single request.
1947+
/// Attributes can be `key`, `fulltext`, and `unique`.
1948+
///
19251949
/// @param String databaseId
19261950
/// @param String collectionId
19271951
/// @param String key
@@ -1970,6 +1994,8 @@ open class Databases: Service {
19701994
///
19711995
/// Get index
19721996
///
1997+
/// Get index by ID.
1998+
///
19731999
/// @param String databaseId
19742000
/// @param String collectionId
19752001
/// @param String key
@@ -2008,6 +2034,8 @@ open class Databases: Service {
20082034
///
20092035
/// Delete index
20102036
///
2037+
/// Delete an index.
2038+
///
20112039
/// @param String databaseId
20122040
/// @param String collectionId
20132041
/// @param String key

Sources/Appwrite/Services/Health.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ open class Health: Service {
421421
///
422422
/// Get functions queue
423423
///
424+
/// Get the number of function executions that are waiting to be processed in
425+
/// the Appwrite internal queue server.
426+
///
424427
/// @param Int threshold
425428
/// @throws Exception
426429
/// @return array

0 commit comments

Comments
 (0)