mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
chore: update docs and specs
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import Appwrite
|
||||
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
let databases = Databases(client)
|
||||
let document = try await databases.createDocument(
|
||||
databaseId: "[DATABASE_ID]",
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]",
|
||||
data: [:]
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import Appwrite
|
||||
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
let databases = Databases(client)
|
||||
let result = try await databases.deleteDocument(
|
||||
databaseId: "[DATABASE_ID]",
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]"
|
||||
)
|
||||
|
||||
print(String(describing: result)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import Appwrite
|
||||
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
let databases = Databases(client)
|
||||
let document = try await databases.getDocument(
|
||||
databaseId: "[DATABASE_ID]",
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]"
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Appwrite
|
||||
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
let databases = Databases(client)
|
||||
let documentList = try await databases.listDocuments(
|
||||
databaseId: "[DATABASE_ID]",
|
||||
collectionId: "[COLLECTION_ID]"
|
||||
)
|
||||
|
||||
print(String(describing: documentList)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Appwrite
|
||||
|
||||
func main() async throws {
|
||||
let client = Client()
|
||||
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
||||
.setProject("5df5acd0d48c2") // Your project ID
|
||||
let databases = Databases(client)
|
||||
let document = try await databases.updateDocument(
|
||||
databaseId: "[DATABASE_ID]",
|
||||
collectionId: "[COLLECTION_ID]",
|
||||
documentId: "[DOCUMENT_ID]",
|
||||
data: [:]
|
||||
)
|
||||
|
||||
print(String(describing: document)
|
||||
}
|
||||
Reference in New Issue
Block a user