updated examples
This commit is contained in:
parent
6a9bd2710c
commit
123d93d40d
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createAnonymousSession() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
let session = try await account.createAnonymousSession()
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createJWT() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let jwt):
|
||||
print(String(describing: jwt)
|
||||
}
|
||||
}
|
||||
let jwt = try await account.createJWT()
|
||||
|
||||
print(String(describing: jwt)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createMagicURLSession(
|
||||
let token = try await account.createMagicURLSession(
|
||||
userId: "[USER_ID]",
|
||||
email: "email@example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createOAuth2Session(
|
||||
let success = try await account.createOAuth2Session(
|
||||
provider: "amazon"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let success):
|
||||
print(String(describing: success)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: success)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createRecovery(
|
||||
let token = try await account.createRecovery(
|
||||
email: "email@example.com",
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createSession(
|
||||
let session = try await account.createSession(
|
||||
email: "email@example.com",
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.createVerification(
|
||||
let token = try await account.createVerification(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.create(
|
||||
let user = try await account.create(
|
||||
userId: "[USER_ID]",
|
||||
email: "email@example.com",
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.deleteSession(
|
||||
let result = try await account.deleteSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.deleteSessions() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
let result = try await account.deleteSessions()
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.delete() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
let result = try await account.delete()
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.getLogs() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let logList):
|
||||
print(String(describing: logList)
|
||||
}
|
||||
}
|
||||
let logList = try await account.getLogs()
|
||||
|
||||
print(String(describing: logList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.getPrefs() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let preferences):
|
||||
print(String(describing: preferences)
|
||||
}
|
||||
}
|
||||
let preferences = try await account.getPrefs()
|
||||
|
||||
print(String(describing: preferences)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.getSession(
|
||||
let session = try await account.getSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.getSessions() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let sessionList):
|
||||
print(String(describing: sessionList)
|
||||
}
|
||||
}
|
||||
let sessionList = try await account.getSessions()
|
||||
|
||||
print(String(describing: sessionList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.get() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
let user = try await account.get()
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateEmail(
|
||||
let user = try await account.updateEmail(
|
||||
email: "email@example.com",
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateMagicURLSession(
|
||||
let session = try await account.updateMagicURLSession(
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateName(
|
||||
let user = try await account.updateName(
|
||||
name: "[NAME]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updatePassword(
|
||||
let user = try await account.updatePassword(
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updatePrefs(
|
||||
let user = try await account.updatePrefs(
|
||||
prefs:
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateRecovery(
|
||||
let token = try await account.updateRecovery(
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]",
|
||||
password: "password",
|
||||
passwordAgain: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateSession(
|
||||
let session = try await account.updateSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let account = Account(client)
|
||||
account.updateVerification(
|
||||
let token = try await account.updateVerification(
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getBrowser(
|
||||
let byteBuffer = try await avatars.getBrowser(
|
||||
code: "aa"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getCreditCard(
|
||||
let byteBuffer = try await avatars.getCreditCard(
|
||||
code: "amex"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getFavicon(
|
||||
let byteBuffer = try await avatars.getFavicon(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getFlag(
|
||||
let byteBuffer = try await avatars.getFlag(
|
||||
code: "af"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getImage(
|
||||
let byteBuffer = try await avatars.getImage(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getInitials() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
let byteBuffer = try await avatars.getInitials()
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getQR(
|
||||
let byteBuffer = try await avatars.getQR(
|
||||
text: "[TEXT]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let database = Database(client)
|
||||
database.createDocument(
|
||||
let document = try await database.createDocument(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]",
|
||||
data:
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let document):
|
||||
print(String(describing: document)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let database = Database(client)
|
||||
database.deleteDocument(
|
||||
let result = try await database.deleteDocument(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let database = Database(client)
|
||||
database.getDocument(
|
||||
let document = try await database.getDocument(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let document):
|
||||
print(String(describing: document)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let database = Database(client)
|
||||
database.listDocuments(
|
||||
let documentList = try await database.listDocuments(
|
||||
collectionId: "[COLLECTION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let documentList):
|
||||
print(String(describing: documentList)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: documentList)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let database = Database(client)
|
||||
database.updateDocument(
|
||||
let document = try await database.updateDocument(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]",
|
||||
data:
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let document):
|
||||
print(String(describing: document)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let functions = Functions(client)
|
||||
functions.createExecution(
|
||||
let execution = try await functions.createExecution(
|
||||
functionId: "[FUNCTION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let execution):
|
||||
print(String(describing: execution)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: execution)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let functions = Functions(client)
|
||||
functions.getExecution(
|
||||
let execution = try await functions.getExecution(
|
||||
functionId: "[FUNCTION_ID]",
|
||||
executionId: "[EXECUTION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let execution):
|
||||
print(String(describing: execution)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: execution)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let functions = Functions(client)
|
||||
functions.listExecutions(
|
||||
let executionList = try await functions.listExecutions(
|
||||
functionId: "[FUNCTION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let executionList):
|
||||
print(String(describing: executionList)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: executionList)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let functions = Functions(client)
|
||||
functions.retryBuild(
|
||||
let result = try await functions.retryBuild(
|
||||
functionId: "[FUNCTION_ID]",
|
||||
deploymentId: "[DEPLOYMENT_ID]",
|
||||
buildId: "[BUILD_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getContinents() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let continentList):
|
||||
print(String(describing: continentList)
|
||||
}
|
||||
}
|
||||
let continentList = try await locale.getContinents()
|
||||
|
||||
print(String(describing: continentList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getCountriesEU() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let countryList):
|
||||
print(String(describing: countryList)
|
||||
}
|
||||
}
|
||||
let countryList = try await locale.getCountriesEU()
|
||||
|
||||
print(String(describing: countryList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getCountriesPhones() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let phoneList):
|
||||
print(String(describing: phoneList)
|
||||
}
|
||||
}
|
||||
let phoneList = try await locale.getCountriesPhones()
|
||||
|
||||
print(String(describing: phoneList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getCountries() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let countryList):
|
||||
print(String(describing: countryList)
|
||||
}
|
||||
}
|
||||
let countryList = try await locale.getCountries()
|
||||
|
||||
print(String(describing: countryList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getCurrencies() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let currencyList):
|
||||
print(String(describing: currencyList)
|
||||
}
|
||||
}
|
||||
let currencyList = try await locale.getCurrencies()
|
||||
|
||||
print(String(describing: currencyList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.getLanguages() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let languageList):
|
||||
print(String(describing: languageList)
|
||||
}
|
||||
}
|
||||
let languageList = try await locale.getLanguages()
|
||||
|
||||
print(String(describing: languageList)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let locale = Locale(client)
|
||||
locale.get() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let locale):
|
||||
print(String(describing: locale)
|
||||
}
|
||||
}
|
||||
let locale = try await locale.get()
|
||||
|
||||
print(String(describing: locale)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.createFile(
|
||||
let file = try await storage.createFile(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]",
|
||||
file: File(name: "image.jpg", buffer: yourByteBuffer)
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let file):
|
||||
print(String(describing: file)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: file)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.deleteFile(
|
||||
let result = try await storage.deleteFile(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.getFileDownload(
|
||||
let byteBuffer = try await storage.getFileDownload(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.getFilePreview(
|
||||
let byteBuffer = try await storage.getFilePreview(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.getFileView(
|
||||
let byteBuffer = try await storage.getFileView(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.getFile(
|
||||
let file = try await storage.getFile(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let file):
|
||||
print(String(describing: file)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: file)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.listFiles(
|
||||
let fileList = try await storage.listFiles(
|
||||
bucketId: "[BUCKET_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let fileList):
|
||||
print(String(describing: fileList)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: fileList)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let storage = Storage(client)
|
||||
storage.updateFile(
|
||||
let file = try await storage.updateFile(
|
||||
bucketId: "[BUCKET_ID]",
|
||||
fileId: "[FILE_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let file):
|
||||
print(String(describing: file)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: file)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.createMembership(
|
||||
let membership = try await teams.createMembership(
|
||||
teamId: "[TEAM_ID]",
|
||||
email: "email@example.com",
|
||||
roles: [],
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let membership):
|
||||
print(String(describing: membership)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: membership)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.create(
|
||||
let team = try await teams.create(
|
||||
teamId: "[TEAM_ID]",
|
||||
name: "[NAME]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let team):
|
||||
print(String(describing: team)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: team)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.deleteMembership(
|
||||
let result = try await teams.deleteMembership(
|
||||
teamId: "[TEAM_ID]",
|
||||
membershipId: "[MEMBERSHIP_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.delete(
|
||||
let result = try await teams.delete(
|
||||
teamId: "[TEAM_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.getMembership(
|
||||
let membershipList = try await teams.getMembership(
|
||||
teamId: "[TEAM_ID]",
|
||||
membershipId: "[MEMBERSHIP_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let membershipList):
|
||||
print(String(describing: membershipList)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: membershipList)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.getMemberships(
|
||||
let membershipList = try await teams.getMemberships(
|
||||
teamId: "[TEAM_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let membershipList):
|
||||
print(String(describing: membershipList)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: membershipList)
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.get(
|
||||
let team = try await teams.get(
|
||||
teamId: "[TEAM_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let team):
|
||||
print(String(describing: team)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: team)
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.list() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let teamList):
|
||||
print(String(describing: teamList)
|
||||
}
|
||||
}
|
||||
let teamList = try await teams.list()
|
||||
|
||||
print(String(describing: teamList)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.updateMembershipRoles(
|
||||
let membership = try await teams.updateMembershipRoles(
|
||||
teamId: "[TEAM_ID]",
|
||||
membershipId: "[MEMBERSHIP_ID]",
|
||||
roles: []
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let membership):
|
||||
print(String(describing: membership)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: membership)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.updateMembershipStatus(
|
||||
let membership = try await teams.updateMembershipStatus(
|
||||
teamId: "[TEAM_ID]",
|
||||
membershipId: "[MEMBERSHIP_ID]",
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let membership):
|
||||
print(String(describing: membership)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: membership)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
|
||||
let teams = Teams(client)
|
||||
teams.update(
|
||||
let team = try await teams.update(
|
||||
teamId: "[TEAM_ID]",
|
||||
name: "[NAME]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let team):
|
||||
print(String(describing: team)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: team)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.createRecovery(
|
||||
let token = try await account.createRecovery(
|
||||
email: "email@example.com",
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.createVerification(
|
||||
let token = try await account.createVerification(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.deleteSession(
|
||||
let result = try await account.deleteSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.deleteSessions() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
let result = try await account.deleteSessions()
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.delete() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let ):
|
||||
print(String(describing: )
|
||||
}
|
||||
}
|
||||
let result = try await account.delete()
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.getLogs() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let logList):
|
||||
print(String(describing: logList)
|
||||
}
|
||||
}
|
||||
let logList = try await account.getLogs()
|
||||
|
||||
print(String(describing: logList)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.getPrefs() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let preferences):
|
||||
print(String(describing: preferences)
|
||||
}
|
||||
}
|
||||
let preferences = try await account.getPrefs()
|
||||
|
||||
print(String(describing: preferences)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.getSession(
|
||||
let session = try await account.getSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.getSessions() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let sessionList):
|
||||
print(String(describing: sessionList)
|
||||
}
|
||||
}
|
||||
let sessionList = try await account.getSessions()
|
||||
|
||||
print(String(describing: sessionList)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.get() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
let user = try await account.get()
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updateEmail(
|
||||
let user = try await account.updateEmail(
|
||||
email: "email@example.com",
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updateName(
|
||||
let user = try await account.updateName(
|
||||
name: "[NAME]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updatePassword(
|
||||
let user = try await account.updatePassword(
|
||||
password: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updatePrefs(
|
||||
let user = try await account.updatePrefs(
|
||||
prefs:
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let user):
|
||||
print(String(describing: user)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: user)
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updateRecovery(
|
||||
let token = try await account.updateRecovery(
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]",
|
||||
password: "password",
|
||||
passwordAgain: "password"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updateSession(
|
||||
let session = try await account.updateSession(
|
||||
sessionId: "[SESSION_ID]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let session):
|
||||
print(String(describing: session)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: session)
|
||||
}
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
|
||||
|
||||
let account = Account(client)
|
||||
account.updateVerification(
|
||||
let token = try await account.updateVerification(
|
||||
userId: "[USER_ID]",
|
||||
secret: "[SECRET]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let token):
|
||||
print(String(describing: token)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: token)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getBrowser(
|
||||
let byteBuffer = try await avatars.getBrowser(
|
||||
code: "aa"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getCreditCard(
|
||||
let byteBuffer = try await avatars.getCreditCard(
|
||||
code: "amex"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getFavicon(
|
||||
let byteBuffer = try await avatars.getFavicon(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getFlag(
|
||||
let byteBuffer = try await avatars.getFlag(
|
||||
code: "af"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getImage(
|
||||
let byteBuffer = try await avatars.getImage(
|
||||
url: "https://example.com"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getInitials() { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
let byteBuffer = try await avatars.getInitials()
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let avatars = Avatars(client)
|
||||
avatars.getQR(
|
||||
let byteBuffer = try await avatars.getQR(
|
||||
text: "[TEXT]"
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let byteBuffer):
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: byteBuffer)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createBooleanAttribute(
|
||||
let attributeBoolean = try await database.createBooleanAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeBoolean):
|
||||
print(String(describing: attributeBoolean)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeBoolean)
|
||||
}
|
||||
|
|
|
@ -1,24 +1,18 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createCollection(
|
||||
let collection = try await database.createCollection(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
name: "[NAME]",
|
||||
permission: "document",
|
||||
read: ["role:all"],
|
||||
write: ["role:all"]
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let collection):
|
||||
print(String(describing: collection)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: collection)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createDocument(
|
||||
let document = try await database.createDocument(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]",
|
||||
data:
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let document):
|
||||
print(String(describing: document)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createEmailAttribute(
|
||||
let attributeEmail = try await database.createEmailAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeEmail):
|
||||
print(String(describing: attributeEmail)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeEmail)
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createEnumAttribute(
|
||||
let attributeEnum = try await database.createEnumAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
elements: [],
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeEnum):
|
||||
print(String(describing: attributeEnum)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeEnum)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createFloatAttribute(
|
||||
let attributeFloat = try await database.createFloatAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeFloat):
|
||||
print(String(describing: attributeFloat)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeFloat)
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createIndex(
|
||||
let index = try await database.createIndex(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
type: "key",
|
||||
attributes: []
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let index):
|
||||
print(String(describing: index)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: index)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createIntegerAttribute(
|
||||
let attributeInteger = try await database.createIntegerAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeInteger):
|
||||
print(String(describing: attributeInteger)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeInteger)
|
||||
}
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createIpAttribute(
|
||||
let attributeIp = try await database.createIpAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeIp):
|
||||
print(String(describing: attributeIp)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeIp)
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
import Appwrite
|
||||
|
||||
func main() {
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
|
||||
|
||||
let database = Database(client)
|
||||
database.createStringAttribute(
|
||||
let attributeString = try await database.createStringAttribute(
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
key: "",
|
||||
size: 1,
|
||||
required: xfalse
|
||||
) { result in
|
||||
switch result {
|
||||
case .failure(let error):
|
||||
print(error.message)
|
||||
case .success(let attributeString):
|
||||
print(String(describing: attributeString)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print(String(describing: attributeString)
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue