2021-11-26 02:07:19 +13:00
|
|
|
import Appwrite
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
let client = Client()
|
|
|
|
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
|
|
|
|
.setProject("5df5acd0d48c2") // Your project ID
|
|
|
|
|
|
|
|
let database = Database(client)
|
|
|
|
database.createDocument(
|
|
|
|
collectionId: "[COLLECTION_ID]",
|
2022-01-05 00:53:40 +13:00
|
|
|
documentId: "[DOCUMENT_ID]",
|
2021-11-26 02:07:19 +13:00
|
|
|
data:
|
|
|
|
) { result in
|
|
|
|
switch result {
|
|
|
|
case .failure(let error):
|
|
|
|
print(error.message)
|
|
|
|
case .success(let document):
|
|
|
|
print(String(describing: document)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|