Skip to content

Commit e3f3607

Browse files
authored
Merge pull request #84 from appwrite/dev
feat: Console SDK update for version 10.0.0
2 parents 4c1c4bb + 0ac1d55 commit e3f3607

83 files changed

Lines changed: 6510 additions & 5 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 10.0.0
4+
5+
* Added `DocumentsDB` service with full CRUD for document-based databases, collections, attributes, indexes, and documents
6+
* Added `VectorsDB` service with full CRUD for vector databases, collections, attributes, indexes, and documents
7+
* Added `DocumentsDBIndexType` and `VectorsDBIndexType` enums
8+
* Added `DocumentsDB` and `VectorsDB` to `ServiceId` enum
9+
* Added `Model` enum
10+
311
## 9.1.0
412

513
* Added optional `secret` parameter to `webhooks.create()` and `webhooks.updateSecret()` methods

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
3333
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@9.1.0"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@10.0.0"></script>
3737
```
3838

3939

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```javascript
2+
import { Client, DocumentsDB, Permission, Role } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.createCollection({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
name: '<NAME>',
14+
permissions: [Permission.read(Role.any())], // optional
15+
documentSecurity: false, // optional
16+
enabled: false, // optional
17+
attributes: [], // optional
18+
indexes: [] // optional
19+
});
20+
21+
console.log(result);
22+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```javascript
2+
import { Client, DocumentsDB, Permission, Role } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.createDocument({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
documentId: '<DOCUMENT_ID>',
14+
data: {
15+
"username": "walter.obrien",
16+
"email": "walter.obrien@example.com",
17+
"fullName": "Walter O'Brien",
18+
"age": 30,
19+
"isAdmin": false
20+
},
21+
permissions: [Permission.read(Role.any())] // optional
22+
});
23+
24+
console.log(result);
25+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```javascript
2+
import { Client, DocumentsDB } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.createDocuments({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
documents: []
14+
});
15+
16+
console.log(result);
17+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
```javascript
2+
import { Client, DocumentsDB, DocumentsDBIndexType, OrderBy } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.createIndex({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
key: '',
14+
type: DocumentsDBIndexType.Key,
15+
attributes: [],
16+
orders: [OrderBy.Asc], // optional
17+
lengths: [] // optional
18+
});
19+
20+
console.log(result);
21+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```javascript
2+
import { Client, DocumentsDB } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.createTransaction({
11+
ttl: 60 // optional
12+
});
13+
14+
console.log(result);
15+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```javascript
2+
import { Client, DocumentsDB } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.create({
11+
databaseId: '<DATABASE_ID>',
12+
name: '<NAME>',
13+
enabled: false // optional
14+
});
15+
16+
console.log(result);
17+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
```javascript
2+
import { Client, DocumentsDB } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.decrementDocumentAttribute({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>',
13+
documentId: '<DOCUMENT_ID>',
14+
attribute: '',
15+
value: null, // optional
16+
min: null, // optional
17+
transactionId: '<TRANSACTION_ID>' // optional
18+
});
19+
20+
console.log(result);
21+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```javascript
2+
import { Client, DocumentsDB } from "@appwrite.io/console";
3+
4+
const client = new Client()
5+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
6+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
7+
8+
const documentsDB = new DocumentsDB(client);
9+
10+
const result = await documentsDB.deleteCollection({
11+
databaseId: '<DATABASE_ID>',
12+
collectionId: '<COLLECTION_ID>'
13+
});
14+
15+
console.log(result);
16+
```

0 commit comments

Comments
 (0)