@appwrite.io/console 0.1.0-preview-0.0 → 0.1.0-preview-0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/sdk.js +98 -2
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +98 -2
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +98 -2
- package/docs/examples/databases/create-relationship-attribute.md +18 -0
- package/docs/examples/databases/update-relationship-attribute.md +18 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/models.ts +45 -0
- package/src/services/databases.ts +113 -1
- package/types/models.d.ts +45 -0
- package/types/services/databases.d.ts +31 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
|
|
|
33
33
|
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:
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.1.0-preview-0.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.1.0-preview-0.1"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -98,7 +98,7 @@ class Client {
|
|
|
98
98
|
'x-sdk-name': 'Console',
|
|
99
99
|
'x-sdk-platform': 'console',
|
|
100
100
|
'x-sdk-language': 'web',
|
|
101
|
-
'x-sdk-version': '0.1.0-preview-0.
|
|
101
|
+
'x-sdk-version': '0.1.0-preview-0.1',
|
|
102
102
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
103
103
|
};
|
|
104
104
|
this.realtime = {
|
|
@@ -2725,6 +2725,61 @@ class Databases extends Service {
|
|
|
2725
2725
|
}, payload);
|
|
2726
2726
|
});
|
|
2727
2727
|
}
|
|
2728
|
+
/**
|
|
2729
|
+
* Create relationship Attribute
|
|
2730
|
+
*
|
|
2731
|
+
*
|
|
2732
|
+
* @param {string} databaseId
|
|
2733
|
+
* @param {string} collectionId
|
|
2734
|
+
* @param {string} relatedCollectionId
|
|
2735
|
+
* @param {string} type
|
|
2736
|
+
* @param {boolean} twoWay
|
|
2737
|
+
* @param {string} key
|
|
2738
|
+
* @param {string} twoWayKey
|
|
2739
|
+
* @param {string} onDelete
|
|
2740
|
+
* @throws {AppwriteException}
|
|
2741
|
+
* @returns {Promise}
|
|
2742
|
+
*/
|
|
2743
|
+
createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) {
|
|
2744
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2745
|
+
if (typeof databaseId === 'undefined') {
|
|
2746
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2747
|
+
}
|
|
2748
|
+
if (typeof collectionId === 'undefined') {
|
|
2749
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2750
|
+
}
|
|
2751
|
+
if (typeof relatedCollectionId === 'undefined') {
|
|
2752
|
+
throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
|
|
2753
|
+
}
|
|
2754
|
+
if (typeof type === 'undefined') {
|
|
2755
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
2756
|
+
}
|
|
2757
|
+
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2758
|
+
let payload = {};
|
|
2759
|
+
if (typeof relatedCollectionId !== 'undefined') {
|
|
2760
|
+
payload['relatedCollectionId'] = relatedCollectionId;
|
|
2761
|
+
}
|
|
2762
|
+
if (typeof type !== 'undefined') {
|
|
2763
|
+
payload['type'] = type;
|
|
2764
|
+
}
|
|
2765
|
+
if (typeof twoWay !== 'undefined') {
|
|
2766
|
+
payload['twoWay'] = twoWay;
|
|
2767
|
+
}
|
|
2768
|
+
if (typeof key !== 'undefined') {
|
|
2769
|
+
payload['key'] = key;
|
|
2770
|
+
}
|
|
2771
|
+
if (typeof twoWayKey !== 'undefined') {
|
|
2772
|
+
payload['twoWayKey'] = twoWayKey;
|
|
2773
|
+
}
|
|
2774
|
+
if (typeof onDelete !== 'undefined') {
|
|
2775
|
+
payload['onDelete'] = onDelete;
|
|
2776
|
+
}
|
|
2777
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
2778
|
+
return yield this.client.call('post', uri, {
|
|
2779
|
+
'content-type': 'application/json',
|
|
2780
|
+
}, payload);
|
|
2781
|
+
});
|
|
2782
|
+
}
|
|
2728
2783
|
/**
|
|
2729
2784
|
* Create String Attribute
|
|
2730
2785
|
*
|
|
@@ -2980,6 +3035,43 @@ class Databases extends Service {
|
|
|
2980
3035
|
}, payload);
|
|
2981
3036
|
});
|
|
2982
3037
|
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Update Relationship Attribute
|
|
3040
|
+
*
|
|
3041
|
+
*
|
|
3042
|
+
* @param {string} databaseId
|
|
3043
|
+
* @param {string} collectionId
|
|
3044
|
+
* @param {string} key
|
|
3045
|
+
* @param {boolean} twoWay
|
|
3046
|
+
* @param {string} onDelete
|
|
3047
|
+
* @throws {AppwriteException}
|
|
3048
|
+
* @returns {Promise}
|
|
3049
|
+
*/
|
|
3050
|
+
updateRelationshipAttribute(databaseId, collectionId, key, twoWay, onDelete) {
|
|
3051
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3052
|
+
if (typeof databaseId === 'undefined') {
|
|
3053
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3054
|
+
}
|
|
3055
|
+
if (typeof collectionId === 'undefined') {
|
|
3056
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
3057
|
+
}
|
|
3058
|
+
if (typeof key === 'undefined') {
|
|
3059
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
3060
|
+
}
|
|
3061
|
+
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
3062
|
+
let payload = {};
|
|
3063
|
+
if (typeof twoWay !== 'undefined') {
|
|
3064
|
+
payload['twoWay'] = twoWay;
|
|
3065
|
+
}
|
|
3066
|
+
if (typeof onDelete !== 'undefined') {
|
|
3067
|
+
payload['onDelete'] = onDelete;
|
|
3068
|
+
}
|
|
3069
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
3070
|
+
return yield this.client.call('patch', uri, {
|
|
3071
|
+
'content-type': 'application/json',
|
|
3072
|
+
}, payload);
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
2983
3075
|
/**
|
|
2984
3076
|
* List Documents
|
|
2985
3077
|
*
|
|
@@ -3067,10 +3159,11 @@ class Databases extends Service {
|
|
|
3067
3159
|
* @param {string} databaseId
|
|
3068
3160
|
* @param {string} collectionId
|
|
3069
3161
|
* @param {string} documentId
|
|
3162
|
+
* @param {string[]} queries
|
|
3070
3163
|
* @throws {AppwriteException}
|
|
3071
3164
|
* @returns {Promise}
|
|
3072
3165
|
*/
|
|
3073
|
-
getDocument(databaseId, collectionId, documentId) {
|
|
3166
|
+
getDocument(databaseId, collectionId, documentId, queries) {
|
|
3074
3167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3075
3168
|
if (typeof databaseId === 'undefined') {
|
|
3076
3169
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -3083,6 +3176,9 @@ class Databases extends Service {
|
|
|
3083
3176
|
}
|
|
3084
3177
|
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
3085
3178
|
let payload = {};
|
|
3179
|
+
if (typeof queries !== 'undefined') {
|
|
3180
|
+
payload['queries'] = queries;
|
|
3181
|
+
}
|
|
3086
3182
|
const uri = new URL(this.client.config.endpoint + path);
|
|
3087
3183
|
return yield this.client.call('get', uri, {
|
|
3088
3184
|
'content-type': 'application/json',
|