@appwrite.io/console 0.1.0-preview-0.0 → 0.1.0
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 +104 -6
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +104 -6
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +104 -6
- package/docs/examples/databases/create-relationship-attribute.md +18 -0
- package/docs/examples/{teams/update.md → databases/update-relationship-attribute.md} +3 -3
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/models.ts +52 -56
- package/src/services/account.ts +6 -6
- package/src/services/databases.ts +114 -1
- package/types/models.d.ts +52 -56
- package/types/services/account.d.ts +6 -6
- package/types/services/databases.d.ts +36 -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
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.1.0"></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
|
|
101
|
+
'x-sdk-version': '0.1.0',
|
|
102
102
|
'X-Appwrite-Response-Format': '1.0.0',
|
|
103
103
|
};
|
|
104
104
|
this.realtime = {
|
|
@@ -883,7 +883,7 @@ class Account extends Service {
|
|
|
883
883
|
* password combination. This route will create a new session for the user.
|
|
884
884
|
*
|
|
885
885
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
886
|
-
* about session limits](/docs/authentication#limits).
|
|
886
|
+
* about session limits](/docs/authentication-security#limits).
|
|
887
887
|
*
|
|
888
888
|
* @param {string} email
|
|
889
889
|
* @param {string} password
|
|
@@ -928,7 +928,7 @@ class Account extends Service {
|
|
|
928
928
|
* your Appwrite instance by default.
|
|
929
929
|
*
|
|
930
930
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
931
|
-
* about session limits](/docs/authentication#limits).
|
|
931
|
+
* about session limits](/docs/authentication-security#limits).
|
|
932
932
|
*
|
|
933
933
|
* @param {string} userId
|
|
934
934
|
* @param {string} email
|
|
@@ -1019,7 +1019,7 @@ class Account extends Service {
|
|
|
1019
1019
|
* user.
|
|
1020
1020
|
*
|
|
1021
1021
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1022
|
-
* about session limits](/docs/authentication#limits).
|
|
1022
|
+
* about session limits](/docs/authentication-security#limits).
|
|
1023
1023
|
*
|
|
1024
1024
|
*
|
|
1025
1025
|
* @param {string} provider
|
|
@@ -1067,7 +1067,7 @@ class Account extends Service {
|
|
|
1067
1067
|
* is valid for 15 minutes.
|
|
1068
1068
|
*
|
|
1069
1069
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1070
|
-
* about session limits](/docs/authentication#limits).
|
|
1070
|
+
* about session limits](/docs/authentication-security#limits).
|
|
1071
1071
|
*
|
|
1072
1072
|
* @param {string} userId
|
|
1073
1073
|
* @param {string} phone
|
|
@@ -2725,6 +2725,64 @@ class Databases extends Service {
|
|
|
2725
2725
|
}, payload);
|
|
2726
2726
|
});
|
|
2727
2727
|
}
|
|
2728
|
+
/**
|
|
2729
|
+
* Create Relationship Attribute
|
|
2730
|
+
*
|
|
2731
|
+
* Create relationship attribute. [Learn more about relationship
|
|
2732
|
+
* attributes](docs/databases-relationships#relationship-attributes).
|
|
2733
|
+
*
|
|
2734
|
+
*
|
|
2735
|
+
* @param {string} databaseId
|
|
2736
|
+
* @param {string} collectionId
|
|
2737
|
+
* @param {string} relatedCollectionId
|
|
2738
|
+
* @param {string} type
|
|
2739
|
+
* @param {boolean} twoWay
|
|
2740
|
+
* @param {string} key
|
|
2741
|
+
* @param {string} twoWayKey
|
|
2742
|
+
* @param {string} onDelete
|
|
2743
|
+
* @throws {AppwriteException}
|
|
2744
|
+
* @returns {Promise}
|
|
2745
|
+
*/
|
|
2746
|
+
createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) {
|
|
2747
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2748
|
+
if (typeof databaseId === 'undefined') {
|
|
2749
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2750
|
+
}
|
|
2751
|
+
if (typeof collectionId === 'undefined') {
|
|
2752
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2753
|
+
}
|
|
2754
|
+
if (typeof relatedCollectionId === 'undefined') {
|
|
2755
|
+
throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
|
|
2756
|
+
}
|
|
2757
|
+
if (typeof type === 'undefined') {
|
|
2758
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
2759
|
+
}
|
|
2760
|
+
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2761
|
+
let payload = {};
|
|
2762
|
+
if (typeof relatedCollectionId !== 'undefined') {
|
|
2763
|
+
payload['relatedCollectionId'] = relatedCollectionId;
|
|
2764
|
+
}
|
|
2765
|
+
if (typeof type !== 'undefined') {
|
|
2766
|
+
payload['type'] = type;
|
|
2767
|
+
}
|
|
2768
|
+
if (typeof twoWay !== 'undefined') {
|
|
2769
|
+
payload['twoWay'] = twoWay;
|
|
2770
|
+
}
|
|
2771
|
+
if (typeof key !== 'undefined') {
|
|
2772
|
+
payload['key'] = key;
|
|
2773
|
+
}
|
|
2774
|
+
if (typeof twoWayKey !== 'undefined') {
|
|
2775
|
+
payload['twoWayKey'] = twoWayKey;
|
|
2776
|
+
}
|
|
2777
|
+
if (typeof onDelete !== 'undefined') {
|
|
2778
|
+
payload['onDelete'] = onDelete;
|
|
2779
|
+
}
|
|
2780
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
2781
|
+
return yield this.client.call('post', uri, {
|
|
2782
|
+
'content-type': 'application/json',
|
|
2783
|
+
}, payload);
|
|
2784
|
+
});
|
|
2785
|
+
}
|
|
2728
2786
|
/**
|
|
2729
2787
|
* Create String Attribute
|
|
2730
2788
|
*
|
|
@@ -2980,6 +3038,42 @@ class Databases extends Service {
|
|
|
2980
3038
|
}, payload);
|
|
2981
3039
|
});
|
|
2982
3040
|
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Update Relationship Attribute
|
|
3043
|
+
*
|
|
3044
|
+
* Update relationship attribute. [Learn more about relationship
|
|
3045
|
+
* attributes](docs/databases-relationships#relationship-attributes).
|
|
3046
|
+
*
|
|
3047
|
+
*
|
|
3048
|
+
* @param {string} databaseId
|
|
3049
|
+
* @param {string} collectionId
|
|
3050
|
+
* @param {string} key
|
|
3051
|
+
* @param {string} onDelete
|
|
3052
|
+
* @throws {AppwriteException}
|
|
3053
|
+
* @returns {Promise}
|
|
3054
|
+
*/
|
|
3055
|
+
updateRelationshipAttribute(databaseId, collectionId, key, onDelete) {
|
|
3056
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3057
|
+
if (typeof databaseId === 'undefined') {
|
|
3058
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3059
|
+
}
|
|
3060
|
+
if (typeof collectionId === 'undefined') {
|
|
3061
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
3062
|
+
}
|
|
3063
|
+
if (typeof key === 'undefined') {
|
|
3064
|
+
throw new AppwriteException('Missing required parameter: "key"');
|
|
3065
|
+
}
|
|
3066
|
+
let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
3067
|
+
let payload = {};
|
|
3068
|
+
if (typeof onDelete !== 'undefined') {
|
|
3069
|
+
payload['onDelete'] = onDelete;
|
|
3070
|
+
}
|
|
3071
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
3072
|
+
return yield this.client.call('patch', uri, {
|
|
3073
|
+
'content-type': 'application/json',
|
|
3074
|
+
}, payload);
|
|
3075
|
+
});
|
|
3076
|
+
}
|
|
2983
3077
|
/**
|
|
2984
3078
|
* List Documents
|
|
2985
3079
|
*
|
|
@@ -3067,10 +3161,11 @@ class Databases extends Service {
|
|
|
3067
3161
|
* @param {string} databaseId
|
|
3068
3162
|
* @param {string} collectionId
|
|
3069
3163
|
* @param {string} documentId
|
|
3164
|
+
* @param {string[]} queries
|
|
3070
3165
|
* @throws {AppwriteException}
|
|
3071
3166
|
* @returns {Promise}
|
|
3072
3167
|
*/
|
|
3073
|
-
getDocument(databaseId, collectionId, documentId) {
|
|
3168
|
+
getDocument(databaseId, collectionId, documentId, queries) {
|
|
3074
3169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3075
3170
|
if (typeof databaseId === 'undefined') {
|
|
3076
3171
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -3083,6 +3178,9 @@ class Databases extends Service {
|
|
|
3083
3178
|
}
|
|
3084
3179
|
let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
3085
3180
|
let payload = {};
|
|
3181
|
+
if (typeof queries !== 'undefined') {
|
|
3182
|
+
payload['queries'] = queries;
|
|
3183
|
+
}
|
|
3086
3184
|
const uri = new URL(this.client.config.endpoint + path);
|
|
3087
3185
|
return yield this.client.call('get', uri, {
|
|
3088
3186
|
'content-type': 'application/json',
|