diff --git a/README.md b/README.md index 0861d84..efdc76b 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ ![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-apple.svg?color=green&style=flat-square) ![License](https://img.shields.io/github/license/appwrite/sdk-for-apple.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.3.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).** +**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Apple SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "2.0.0"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "3.0.0"), ], ``` @@ -83,7 +83,7 @@ Next we need to add a hook to save cookies when our app is opened by its callbac > If you're using UIKit, you can skip this section. -In SwiftUI this is as simple as ensuring `.registerOAuthHanlder()` is called on the `View` you want to invoke an OAuth request from. +In SwiftUI this is as simple as ensuring `.registerOAuthHandler()` is called on the `View` you want to invoke an OAuth request from. ### Updating the SceneDelegate for UIKit diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index abe843e..cb1e44f 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -23,8 +23,8 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "2.0.0", - "X-Appwrite-Response-Format": "1.0.0" + "x-sdk-version": "3.0.0", + "X-Appwrite-Response-Format": "1.4.0" ] open var config: [String: String] = [:] diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index 1f6e0b3..da92501 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -10,7 +10,7 @@ open class Account: Service { /// /// Get Account /// - /// Get currently logged in user data as JSON object. + /// Get the currently logged in user. /// /// @throws Exception /// @return array @@ -18,7 +18,7 @@ open class Account: Service { open func get( nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account" + let api_path: String = "/account" let params: [String: Any] = [:] @@ -32,7 +32,7 @@ open class Account: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -42,7 +42,7 @@ open class Account: Service { /// /// Get Account /// - /// Get currently logged in user data as JSON object. + /// Get the currently logged in user. /// /// @throws Exception /// @return array @@ -78,7 +78,7 @@ open class Account: Service { name: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account" + let api_path: String = "/account" let params: [String: Any?] = [ "userId": userId, @@ -97,7 +97,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -158,7 +158,7 @@ open class Account: Service { password: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/email" + let api_path: String = "/account/email" let params: [String: Any?] = [ "email": email, @@ -175,7 +175,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -210,6 +210,69 @@ open class Account: Service { ) } + /// + /// List Identities + /// + /// Get the list of identities for the currently logged in user. + /// + /// @param String queries + /// @throws Exception + /// @return array + /// + open func listIdentities( + queries: String? = nil + ) async throws -> AppwriteModels.IdentityList { + let api_path: String = "/account/identities" + + let params: [String: Any?] = [ + "queries": queries + ] + + let headers: [String: String] = [ + "content-type": "application/json" + ] + + let converter: (Any) -> AppwriteModels.IdentityList = { response in + return AppwriteModels.IdentityList.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "GET", + path: api_path, + headers: headers, + params: params, + converter: converter + ) + } + + /// + /// Delete Identity + /// + /// Delete an identity by its unique ID. + /// + /// @param String identityId + /// @throws Exception + /// @return array + /// + open func deleteIdentity( + identityId: String + ) async throws -> Any { + let api_path: String = "/account/identities/{identityId}" + .replacingOccurrences(of: "{identityId}", with: identityId) + + let params: [String: Any] = [:] + + let headers: [String: String] = [ + "content-type": "application/json" + ] + + return try await client.call( + method: "DELETE", + path: api_path, + headers: headers, + params: params ) + } + /// /// Create JWT /// @@ -224,7 +287,7 @@ open class Account: Service { /// open func createJWT( ) async throws -> AppwriteModels.Jwt { - let path: String = "/account/jwt" + let api_path: String = "/account/jwt" let params: [String: Any] = [:] @@ -238,7 +301,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -248,8 +311,8 @@ open class Account: Service { /// /// List Logs /// - /// Get currently logged in user list of latest security activity logs. Each - /// log returns user IP address, location and date and time of log. + /// Get the list of latest security activity logs for the currently logged in + /// user. Each log returns user IP address, location and date and time of log. /// /// @param [String] queries /// @throws Exception @@ -258,7 +321,7 @@ open class Account: Service { open func listLogs( queries: [String]? = nil ) async throws -> AppwriteModels.LogList { - let path: String = "/account/logs" + let api_path: String = "/account/logs" let params: [String: Any?] = [ "queries": queries @@ -274,7 +337,7 @@ open class Account: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -294,7 +357,7 @@ open class Account: Service { name: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/name" + let api_path: String = "/account/name" let params: [String: Any?] = [ "name": name @@ -310,7 +373,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -352,7 +415,7 @@ open class Account: Service { oldPassword: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/password" + let api_path: String = "/account/password" let params: [String: Any?] = [ "password": password, @@ -369,7 +432,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -418,7 +481,7 @@ open class Account: Service { password: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/phone" + let api_path: String = "/account/phone" let params: [String: Any?] = [ "phone": phone, @@ -435,7 +498,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -470,7 +533,7 @@ open class Account: Service { /// /// Get Account Preferences /// - /// Get currently logged in user preferences as a key-value object. + /// Get the preferences as a key-value object for the currently logged in user. /// /// @throws Exception /// @return array @@ -478,7 +541,7 @@ open class Account: Service { open func getPrefs( nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let path: String = "/account/prefs" + let api_path: String = "/account/prefs" let params: [String: Any] = [:] @@ -492,7 +555,7 @@ open class Account: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -502,7 +565,7 @@ open class Account: Service { /// /// Get Account Preferences /// - /// Get currently logged in user preferences as a key-value object. + /// Get the preferences as a key-value object for the currently logged in user. /// /// @throws Exception /// @return array @@ -529,7 +592,7 @@ open class Account: Service { prefs: Any, nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/prefs" + let api_path: String = "/account/prefs" let params: [String: Any?] = [ "prefs": prefs @@ -545,7 +608,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -593,7 +656,7 @@ open class Account: Service { email: String, url: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/recovery" + let api_path: String = "/account/recovery" let params: [String: Any?] = [ "email": email, @@ -610,7 +673,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -643,7 +706,7 @@ open class Account: Service { password: String, passwordAgain: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/recovery" + let api_path: String = "/account/recovery" let params: [String: Any?] = [ "userId": userId, @@ -662,7 +725,7 @@ open class Account: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -672,15 +735,15 @@ open class Account: Service { /// /// List Sessions /// - /// Get currently logged in user list of active sessions across different - /// devices. + /// Get the list of active sessions across different devices for the currently + /// logged in user. /// /// @throws Exception /// @return array /// open func listSessions( ) async throws -> AppwriteModels.SessionList { - let path: String = "/account/sessions" + let api_path: String = "/account/sessions" let params: [String: Any] = [:] @@ -694,7 +757,7 @@ open class Account: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -712,7 +775,7 @@ open class Account: Service { /// open func deleteSessions( ) async throws -> Any { - let path: String = "/account/sessions" + let api_path: String = "/account/sessions" let params: [String: Any] = [:] @@ -722,7 +785,7 @@ open class Account: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } @@ -742,7 +805,7 @@ open class Account: Service { /// open func createAnonymousSession( ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/anonymous" + let api_path: String = "/account/sessions/anonymous" let params: [String: Any] = [:] @@ -756,7 +819,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -781,7 +844,7 @@ open class Account: Service { email: String, password: String ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/email" + let api_path: String = "/account/sessions/email" let params: [String: Any?] = [ "email": email, @@ -798,7 +861,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -809,7 +872,7 @@ open class Account: Service { /// Create Magic URL session /// /// Sends the user an email with a secret key for creating a session. If the - /// provided user ID has not be registered, a new user will be created. When + /// provided user ID has not been registered, a new user will be created. When /// the user clicks the link in the email, the user is redirected back to the /// URL you provided with the secret key and userId values attached to the URL /// query string. Use the query string parameters to submit a request to the @@ -822,6 +885,7 @@ open class Account: Service { /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session limits](/docs/authentication-security#limits). + /// /// /// @param String userId /// @param String email @@ -834,7 +898,7 @@ open class Account: Service { email: String, url: String? = nil ) async throws -> AppwriteModels.Token { - let path: String = "/account/sessions/magic-url" + let api_path: String = "/account/sessions/magic-url" let params: [String: Any?] = [ "userId": userId, @@ -852,7 +916,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -883,7 +947,7 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/magic-url" + let api_path: String = "/account/sessions/magic-url" let params: [String: Any?] = [ "userId": userId, @@ -900,7 +964,7 @@ open class Account: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -940,7 +1004,7 @@ open class Account: Service { failure: String? = nil, scopes: [String]? = nil ) throws -> Bool { - let path: String = "/account/sessions/oauth2/{provider}" + let api_path: String = "/account/sessions/oauth2/{provider}" .replacingOccurrences(of: "{provider}", with: provider) let params: [String: Any?] = [ @@ -951,7 +1015,7 @@ open class Account: Service { ] let query = "?\(client.parametersToQueryString(params: params))" - let url = URL(string: client.endPoint + path + query)! + let url = URL(string: client.endPoint + api_path + query)! let callbackScheme = "appwrite-callback-\(client.config["project"] ?? "")" let group = DispatchGroup() @@ -987,7 +1051,7 @@ open class Account: Service { userId: String, phone: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/sessions/phone" + let api_path: String = "/account/sessions/phone" let params: [String: Any?] = [ "userId": userId, @@ -1004,7 +1068,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1029,7 +1093,7 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/phone" + let api_path: String = "/account/sessions/phone" let params: [String: Any?] = [ "userId": userId, @@ -1046,7 +1110,7 @@ open class Account: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1066,7 +1130,7 @@ open class Account: Service { open func getSession( sessionId: String ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/{sessionId}" + let api_path: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) let params: [String: Any] = [:] @@ -1081,7 +1145,7 @@ open class Account: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1102,7 +1166,7 @@ open class Account: Service { open func updateSession( sessionId: String ) async throws -> AppwriteModels.Session { - let path: String = "/account/sessions/{sessionId}" + let api_path: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) let params: [String: Any] = [:] @@ -1117,7 +1181,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1127,10 +1191,10 @@ open class Account: Service { /// /// Delete Session /// - /// Use this endpoint to log out the currently logged in user from all their - /// account sessions across all of their different devices. When using the - /// Session ID argument, only the unique session ID provided is deleted. - /// + /// Logout the user. Use 'current' as the session ID to logout on this device, + /// use a session ID to logout on another device. If you're looking to logout + /// the user on all devices, use [Delete + /// Sessions](/docs/client/account#accountDeleteSessions) instead. /// /// @param String sessionId /// @throws Exception @@ -1139,7 +1203,7 @@ open class Account: Service { open func deleteSession( sessionId: String ) async throws -> Any { - let path: String = "/account/sessions/{sessionId}" + let api_path: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) let params: [String: Any] = [:] @@ -1150,7 +1214,7 @@ open class Account: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } @@ -1168,7 +1232,7 @@ open class Account: Service { open func updateStatus( nestedType: T.Type ) async throws -> AppwriteModels.User { - let path: String = "/account/status" + let api_path: String = "/account/status" let params: [String: Any] = [:] @@ -1182,7 +1246,7 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1232,7 +1296,7 @@ open class Account: Service { open func createVerification( url: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/verification" + let api_path: String = "/account/verification" let params: [String: Any?] = [ "url": url @@ -1248,7 +1312,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1272,7 +1336,7 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/verification" + let api_path: String = "/account/verification" let params: [String: Any?] = [ "userId": userId, @@ -1289,7 +1353,7 @@ open class Account: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1311,7 +1375,7 @@ open class Account: Service { /// open func createPhoneVerification( ) async throws -> AppwriteModels.Token { - let path: String = "/account/verification/phone" + let api_path: String = "/account/verification/phone" let params: [String: Any] = [:] @@ -1325,7 +1389,7 @@ open class Account: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -1349,7 +1413,7 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Token { - let path: String = "/account/verification/phone" + let api_path: String = "/account/verification/phone" let params: [String: Any?] = [ "userId": userId, @@ -1366,7 +1430,7 @@ open class Account: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index c201a89..a792bee 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -33,7 +33,7 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/browsers/{code}" + let api_path: String = "/avatars/browsers/{code}" .replacingOccurrences(of: "{code}", with: code) let params: [String: Any?] = [ @@ -45,7 +45,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -76,7 +76,7 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/credit-cards/{code}" + let api_path: String = "/avatars/credit-cards/{code}" .replacingOccurrences(of: "{code}", with: code) let params: [String: Any?] = [ @@ -88,7 +88,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -107,7 +107,7 @@ open class Avatars: Service { open func getFavicon( url: String ) async throws -> ByteBuffer { - let path: String = "/avatars/favicon" + let api_path: String = "/avatars/favicon" let params: [String: Any?] = [ "url": url, @@ -116,7 +116,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -148,7 +148,7 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/flags/{code}" + let api_path: String = "/avatars/flags/{code}" .replacingOccurrences(of: "{code}", with: code) let params: [String: Any?] = [ @@ -160,7 +160,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -190,7 +190,7 @@ open class Avatars: Service { width: Int? = nil, height: Int? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/image" + let api_path: String = "/avatars/image" let params: [String: Any?] = [ "url": url, @@ -201,7 +201,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -239,7 +239,7 @@ open class Avatars: Service { height: Int? = nil, background: String? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/initials" + let api_path: String = "/avatars/initials" let params: [String: Any?] = [ "name": name, @@ -251,7 +251,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -276,7 +276,7 @@ open class Avatars: Service { margin: Int? = nil, download: Bool? = nil ) async throws -> ByteBuffer { - let path: String = "/avatars/qr" + let api_path: String = "/avatars/qr" let params: [String: Any?] = [ "text": text, @@ -288,7 +288,7 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 19ab44b..00be009 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -25,7 +25,7 @@ open class Databases: Service { queries: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.DocumentList { - let path: String = "/databases/{databaseId}/collections/{collectionId}/documents" + let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) @@ -43,7 +43,7 @@ open class Databases: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -99,7 +99,7 @@ open class Databases: Service { permissions: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let path: String = "/databases/{databaseId}/collections/{collectionId}/documents" + let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) @@ -119,7 +119,7 @@ open class Databases: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -179,7 +179,7 @@ open class Databases: Service { queries: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) @@ -198,7 +198,7 @@ open class Databases: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -255,7 +255,7 @@ open class Databases: Service { permissions: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) @@ -275,7 +275,7 @@ open class Databases: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -329,7 +329,7 @@ open class Databases: Service { collectionId: String, documentId: String ) async throws -> Any { - let path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) @@ -342,7 +342,7 @@ open class Databases: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index 83dea86..7f9c658 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -24,7 +24,7 @@ open class Functions: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.ExecutionList { - let path: String = "/functions/{functionId}/executions" + let api_path: String = "/functions/{functionId}/executions" .replacingOccurrences(of: "{functionId}", with: functionId) let params: [String: Any?] = [ @@ -42,7 +42,7 @@ open class Functions: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -58,22 +58,31 @@ open class Functions: Service { /// function execution process will start asynchronously. /// /// @param String functionId - /// @param String data + /// @param String body /// @param Bool async + /// @param String path + /// @param String method + /// @param Any headers /// @throws Exception /// @return array /// open func createExecution( functionId: String, - data: String? = nil, - async: Bool? = nil + body: String? = nil, + async: Bool? = nil, + path: String? = nil, + method: String? = nil, + headers: Any? = nil ) async throws -> AppwriteModels.Execution { - let path: String = "/functions/{functionId}/executions" + let api_path: String = "/functions/{functionId}/executions" .replacingOccurrences(of: "{functionId}", with: functionId) let params: [String: Any?] = [ - "data": data, - "async": async + "body": body, + "async": async, + "path": path, + "method": method, + "headers": headers ] let headers: [String: String] = [ @@ -86,7 +95,7 @@ open class Functions: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -107,7 +116,7 @@ open class Functions: Service { functionId: String, executionId: String ) async throws -> AppwriteModels.Execution { - let path: String = "/functions/{functionId}/executions/{executionId}" + let api_path: String = "/functions/{functionId}/executions/{executionId}" .replacingOccurrences(of: "{functionId}", with: functionId) .replacingOccurrences(of: "{executionId}", with: executionId) @@ -123,7 +132,7 @@ open class Functions: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter diff --git a/Sources/Appwrite/Services/Graphql.swift b/Sources/Appwrite/Services/Graphql.swift index d399299..c530cec 100644 --- a/Sources/Appwrite/Services/Graphql.swift +++ b/Sources/Appwrite/Services/Graphql.swift @@ -19,7 +19,7 @@ open class Graphql: Service { open func query( query: Any ) async throws -> Any { - let path: String = "/graphql" + let api_path: String = "/graphql" let params: [String: Any?] = [ "query": query @@ -36,7 +36,7 @@ open class Graphql: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -55,7 +55,7 @@ open class Graphql: Service { open func mutation( query: Any ) async throws -> Any { - let path: String = "/graphql/mutation" + let api_path: String = "/graphql/mutation" let params: [String: Any?] = [ "query": query @@ -72,7 +72,7 @@ open class Graphql: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter diff --git a/Sources/Appwrite/Services/Locale.swift b/Sources/Appwrite/Services/Locale.swift index 69234e3..f67fd95 100644 --- a/Sources/Appwrite/Services/Locale.swift +++ b/Sources/Appwrite/Services/Locale.swift @@ -22,7 +22,7 @@ open class Locale: Service { /// open func get( ) async throws -> AppwriteModels.Locale { - let path: String = "/locale" + let api_path: String = "/locale" let params: [String: Any] = [:] @@ -36,7 +36,39 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, + headers: headers, + params: params, + converter: converter + ) + } + + /// + /// List Locale Codes + /// + /// List of all locale codes in [ISO + /// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + /// + /// @throws Exception + /// @return array + /// + open func listCodes( + ) async throws -> AppwriteModels.LocaleCodeList { + let api_path: String = "/locale/codes" + + let params: [String: Any] = [:] + + let headers: [String: String] = [ + "content-type": "application/json" + ] + + let converter: (Any) -> AppwriteModels.LocaleCodeList = { response in + return AppwriteModels.LocaleCodeList.from(map: response as! [String: Any]) + } + + return try await client.call( + method: "GET", + path: api_path, headers: headers, params: params, converter: converter @@ -54,7 +86,7 @@ open class Locale: Service { /// open func listContinents( ) async throws -> AppwriteModels.ContinentList { - let path: String = "/locale/continents" + let api_path: String = "/locale/continents" let params: [String: Any] = [:] @@ -68,7 +100,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -86,7 +118,7 @@ open class Locale: Service { /// open func listCountries( ) async throws -> AppwriteModels.CountryList { - let path: String = "/locale/countries" + let api_path: String = "/locale/countries" let params: [String: Any] = [:] @@ -100,7 +132,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -118,7 +150,7 @@ open class Locale: Service { /// open func listCountriesEU( ) async throws -> AppwriteModels.CountryList { - let path: String = "/locale/countries/eu" + let api_path: String = "/locale/countries/eu" let params: [String: Any] = [:] @@ -132,7 +164,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -150,7 +182,7 @@ open class Locale: Service { /// open func listCountriesPhones( ) async throws -> AppwriteModels.PhoneList { - let path: String = "/locale/countries/phones" + let api_path: String = "/locale/countries/phones" let params: [String: Any] = [:] @@ -164,7 +196,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -183,7 +215,7 @@ open class Locale: Service { /// open func listCurrencies( ) async throws -> AppwriteModels.CurrencyList { - let path: String = "/locale/currencies" + let api_path: String = "/locale/currencies" let params: [String: Any] = [:] @@ -197,7 +229,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -215,7 +247,7 @@ open class Locale: Service { /// open func listLanguages( ) async throws -> AppwriteModels.LanguageList { - let path: String = "/locale/languages" + let api_path: String = "/locale/languages" let params: [String: Any] = [:] @@ -229,7 +261,7 @@ open class Locale: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index 91240b5..33aa3de 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -24,7 +24,7 @@ open class Storage: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.FileList { - let path: String = "/storage/buckets/{bucketId}/files" + let api_path: String = "/storage/buckets/{bucketId}/files" .replacingOccurrences(of: "{bucketId}", with: bucketId) let params: [String: Any?] = [ @@ -42,7 +42,7 @@ open class Storage: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -85,7 +85,7 @@ open class Storage: Service { permissions: [String]? = nil, onProgress: ((UploadProgress) -> Void)? = nil ) async throws -> AppwriteModels.File { - let path: String = "/storage/buckets/{bucketId}/files" + let api_path: String = "/storage/buckets/{bucketId}/files" .replacingOccurrences(of: "{bucketId}", with: bucketId) var params: [String: Any?] = [ @@ -105,7 +105,7 @@ open class Storage: Service { let idParamName: String? = "fileId" let paramName = "file" return try await client.chunkedUpload( - path: path, + path: api_path, headers: &headers, params: ¶ms, paramName: paramName, @@ -130,7 +130,7 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> AppwriteModels.File { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) @@ -146,7 +146,7 @@ open class Storage: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -161,6 +161,7 @@ open class Storage: Service { /// /// @param String bucketId /// @param String fileId + /// @param String name /// @param [String] permissions /// @throws Exception /// @return array @@ -168,13 +169,15 @@ open class Storage: Service { open func updateFile( bucketId: String, fileId: String, + name: String? = nil, permissions: [String]? = nil ) async throws -> AppwriteModels.File { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) let params: [String: Any?] = [ + "name": name, "permissions": permissions ] @@ -188,7 +191,7 @@ open class Storage: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -210,7 +213,7 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> Any { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) @@ -222,7 +225,7 @@ open class Storage: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } @@ -243,7 +246,7 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> ByteBuffer { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}/download" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/download" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) @@ -251,7 +254,7 @@ open class Storage: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -296,7 +299,7 @@ open class Storage: Service { background: String? = nil, output: String? = nil ) async throws -> ByteBuffer { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) @@ -317,7 +320,7 @@ open class Storage: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } @@ -338,7 +341,7 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> ByteBuffer { - let path: String = "/storage/buckets/{bucketId}/files/{fileId}/view" + let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/view" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) @@ -346,7 +349,7 @@ open class Storage: Service { return try await client.call( method: "GET", - path: path, + path: api_path, params: params ) } diff --git a/Sources/Appwrite/Services/Teams.swift b/Sources/Appwrite/Services/Teams.swift index f04f099..c034f65 100644 --- a/Sources/Appwrite/Services/Teams.swift +++ b/Sources/Appwrite/Services/Teams.swift @@ -23,7 +23,7 @@ open class Teams: Service { search: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.TeamList { - let path: String = "/teams" + let api_path: String = "/teams" let params: [String: Any?] = [ "queries": queries, @@ -40,7 +40,7 @@ open class Teams: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -88,7 +88,7 @@ open class Teams: Service { roles: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let path: String = "/teams" + let api_path: String = "/teams" let params: [String: Any?] = [ "teamId": teamId, @@ -106,7 +106,7 @@ open class Teams: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -152,7 +152,7 @@ open class Teams: Service { teamId: String, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let path: String = "/teams/{teamId}" + let api_path: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any] = [:] @@ -167,7 +167,7 @@ open class Teams: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -207,7 +207,7 @@ open class Teams: Service { name: String, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let path: String = "/teams/{teamId}" + let api_path: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any?] = [ @@ -224,7 +224,7 @@ open class Teams: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -265,7 +265,7 @@ open class Teams: Service { open func delete( teamId: String ) async throws -> Any { - let path: String = "/teams/{teamId}" + let api_path: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any] = [:] @@ -276,7 +276,7 @@ open class Teams: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } @@ -298,7 +298,7 @@ open class Teams: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.MembershipList { - let path: String = "/teams/{teamId}/memberships" + let api_path: String = "/teams/{teamId}/memberships" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any?] = [ @@ -316,7 +316,7 @@ open class Teams: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -367,7 +367,7 @@ open class Teams: Service { phone: String? = nil, name: String? = nil ) async throws -> AppwriteModels.Membership { - let path: String = "/teams/{teamId}/memberships" + let api_path: String = "/teams/{teamId}/memberships" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any?] = [ @@ -389,7 +389,7 @@ open class Teams: Service { return try await client.call( method: "POST", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -411,7 +411,7 @@ open class Teams: Service { teamId: String, membershipId: String ) async throws -> AppwriteModels.Membership { - let path: String = "/teams/{teamId}/memberships/{membershipId}" + let api_path: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) @@ -427,7 +427,7 @@ open class Teams: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -435,11 +435,12 @@ open class Teams: Service { } /// - /// Update Membership Roles + /// Update Membership /// /// Modify the roles of a team member. Only team members with the owner role /// have access to this endpoint. Learn more about [roles and /// permissions](/docs/permissions). + /// /// /// @param String teamId /// @param String membershipId @@ -447,12 +448,12 @@ open class Teams: Service { /// @throws Exception /// @return array /// - open func updateMembershipRoles( + open func updateMembership( teamId: String, membershipId: String, roles: [String] ) async throws -> AppwriteModels.Membership { - let path: String = "/teams/{teamId}/memberships/{membershipId}" + let api_path: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) @@ -470,7 +471,7 @@ open class Teams: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -493,7 +494,7 @@ open class Teams: Service { teamId: String, membershipId: String ) async throws -> Any { - let path: String = "/teams/{teamId}/memberships/{membershipId}" + let api_path: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) @@ -505,7 +506,7 @@ open class Teams: Service { return try await client.call( method: "DELETE", - path: path, + path: api_path, headers: headers, params: params ) } @@ -534,7 +535,7 @@ open class Teams: Service { userId: String, secret: String ) async throws -> AppwriteModels.Membership { - let path: String = "/teams/{teamId}/memberships/{membershipId}/status" + let api_path: String = "/teams/{teamId}/memberships/{membershipId}/status" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) @@ -553,7 +554,7 @@ open class Teams: Service { return try await client.call( method: "PATCH", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -575,7 +576,7 @@ open class Teams: Service { teamId: String, nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let path: String = "/teams/{teamId}/prefs" + let api_path: String = "/teams/{teamId}/prefs" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any] = [:] @@ -590,7 +591,7 @@ open class Teams: Service { return try await client.call( method: "GET", - path: path, + path: api_path, headers: headers, params: params, converter: converter @@ -634,7 +635,7 @@ open class Teams: Service { prefs: Any, nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let path: String = "/teams/{teamId}/prefs" + let api_path: String = "/teams/{teamId}/prefs" .replacingOccurrences(of: "{teamId}", with: teamId) let params: [String: Any?] = [ @@ -651,7 +652,7 @@ open class Teams: Service { return try await client.call( method: "PUT", - path: path, + path: api_path, headers: headers, params: params, converter: converter diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index 7dc5b89..2cb6d9a 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -25,19 +25,31 @@ public class Execution { /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. public let status: String - /// The script status code. - public let statusCode: Int + /// HTTP request method type. + public let requestMethod: String - /// The script response output string. Logs the last 4,000 characters of the execution response output. - public let response: String + /// HTTP request path and query. + public let requestPath: String - /// The script stdout output string. Logs the last 4,000 characters of the execution stdout output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - public let stdout: String + /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + public let requestHeaders: [Headers] - /// The script stderr output string. Logs the last 4,000 characters of the execution stderr output. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - public let stderr: String + /// HTTP response status code. + public let responseStatusCode: Int - /// The script execution duration in seconds. + /// HTTP response body. This will return empty unless execution is created as synchronous. + public let responseBody: String + + /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + public let responseHeaders: [Headers] + + /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + public let logs: String + + /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + public let errors: String + + /// Function execution duration in seconds. public let duration: Double @@ -49,10 +61,14 @@ public class Execution { functionId: String, trigger: String, status: String, - statusCode: Int, - response: String, - stdout: String, - stderr: String, + requestMethod: String, + requestPath: String, + requestHeaders: [Headers], + responseStatusCode: Int, + responseBody: String, + responseHeaders: [Headers], + logs: String, + errors: String, duration: Double ) { self.id = id @@ -62,10 +78,14 @@ public class Execution { self.functionId = functionId self.trigger = trigger self.status = status - self.statusCode = statusCode - self.response = response - self.stdout = stdout - self.stderr = stderr + self.requestMethod = requestMethod + self.requestPath = requestPath + self.requestHeaders = requestHeaders + self.responseStatusCode = responseStatusCode + self.responseBody = responseBody + self.responseHeaders = responseHeaders + self.logs = logs + self.errors = errors self.duration = duration } @@ -78,10 +98,14 @@ public class Execution { "functionId": functionId as Any, "trigger": trigger as Any, "status": status as Any, - "statusCode": statusCode as Any, - "response": response as Any, - "stdout": stdout as Any, - "stderr": stderr as Any, + "requestMethod": requestMethod as Any, + "requestPath": requestPath as Any, + "requestHeaders": requestHeaders.map { $0.toMap() } as Any, + "responseStatusCode": responseStatusCode as Any, + "responseBody": responseBody as Any, + "responseHeaders": responseHeaders.map { $0.toMap() } as Any, + "logs": logs as Any, + "errors": errors as Any, "duration": duration as Any ] } @@ -95,10 +119,14 @@ public class Execution { functionId: map["functionId"] as! String, trigger: map["trigger"] as! String, status: map["status"] as! String, - statusCode: map["statusCode"] as! Int, - response: map["response"] as! String, - stdout: map["stdout"] as! String, - stderr: map["stderr"] as! String, + requestMethod: map["requestMethod"] as! String, + requestPath: map["requestPath"] as! String, + requestHeaders: (map["requestHeaders"] as! [[String: Any]]).map { Headers.from(map: $0) }, + responseStatusCode: map["responseStatusCode"] as! Int, + responseBody: map["responseBody"] as! String, + responseHeaders: (map["responseHeaders"] as! [[String: Any]]).map { Headers.from(map: $0) }, + logs: map["logs"] as! String, + errors: map["errors"] as! String, duration: map["duration"] as! Double ) } diff --git a/Sources/AppwriteModels/Headers.swift b/Sources/AppwriteModels/Headers.swift new file mode 100644 index 0000000..6f554ac --- /dev/null +++ b/Sources/AppwriteModels/Headers.swift @@ -0,0 +1,35 @@ +import Foundation +import JSONCodable + +/// Headers +public class Headers { + + /// Header name. + public let name: String + + /// Header value. + public let value: String + + + init( + name: String, + value: String + ) { + self.name = name + self.value = value + } + + public func toMap() -> [String: Any] { + return [ + "name": name as Any, + "value": value as Any + ] + } + + public static func from(map: [String: Any] ) -> Headers { + return Headers( + name: map["name"] as! String, + value: map["value"] as! String + ) + } +} diff --git a/Sources/AppwriteModels/Identity.swift b/Sources/AppwriteModels/Identity.swift new file mode 100644 index 0000000..fb54237 --- /dev/null +++ b/Sources/AppwriteModels/Identity.swift @@ -0,0 +1,91 @@ +import Foundation +import JSONCodable + +/// Identity +public class Identity { + + /// Identity ID. + public let id: String + + /// Identity creation date in ISO 8601 format. + public let createdAt: String + + /// Identity update date in ISO 8601 format. + public let updatedAt: String + + /// User ID. + public let userId: String + + /// Identity Provider. + public let provider: String + + /// ID of the User in the Identity Provider. + public let providerUid: String + + /// Email of the User in the Identity Provider. + public let providerEmail: String + + /// Identity Provider Access Token. + public let providerAccessToken: String + + /// The date of when the access token expires in ISO 8601 format. + public let providerAccessTokenExpiry: String + + /// Identity Provider Refresh Token. + public let providerRefreshToken: String + + + init( + id: String, + createdAt: String, + updatedAt: String, + userId: String, + provider: String, + providerUid: String, + providerEmail: String, + providerAccessToken: String, + providerAccessTokenExpiry: String, + providerRefreshToken: String + ) { + self.id = id + self.createdAt = createdAt + self.updatedAt = updatedAt + self.userId = userId + self.provider = provider + self.providerUid = providerUid + self.providerEmail = providerEmail + self.providerAccessToken = providerAccessToken + self.providerAccessTokenExpiry = providerAccessTokenExpiry + self.providerRefreshToken = providerRefreshToken + } + + public func toMap() -> [String: Any] { + return [ + "$id": id as Any, + "$createdAt": createdAt as Any, + "$updatedAt": updatedAt as Any, + "userId": userId as Any, + "provider": provider as Any, + "providerUid": providerUid as Any, + "providerEmail": providerEmail as Any, + "providerAccessToken": providerAccessToken as Any, + "providerAccessTokenExpiry": providerAccessTokenExpiry as Any, + "providerRefreshToken": providerRefreshToken as Any + ] + } + + public static func from(map: [String: Any] ) -> Identity { + return Identity( + id: map["$id"] as! String, + createdAt: map["$createdAt"] as! String, + updatedAt: map["$updatedAt"] as! String, + userId: map["userId"] as! String, + provider: map["provider"] as! String, + providerUid: map["providerUid"] as! String, + providerEmail: map["providerEmail"] as! String, + providerAccessToken: map["providerAccessToken"] as! String, + providerAccessTokenExpiry: map["providerAccessTokenExpiry"] as! String, + providerRefreshToken: map["providerRefreshToken"] as! String + ) + } +} diff --git a/Sources/AppwriteModels/IdentityList.swift b/Sources/AppwriteModels/IdentityList.swift new file mode 100644 index 0000000..b068f4c --- /dev/null +++ b/Sources/AppwriteModels/IdentityList.swift @@ -0,0 +1,35 @@ +import Foundation +import JSONCodable + +/// Identities List +public class IdentityList { + + /// Total number of identities documents that matched your query. + public let total: Int + + /// List of identities. + public let identities: [Identity] + + + init( + total: Int, + identities: [Identity] + ) { + self.total = total + self.identities = identities + } + + public func toMap() -> [String: Any] { + return [ + "total": total as Any, + "identities": identities.map { $0.toMap() } as Any + ] + } + + public static func from(map: [String: Any] ) -> IdentityList { + return IdentityList( + total: map["total"] as! Int, + identities: (map["identities"] as! [[String: Any]]).map { Identity.from(map: $0) } + ) + } +} diff --git a/Sources/AppwriteModels/LocaleCode.swift b/Sources/AppwriteModels/LocaleCode.swift new file mode 100644 index 0000000..8e561c7 --- /dev/null +++ b/Sources/AppwriteModels/LocaleCode.swift @@ -0,0 +1,35 @@ +import Foundation +import JSONCodable + +/// LocaleCode +public class LocaleCode { + + /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + public let code: String + + /// Locale name + public let name: String + + + init( + code: String, + name: String + ) { + self.code = code + self.name = name + } + + public func toMap() -> [String: Any] { + return [ + "code": code as Any, + "name": name as Any + ] + } + + public static func from(map: [String: Any] ) -> LocaleCode { + return LocaleCode( + code: map["code"] as! String, + name: map["name"] as! String + ) + } +} diff --git a/Sources/AppwriteModels/LocaleCodeList.swift b/Sources/AppwriteModels/LocaleCodeList.swift new file mode 100644 index 0000000..895ef7d --- /dev/null +++ b/Sources/AppwriteModels/LocaleCodeList.swift @@ -0,0 +1,35 @@ +import Foundation +import JSONCodable + +/// Locale codes list +public class LocaleCodeList { + + /// Total number of localeCodes documents that matched your query. + public let total: Int + + /// List of localeCodes. + public let localeCodes: [LocaleCode] + + + init( + total: Int, + localeCodes: [LocaleCode] + ) { + self.total = total + self.localeCodes = localeCodes + } + + public func toMap() -> [String: Any] { + return [ + "total": total as Any, + "localeCodes": localeCodes.map { $0.toMap() } as Any + ] + } + + public static func from(map: [String: Any] ) -> LocaleCodeList { + return LocaleCodeList( + total: map["total"] as! Int, + localeCodes: (map["localeCodes"] as! [[String: Any]]).map { LocaleCode.from(map: $0) } + ) + } +} diff --git a/Sources/AppwriteModels/User.swift b/Sources/AppwriteModels/User.swift index 33b68da..3cf1904 100644 --- a/Sources/AppwriteModels/User.swift +++ b/Sources/AppwriteModels/User.swift @@ -31,6 +31,9 @@ public class User { /// User status. Pass `true` for enabled and `false` for disabled. public let status: Bool + /// Labels for the user. + public let labels: [Any] + /// Password update time in ISO 8601 format. public let passwordUpdate: String @@ -49,6 +52,9 @@ public class User { /// User preferences as a key-value object public let prefs: Preferences + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + public let accessedAt: String + init( id: String, @@ -60,12 +66,14 @@ public class User { hashOptions: Any??, registration: String, status: Bool, + labels: [Any], passwordUpdate: String, email: String, phone: String, emailVerification: Bool, phoneVerification: Bool, - prefs: Preferences + prefs: Preferences, + accessedAt: String ) { self.id = id self.createdAt = createdAt @@ -76,12 +84,14 @@ public class User { self.hashOptions = hashOptions self.registration = registration self.status = status + self.labels = labels self.passwordUpdate = passwordUpdate self.email = email self.phone = phone self.emailVerification = emailVerification self.phoneVerification = phoneVerification self.prefs = prefs + self.accessedAt = accessedAt } public func toMap() -> [String: Any] { @@ -95,12 +105,14 @@ public class User { "hashOptions": hashOptions as Any, "registration": registration as Any, "status": status as Any, + "labels": labels as Any, "passwordUpdate": passwordUpdate as Any, "email": email as Any, "phone": phone as Any, "emailVerification": emailVerification as Any, "phoneVerification": phoneVerification as Any, - "prefs": prefs.toMap() as Any + "prefs": prefs.toMap() as Any, + "accessedAt": accessedAt as Any ] } @@ -115,12 +127,14 @@ public class User { hashOptions: map["hashOptions"] as? Any?, registration: map["registration"] as! String, status: map["status"] as! Bool, + labels: map["labels"] as! [Any], passwordUpdate: map["passwordUpdate"] as! String, email: map["email"] as! String, phone: map["phone"] as! String, emailVerification: map["emailVerification"] as! Bool, phoneVerification: map["phoneVerification"] as! Bool, - prefs: Preferences.from(map: map["prefs"] as! [String: Any]) + prefs: Preferences.from(map: map["prefs"] as! [String: Any]), + accessedAt: map["accessedAt"] as! String ) } } diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 8667868..9904f6f 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-email-session.md b/docs/examples/account/create-email-session.md index 9535bd3..311a3b6 100644 --- a/docs/examples/account/create-email-session.md +++ b/docs/examples/account/create-email-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index 5a8ae63..c18c3c9 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-magic-u-r-l-session.md b/docs/examples/account/create-magic-u-r-l-session.md index ad342dc..929396d 100644 --- a/docs/examples/account/create-magic-u-r-l-session.md +++ b/docs/examples/account/create-magic-u-r-l-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-o-auth2session.md b/docs/examples/account/create-o-auth2session.md index 44b9229..c84edfc 100644 --- a/docs/examples/account/create-o-auth2session.md +++ b/docs/examples/account/create-o-auth2session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-phone-session.md b/docs/examples/account/create-phone-session.md index c6b9f41..caa66c1 100644 --- a/docs/examples/account/create-phone-session.md +++ b/docs/examples/account/create-phone-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 08a6367..b628897 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index a946bfd..8d48938 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 6ce12ba..2c96d20 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 8dc164f..a7836f8 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 0000000..7cd37c9 --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +let account = Account(client) + +let result = try await account.deleteIdentity( + identityId: "[IDENTITY_ID]" +) + diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 3040b28..316a27d 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index e46d607..efb8c7c 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 93c17c0..5a9fb2e 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index c291d10..66b3635 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 406b3d0..f29f83f 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 0000000..86d713c --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +let account = Account(client) + +let identityList = try await account.listIdentities() + diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 830524e..0c97255 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 4f7957a..b160c89 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 50cc248..a8c37af 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index e522009..42a7f71 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 8d1a1d1..a9d7681 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 8d47678..bb3c3b0 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 125c68a..41e26c3 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index e3e7bbf..1c88595 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 4fa321f..306e8f5 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index fc640b7..cc76548 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index faec918..335dd6a 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 712f305..b718262 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index ac38350..3f2d823 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 15f9367..36af6b9 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let account = Account(client) diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index a76a736..19c8d02 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 7bcae65..d7a680f 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index f029035..01a7ec1 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index ceb3fe7..eb33c90 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index e69ac10..ef0cd36 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 98086ca..1bdd6f0 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index c037544..5c801d4 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let avatars = Avatars(client) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index efe8ca0..533bbd5 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 37b06a4..c9a7512 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index ec9a78c..53b71fb 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 75e97b0..0b375df 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let databases = Databases(client) diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 2aa6bfd..5a943af 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let databases = Databases(client) diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 768b3a6..93702bf 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let functions = Functions(client) diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index cad2cd1..f1e53cb 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let functions = Functions(client) diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index b3d2de1..0f18295 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let functions = Functions(client) diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 6c61028..d58b881 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let graphql = Graphql(client) diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 2965ae6..0aba98a 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let graphql = Graphql(client) diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 4c72036..d12470d 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 0000000..5832aa4 --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .setProject("5df5acd0d48c2") // Your project ID + +let locale = Locale(client) + +let localeCodeList = try await locale.listCodes() + diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index e6c1c41..4853f77 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 8666c5a..6e0a4d3 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 150dfbf..b4752eb 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 0901da1..75369d0 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index e43a416..92eea81 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 06d0ba6..2184812 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let locale = Locale(client) diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index ff16ebf..f882420 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index db31d92..27624b4 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index f139482..ca96b31 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 09b28dc..71c0f31 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 819fdab..85631ef 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 9e274fc..fa28b48 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 5d33f1b..51f7fe8 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index ab33b61..13bf635 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let storage = Storage(client) diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 7ff2af7..1936f9d 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 5fe1c08..c28eec4 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 7ee2d2a..186f6ad 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 6a0346c..e7585ec 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 6c1ef64..02ee3da 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index b85cf8a..bcd65b6 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 68b5db8..c8630ad 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index eac7535..1f8a0cc 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 7d662d2..72226d4 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index a980954..65a899c 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership.md similarity index 61% rename from docs/examples/teams/update-membership-roles.md rename to docs/examples/teams/update-membership.md index c59bf92..1ac7d78 100644 --- a/docs/examples/teams/update-membership-roles.md +++ b/docs/examples/teams/update-membership.md @@ -1,12 +1,12 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) -let membership = try await teams.updateMembershipRoles( +let membership = try await teams.updateMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", roles: [] diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 3724269..357182b 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 68be409..6cfe79e 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,7 +1,7 @@ import Appwrite let client = Client() - .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint + .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client)