diff --git a/README.md b/README.md index efdc76b..87846e8 100644 --- a/README.md +++ b/README.md @@ -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: "3.0.0"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "3.0.1"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index cb1e44f..d38b1c2 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -23,7 +23,7 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "3.0.0", + "x-sdk-version": "3.0.1", "X-Appwrite-Response-Format": "1.4.0" ] @@ -399,7 +399,7 @@ open class Client { converter: { return $0 as! [String: Any] } ) let chunksUploaded = map["chunksUploaded"] as! Int - offset = min(size, (chunksUploaded * Client.chunkSize)) + offset = chunksUploaded * Client.chunkSize } catch { // File does not exist yet, swallow exception } @@ -410,7 +410,7 @@ open class Client { ?? (input.data as! ByteBuffer).getSlice(at: offset, length: Int(size - offset)) params[paramName] = InputFile.fromBuffer(slice!, filename: input.filename, mimeType: input.mimeType) - headers["content-range"] = "bytes \(offset)-\(min((offset + Client.chunkSize) - 1, size))/\(size)" + headers["content-range"] = "bytes \(offset)-\(min((offset + Client.chunkSize) - 1, size - 1))/\(size)" result = try await call( method: "POST", diff --git a/Sources/Appwrite/Role.swift b/Sources/Appwrite/Role.swift index b8acdbb..1e8e755 100644 --- a/Sources/Appwrite/Role.swift +++ b/Sources/Appwrite/Role.swift @@ -1,8 +1,21 @@ +/// Helper class to generate role strings for `Permission`. public class Role { + + /// Grants access to anyone. + /// + /// This includes authenticated and unauthenticated users. public static func any() -> String { return "any" } + /// Grants access to a specific user by user ID. + /// + /// You can optionally pass verified or unverified for + /// `status` to target specific types of users. + /// + /// @param String id + /// @param String status + /// @return String public static func user(_ id: String, _ status: String = "") -> String { if(status.isEmpty) { return "user:\(id)" @@ -10,6 +23,13 @@ public class Role { return "user:\(id)/\(status)" } + /// Grants access to any authenticated or anonymous user. + /// + /// You can optionally pass verified or unverified for + /// `status` to target specific types of users. + /// + /// @param String status + /// @return String public static func users(_ status: String = "") -> String { if(status.isEmpty) { return "users" @@ -17,10 +37,23 @@ public class Role { return "users/\(status)" } + /// Grants access to any guest user without a session. + /// + /// Authenticated users don't have access to this role. + /// + /// @return String public static func guests() -> String { return "guests" } + /// Grants access to a team by team ID. + /// + /// You can optionally pass a role for `role` to target + /// team members with the specified role. + /// + /// @param String id + /// @param String role + /// @return String public static func team(_ id: String, _ role: String = "") -> String { if(role.isEmpty) { return "team:\(id)" @@ -28,7 +61,22 @@ public class Role { return "team:\(id)/\(role)" } + /// Grants access to a specific member of a team. + /// + /// When the member is removed from the team, they will + /// no longer have access. + /// + /// @param String id + /// @return String public static func member(_ id: String) -> String { return "member:\(id)" } + + /// Grants access to a user with the specified label. + /// + /// @param String name + /// @return String + public static func label(_ name: String) -> String { + return "label:\(name)" + } } \ No newline at end of file diff --git a/Sources/Appwrite/Services/Account.swift b/Sources/Appwrite/Services/Account.swift index da92501..6f56fc2 100644 --- a/Sources/Appwrite/Services/Account.swift +++ b/Sources/Appwrite/Services/Account.swift @@ -18,11 +18,11 @@ open class Account: Service { open func get( nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account" + let apiPath: String = "/account" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -32,9 +32,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -78,16 +78,16 @@ open class Account: Service { name: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account" + let apiPath: String = "/account" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "email": email, "password": password, "name": name ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -97,9 +97,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -158,14 +158,14 @@ open class Account: Service { password: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/email" + let apiPath: String = "/account/email" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "email": email, "password": password ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -175,9 +175,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -222,13 +222,13 @@ open class Account: Service { open func listIdentities( queries: String? = nil ) async throws -> AppwriteModels.IdentityList { - let api_path: String = "/account/identities" + let apiPath: String = "/account/identities" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -238,9 +238,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -257,20 +257,20 @@ open class Account: Service { open func deleteIdentity( identityId: String ) async throws -> Any { - let api_path: String = "/account/identities/{identityId}" + let apiPath: String = "/account/identities/{identityId}" .replacingOccurrences(of: "{identityId}", with: identityId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -287,11 +287,11 @@ open class Account: Service { /// open func createJWT( ) async throws -> AppwriteModels.Jwt { - let api_path: String = "/account/jwt" + let apiPath: String = "/account/jwt" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -301,9 +301,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -321,13 +321,13 @@ open class Account: Service { open func listLogs( queries: [String]? = nil ) async throws -> AppwriteModels.LogList { - let api_path: String = "/account/logs" + let apiPath: String = "/account/logs" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -337,9 +337,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -357,13 +357,13 @@ open class Account: Service { name: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/name" + let apiPath: String = "/account/name" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "name": name ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -373,9 +373,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -415,14 +415,14 @@ open class Account: Service { oldPassword: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/password" + let apiPath: String = "/account/password" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "password": password, "oldPassword": oldPassword ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -432,9 +432,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -481,14 +481,14 @@ open class Account: Service { password: String, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/phone" + let apiPath: String = "/account/phone" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "phone": phone, "password": password ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -498,9 +498,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -541,11 +541,11 @@ open class Account: Service { open func getPrefs( nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let api_path: String = "/account/prefs" + let apiPath: String = "/account/prefs" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -555,9 +555,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -592,13 +592,13 @@ open class Account: Service { prefs: Any, nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/prefs" + let apiPath: String = "/account/prefs" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "prefs": prefs ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -608,9 +608,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -656,14 +656,14 @@ open class Account: Service { email: String, url: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/recovery" + let apiPath: String = "/account/recovery" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "email": email, "url": url ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -673,9 +673,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -706,16 +706,16 @@ open class Account: Service { password: String, passwordAgain: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/recovery" + let apiPath: String = "/account/recovery" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret, "password": password, "passwordAgain": passwordAgain ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -725,9 +725,9 @@ open class Account: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -743,11 +743,11 @@ open class Account: Service { /// open func listSessions( ) async throws -> AppwriteModels.SessionList { - let api_path: String = "/account/sessions" + let apiPath: String = "/account/sessions" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -757,9 +757,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -775,19 +775,19 @@ open class Account: Service { /// open func deleteSessions( ) async throws -> Any { - let api_path: String = "/account/sessions" + let apiPath: String = "/account/sessions" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -805,11 +805,11 @@ open class Account: Service { /// open func createAnonymousSession( ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/anonymous" + let apiPath: String = "/account/sessions/anonymous" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -819,9 +819,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -844,14 +844,14 @@ open class Account: Service { email: String, password: String ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/email" + let apiPath: String = "/account/sessions/email" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "email": email, "password": password ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -861,9 +861,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -898,15 +898,15 @@ open class Account: Service { email: String, url: String? = nil ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/sessions/magic-url" + let apiPath: String = "/account/sessions/magic-url" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "email": email, "url": url ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -916,9 +916,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -947,14 +947,14 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/magic-url" + let apiPath: String = "/account/sessions/magic-url" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -964,9 +964,9 @@ open class Account: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1004,10 +1004,10 @@ open class Account: Service { failure: String? = nil, scopes: [String]? = nil ) throws -> Bool { - let api_path: String = "/account/sessions/oauth2/{provider}" + let apiPath: String = "/account/sessions/oauth2/{provider}" .replacingOccurrences(of: "{provider}", with: provider) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "success": success, "failure": failure, "scopes": scopes, @@ -1051,14 +1051,14 @@ open class Account: Service { userId: String, phone: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/sessions/phone" + let apiPath: String = "/account/sessions/phone" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "phone": phone ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1068,9 +1068,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1093,14 +1093,14 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/phone" + let apiPath: String = "/account/sessions/phone" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1110,9 +1110,9 @@ open class Account: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1130,12 +1130,12 @@ open class Account: Service { open func getSession( sessionId: String ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/{sessionId}" + let apiPath: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1145,9 +1145,9 @@ open class Account: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1166,12 +1166,12 @@ open class Account: Service { open func updateSession( sessionId: String ) async throws -> AppwriteModels.Session { - let api_path: String = "/account/sessions/{sessionId}" + let apiPath: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1181,9 +1181,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1203,20 +1203,20 @@ open class Account: Service { open func deleteSession( sessionId: String ) async throws -> Any { - let api_path: String = "/account/sessions/{sessionId}" + let apiPath: String = "/account/sessions/{sessionId}" .replacingOccurrences(of: "{sessionId}", with: sessionId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -1232,11 +1232,11 @@ open class Account: Service { open func updateStatus( nestedType: T.Type ) async throws -> AppwriteModels.User { - let api_path: String = "/account/status" + let apiPath: String = "/account/status" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1246,9 +1246,9 @@ open class Account: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1296,13 +1296,13 @@ open class Account: Service { open func createVerification( url: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/verification" + let apiPath: String = "/account/verification" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "url": url ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1312,9 +1312,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1336,14 +1336,14 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/verification" + let apiPath: String = "/account/verification" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1353,9 +1353,9 @@ open class Account: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1375,11 +1375,11 @@ open class Account: Service { /// open func createPhoneVerification( ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/verification/phone" + let apiPath: String = "/account/verification/phone" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1389,9 +1389,9 @@ open class Account: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -1413,14 +1413,14 @@ open class Account: Service { userId: String, secret: String ) async throws -> AppwriteModels.Token { - let api_path: String = "/account/verification/phone" + let apiPath: String = "/account/verification/phone" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -1430,9 +1430,9 @@ open class Account: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } diff --git a/Sources/Appwrite/Services/Avatars.swift b/Sources/Appwrite/Services/Avatars.swift index a792bee..ba87975 100644 --- a/Sources/Appwrite/Services/Avatars.swift +++ b/Sources/Appwrite/Services/Avatars.swift @@ -33,10 +33,10 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/browsers/{code}" + let apiPath: String = "/avatars/browsers/{code}" .replacingOccurrences(of: "{code}", with: code) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "width": width, "height": height, "quality": quality, @@ -45,8 +45,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -76,10 +76,10 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/credit-cards/{code}" + let apiPath: String = "/avatars/credit-cards/{code}" .replacingOccurrences(of: "{code}", with: code) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "width": width, "height": height, "quality": quality, @@ -88,8 +88,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -107,17 +107,17 @@ open class Avatars: Service { open func getFavicon( url: String ) async throws -> ByteBuffer { - let api_path: String = "/avatars/favicon" + let apiPath: String = "/avatars/favicon" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "url": url, "project": client.config["project"] ] return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -148,10 +148,10 @@ open class Avatars: Service { height: Int? = nil, quality: Int? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/flags/{code}" + let apiPath: String = "/avatars/flags/{code}" .replacingOccurrences(of: "{code}", with: code) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "width": width, "height": height, "quality": quality, @@ -160,8 +160,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -190,9 +190,9 @@ open class Avatars: Service { width: Int? = nil, height: Int? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/image" + let apiPath: String = "/avatars/image" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "url": url, "width": width, "height": height, @@ -201,8 +201,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -239,9 +239,9 @@ open class Avatars: Service { height: Int? = nil, background: String? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/initials" + let apiPath: String = "/avatars/initials" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "name": name, "width": width, "height": height, @@ -251,8 +251,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -276,9 +276,9 @@ open class Avatars: Service { margin: Int? = nil, download: Bool? = nil ) async throws -> ByteBuffer { - let api_path: String = "/avatars/qr" + let apiPath: String = "/avatars/qr" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "text": text, "size": size, "margin": margin, @@ -288,8 +288,8 @@ open class Avatars: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } diff --git a/Sources/Appwrite/Services/Databases.swift b/Sources/Appwrite/Services/Databases.swift index 00be009..45d6105 100644 --- a/Sources/Appwrite/Services/Databases.swift +++ b/Sources/Appwrite/Services/Databases.swift @@ -25,15 +25,15 @@ open class Databases: Service { queries: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.DocumentList { - let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents" + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -43,9 +43,9 @@ open class Databases: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -99,17 +99,17 @@ open class Databases: Service { permissions: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents" + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "documentId": documentId, "data": data, "permissions": permissions ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -119,9 +119,9 @@ open class Databases: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -179,16 +179,16 @@ open class Databases: Service { queries: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -198,9 +198,9 @@ open class Databases: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -255,17 +255,17 @@ open class Databases: Service { permissions: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Document { - let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "data": data, "permissions": permissions ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -275,9 +275,9 @@ open class Databases: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -329,22 +329,22 @@ open class Databases: Service { collectionId: String, documentId: String ) async throws -> Any { - let api_path: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .replacingOccurrences(of: "{databaseId}", with: databaseId) .replacingOccurrences(of: "{collectionId}", with: collectionId) .replacingOccurrences(of: "{documentId}", with: documentId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } diff --git a/Sources/Appwrite/Services/Functions.swift b/Sources/Appwrite/Services/Functions.swift index 7f9c658..82cc630 100644 --- a/Sources/Appwrite/Services/Functions.swift +++ b/Sources/Appwrite/Services/Functions.swift @@ -24,15 +24,15 @@ open class Functions: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.ExecutionList { - let api_path: String = "/functions/{functionId}/executions" + let apiPath: String = "/functions/{functionId}/executions" .replacingOccurrences(of: "{functionId}", with: functionId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries, "search": search ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -42,9 +42,9 @@ open class Functions: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -74,10 +74,10 @@ open class Functions: Service { method: String? = nil, headers: Any? = nil ) async throws -> AppwriteModels.Execution { - let api_path: String = "/functions/{functionId}/executions" + let apiPath: String = "/functions/{functionId}/executions" .replacingOccurrences(of: "{functionId}", with: functionId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "body": body, "async": async, "path": path, @@ -85,7 +85,7 @@ open class Functions: Service { "headers": headers ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -95,9 +95,9 @@ open class Functions: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -116,13 +116,13 @@ open class Functions: Service { functionId: String, executionId: String ) async throws -> AppwriteModels.Execution { - let api_path: String = "/functions/{functionId}/executions/{executionId}" + let apiPath: String = "/functions/{functionId}/executions/{executionId}" .replacingOccurrences(of: "{functionId}", with: functionId) .replacingOccurrences(of: "{executionId}", with: executionId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -132,9 +132,9 @@ open class Functions: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } diff --git a/Sources/Appwrite/Services/Graphql.swift b/Sources/Appwrite/Services/Graphql.swift index c530cec..0b78e1a 100644 --- a/Sources/Appwrite/Services/Graphql.swift +++ b/Sources/Appwrite/Services/Graphql.swift @@ -19,13 +19,13 @@ open class Graphql: Service { open func query( query: Any ) async throws -> Any { - let api_path: String = "/graphql" + let apiPath: String = "/graphql" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "query": query ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "x-sdk-graphql": "true", "content-type": "application/json" ] @@ -36,9 +36,9 @@ open class Graphql: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -55,13 +55,13 @@ open class Graphql: Service { open func mutation( query: Any ) async throws -> Any { - let api_path: String = "/graphql/mutation" + let apiPath: String = "/graphql/mutation" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "query": query ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "x-sdk-graphql": "true", "content-type": "application/json" ] @@ -72,9 +72,9 @@ open class Graphql: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } diff --git a/Sources/Appwrite/Services/Locale.swift b/Sources/Appwrite/Services/Locale.swift index f67fd95..716acb9 100644 --- a/Sources/Appwrite/Services/Locale.swift +++ b/Sources/Appwrite/Services/Locale.swift @@ -22,11 +22,11 @@ open class Locale: Service { /// open func get( ) async throws -> AppwriteModels.Locale { - let api_path: String = "/locale" + let apiPath: String = "/locale" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -36,9 +36,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -54,11 +54,11 @@ open class Locale: Service { /// open func listCodes( ) async throws -> AppwriteModels.LocaleCodeList { - let api_path: String = "/locale/codes" + let apiPath: String = "/locale/codes" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -68,9 +68,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -86,11 +86,11 @@ open class Locale: Service { /// open func listContinents( ) async throws -> AppwriteModels.ContinentList { - let api_path: String = "/locale/continents" + let apiPath: String = "/locale/continents" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -100,9 +100,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -118,11 +118,11 @@ open class Locale: Service { /// open func listCountries( ) async throws -> AppwriteModels.CountryList { - let api_path: String = "/locale/countries" + let apiPath: String = "/locale/countries" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -132,9 +132,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -150,11 +150,11 @@ open class Locale: Service { /// open func listCountriesEU( ) async throws -> AppwriteModels.CountryList { - let api_path: String = "/locale/countries/eu" + let apiPath: String = "/locale/countries/eu" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -164,9 +164,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -182,11 +182,11 @@ open class Locale: Service { /// open func listCountriesPhones( ) async throws -> AppwriteModels.PhoneList { - let api_path: String = "/locale/countries/phones" + let apiPath: String = "/locale/countries/phones" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -196,9 +196,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -215,11 +215,11 @@ open class Locale: Service { /// open func listCurrencies( ) async throws -> AppwriteModels.CurrencyList { - let api_path: String = "/locale/currencies" + let apiPath: String = "/locale/currencies" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -229,9 +229,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -247,11 +247,11 @@ open class Locale: Service { /// open func listLanguages( ) async throws -> AppwriteModels.LanguageList { - let api_path: String = "/locale/languages" + let apiPath: String = "/locale/languages" - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -261,9 +261,9 @@ open class Locale: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } diff --git a/Sources/Appwrite/Services/Storage.swift b/Sources/Appwrite/Services/Storage.swift index 33aa3de..36054a2 100644 --- a/Sources/Appwrite/Services/Storage.swift +++ b/Sources/Appwrite/Services/Storage.swift @@ -24,15 +24,15 @@ open class Storage: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.FileList { - let api_path: String = "/storage/buckets/{bucketId}/files" + let apiPath: String = "/storage/buckets/{bucketId}/files" .replacingOccurrences(of: "{bucketId}", with: bucketId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries, "search": search ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -42,9 +42,9 @@ open class Storage: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -85,16 +85,16 @@ open class Storage: Service { permissions: [String]? = nil, onProgress: ((UploadProgress) -> Void)? = nil ) async throws -> AppwriteModels.File { - let api_path: String = "/storage/buckets/{bucketId}/files" + let apiPath: String = "/storage/buckets/{bucketId}/files" .replacingOccurrences(of: "{bucketId}", with: bucketId) - var params: [String: Any?] = [ + var apiParams: [String: Any?] = [ "fileId": fileId, "file": file, "permissions": permissions ] - var headers: [String: String] = [ + var apiHeaders: [String: String] = [ "content-type": "multipart/form-data" ] @@ -105,9 +105,9 @@ open class Storage: Service { let idParamName: String? = "fileId" let paramName = "file" return try await client.chunkedUpload( - path: api_path, - headers: &headers, - params: ¶ms, + path: apiPath, + headers: &apiHeaders, + params: &apiParams, paramName: paramName, idParamName: idParamName, converter: converter, @@ -130,13 +130,13 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> AppwriteModels.File { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -146,9 +146,9 @@ open class Storage: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -172,16 +172,16 @@ open class Storage: Service { name: String? = nil, permissions: [String]? = nil ) async throws -> AppwriteModels.File { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "name": name, "permissions": permissions ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -191,9 +191,9 @@ open class Storage: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -213,21 +213,21 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> Any { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -246,16 +246,16 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> ByteBuffer { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/download" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/download" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -299,11 +299,11 @@ open class Storage: Service { background: String? = nil, output: String? = nil ) async throws -> ByteBuffer { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/preview" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "width": width, "height": height, "gravity": gravity, @@ -320,8 +320,8 @@ open class Storage: Service { return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } @@ -341,16 +341,16 @@ open class Storage: Service { bucketId: String, fileId: String ) async throws -> ByteBuffer { - let api_path: String = "/storage/buckets/{bucketId}/files/{fileId}/view" + let apiPath: String = "/storage/buckets/{bucketId}/files/{fileId}/view" .replacingOccurrences(of: "{bucketId}", with: bucketId) .replacingOccurrences(of: "{fileId}", with: fileId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] return try await client.call( method: "GET", - path: api_path, - params: params + path: apiPath, + params: apiParams ) } diff --git a/Sources/Appwrite/Services/Teams.swift b/Sources/Appwrite/Services/Teams.swift index c034f65..18c012e 100644 --- a/Sources/Appwrite/Services/Teams.swift +++ b/Sources/Appwrite/Services/Teams.swift @@ -23,14 +23,14 @@ open class Teams: Service { search: String? = nil, nestedType: T.Type ) async throws -> AppwriteModels.TeamList { - let api_path: String = "/teams" + let apiPath: String = "/teams" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries, "search": search ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -40,9 +40,9 @@ open class Teams: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -88,15 +88,15 @@ open class Teams: Service { roles: [String]? = nil, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let api_path: String = "/teams" + let apiPath: String = "/teams" - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "teamId": teamId, "name": name, "roles": roles ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -106,9 +106,9 @@ open class Teams: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -152,12 +152,12 @@ open class Teams: Service { teamId: String, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let api_path: String = "/teams/{teamId}" + let apiPath: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -167,9 +167,9 @@ open class Teams: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -207,14 +207,14 @@ open class Teams: Service { name: String, nestedType: T.Type ) async throws -> AppwriteModels.Team { - let api_path: String = "/teams/{teamId}" + let apiPath: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "name": name ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -224,9 +224,9 @@ open class Teams: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -265,20 +265,20 @@ open class Teams: Service { open func delete( teamId: String ) async throws -> Any { - let api_path: String = "/teams/{teamId}" + let apiPath: String = "/teams/{teamId}" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -298,15 +298,15 @@ open class Teams: Service { queries: [String]? = nil, search: String? = nil ) async throws -> AppwriteModels.MembershipList { - let api_path: String = "/teams/{teamId}/memberships" + let apiPath: String = "/teams/{teamId}/memberships" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "queries": queries, "search": search ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -316,9 +316,9 @@ open class Teams: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -367,10 +367,10 @@ open class Teams: Service { phone: String? = nil, name: String? = nil ) async throws -> AppwriteModels.Membership { - let api_path: String = "/teams/{teamId}/memberships" + let apiPath: String = "/teams/{teamId}/memberships" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "email": email, "userId": userId, "phone": phone, @@ -379,7 +379,7 @@ open class Teams: Service { "name": name ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -389,9 +389,9 @@ open class Teams: Service { return try await client.call( method: "POST", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -411,13 +411,13 @@ open class Teams: Service { teamId: String, membershipId: String ) async throws -> AppwriteModels.Membership { - let api_path: String = "/teams/{teamId}/memberships/{membershipId}" + let apiPath: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -427,9 +427,9 @@ open class Teams: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -453,15 +453,15 @@ open class Teams: Service { membershipId: String, roles: [String] ) async throws -> AppwriteModels.Membership { - let api_path: String = "/teams/{teamId}/memberships/{membershipId}" + let apiPath: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "roles": roles ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -471,9 +471,9 @@ open class Teams: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -494,21 +494,21 @@ open class Teams: Service { teamId: String, membershipId: String ) async throws -> Any { - let api_path: String = "/teams/{teamId}/memberships/{membershipId}" + let apiPath: String = "/teams/{teamId}/memberships/{membershipId}" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] return try await client.call( method: "DELETE", - path: api_path, - headers: headers, - params: params ) + path: apiPath, + headers: apiHeaders, + params: apiParams ) } /// @@ -535,16 +535,16 @@ open class Teams: Service { userId: String, secret: String ) async throws -> AppwriteModels.Membership { - let api_path: String = "/teams/{teamId}/memberships/{membershipId}/status" + let apiPath: String = "/teams/{teamId}/memberships/{membershipId}/status" .replacingOccurrences(of: "{teamId}", with: teamId) .replacingOccurrences(of: "{membershipId}", with: membershipId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "userId": userId, "secret": secret ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -554,9 +554,9 @@ open class Teams: Service { return try await client.call( method: "PATCH", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -576,12 +576,12 @@ open class Teams: Service { teamId: String, nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let api_path: String = "/teams/{teamId}/prefs" + let apiPath: String = "/teams/{teamId}/prefs" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any] = [:] + let apiParams: [String: Any] = [:] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -591,9 +591,9 @@ open class Teams: Service { return try await client.call( method: "GET", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) } @@ -635,14 +635,14 @@ open class Teams: Service { prefs: Any, nestedType: T.Type ) async throws -> AppwriteModels.Preferences { - let api_path: String = "/teams/{teamId}/prefs" + let apiPath: String = "/teams/{teamId}/prefs" .replacingOccurrences(of: "{teamId}", with: teamId) - let params: [String: Any?] = [ + let apiParams: [String: Any?] = [ "prefs": prefs ] - let headers: [String: String] = [ + let apiHeaders: [String: String] = [ "content-type": "application/json" ] @@ -652,9 +652,9 @@ open class Teams: Service { return try await client.call( method: "PUT", - path: api_path, - headers: headers, - params: params, + path: apiPath, + headers: apiHeaders, + params: apiParams, converter: converter ) }