node-appwrite 15.0.0 → 15.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/dist/client.js +7 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +7 -4
- package/dist/client.mjs.map +1 -1
- package/dist/models.d.mts +2 -2
- package/dist/models.d.ts +2 -2
- package/dist/services/account.d.mts +0 -86
- package/dist/services/account.d.ts +0 -86
- package/dist/services/account.js +86 -172
- package/dist/services/account.js.map +1 -1
- package/dist/services/account.mjs +86 -172
- package/dist/services/account.mjs.map +1 -1
- package/dist/services/avatars.d.mts +0 -14
- package/dist/services/avatars.d.ts +0 -14
- package/dist/services/avatars.js +14 -28
- package/dist/services/avatars.js.map +1 -1
- package/dist/services/avatars.mjs +14 -28
- package/dist/services/avatars.mjs.map +1 -1
- package/dist/services/databases.d.mts +0 -84
- package/dist/services/databases.d.ts +0 -84
- package/dist/services/databases.js +84 -168
- package/dist/services/databases.js.map +1 -1
- package/dist/services/databases.mjs +84 -168
- package/dist/services/databases.mjs.map +1 -1
- package/dist/services/functions.d.mts +0 -48
- package/dist/services/functions.d.ts +0 -48
- package/dist/services/functions.js +48 -96
- package/dist/services/functions.js.map +1 -1
- package/dist/services/functions.mjs +48 -96
- package/dist/services/functions.mjs.map +1 -1
- package/dist/services/graphql.d.mts +0 -4
- package/dist/services/graphql.d.ts +0 -4
- package/dist/services/graphql.js +4 -8
- package/dist/services/graphql.js.map +1 -1
- package/dist/services/graphql.mjs +4 -8
- package/dist/services/graphql.mjs.map +1 -1
- package/dist/services/health.d.mts +0 -46
- package/dist/services/health.d.ts +0 -46
- package/dist/services/health.js +46 -92
- package/dist/services/health.js.map +1 -1
- package/dist/services/health.mjs +46 -92
- package/dist/services/health.mjs.map +1 -1
- package/dist/services/locale.d.mts +0 -16
- package/dist/services/locale.d.ts +0 -16
- package/dist/services/locale.js +16 -32
- package/dist/services/locale.js.map +1 -1
- package/dist/services/locale.mjs +16 -32
- package/dist/services/locale.mjs.map +1 -1
- package/dist/services/messaging.d.mts +3 -95
- package/dist/services/messaging.d.ts +3 -95
- package/dist/services/messaging.js +95 -187
- package/dist/services/messaging.js.map +1 -1
- package/dist/services/messaging.mjs +95 -187
- package/dist/services/messaging.mjs.map +1 -1
- package/dist/services/storage.d.mts +0 -26
- package/dist/services/storage.d.ts +0 -26
- package/dist/services/storage.js +26 -52
- package/dist/services/storage.js.map +1 -1
- package/dist/services/storage.mjs +26 -52
- package/dist/services/storage.mjs.map +1 -1
- package/dist/services/teams.d.mts +0 -26
- package/dist/services/teams.d.ts +0 -26
- package/dist/services/teams.js +26 -52
- package/dist/services/teams.js.map +1 -1
- package/dist/services/teams.mjs +26 -52
- package/dist/services/teams.mjs.map +1 -1
- package/dist/services/users.d.mts +0 -84
- package/dist/services/users.d.ts +0 -84
- package/dist/services/users.js +84 -168
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +84 -168
- package/dist/services/users.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -9,8 +9,6 @@ declare class Storage {
|
|
|
9
9
|
client: Client;
|
|
10
10
|
constructor(client: Client);
|
|
11
11
|
/**
|
|
12
|
-
* List buckets
|
|
13
|
-
*
|
|
14
12
|
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
15
13
|
*
|
|
16
14
|
* @param {string[]} queries
|
|
@@ -20,8 +18,6 @@ declare class Storage {
|
|
|
20
18
|
*/
|
|
21
19
|
listBuckets(queries?: string[], search?: string): Promise<Models.BucketList>;
|
|
22
20
|
/**
|
|
23
|
-
* Create bucket
|
|
24
|
-
*
|
|
25
21
|
* Create a new storage bucket.
|
|
26
22
|
*
|
|
27
23
|
* @param {string} bucketId
|
|
@@ -39,8 +35,6 @@ declare class Storage {
|
|
|
39
35
|
*/
|
|
40
36
|
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
|
|
41
37
|
/**
|
|
42
|
-
* Get bucket
|
|
43
|
-
*
|
|
44
38
|
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
45
39
|
*
|
|
46
40
|
* @param {string} bucketId
|
|
@@ -49,8 +43,6 @@ declare class Storage {
|
|
|
49
43
|
*/
|
|
50
44
|
getBucket(bucketId: string): Promise<Models.Bucket>;
|
|
51
45
|
/**
|
|
52
|
-
* Update bucket
|
|
53
|
-
*
|
|
54
46
|
* Update a storage bucket by its unique ID.
|
|
55
47
|
*
|
|
56
48
|
* @param {string} bucketId
|
|
@@ -68,8 +60,6 @@ declare class Storage {
|
|
|
68
60
|
*/
|
|
69
61
|
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
|
|
70
62
|
/**
|
|
71
|
-
* Delete bucket
|
|
72
|
-
*
|
|
73
63
|
* Delete a storage bucket by its unique ID.
|
|
74
64
|
*
|
|
75
65
|
* @param {string} bucketId
|
|
@@ -78,8 +68,6 @@ declare class Storage {
|
|
|
78
68
|
*/
|
|
79
69
|
deleteBucket(bucketId: string): Promise<{}>;
|
|
80
70
|
/**
|
|
81
|
-
* List files
|
|
82
|
-
*
|
|
83
71
|
* Get a list of all the user files. You can use the query params to filter your results.
|
|
84
72
|
*
|
|
85
73
|
* @param {string} bucketId
|
|
@@ -90,8 +78,6 @@ declare class Storage {
|
|
|
90
78
|
*/
|
|
91
79
|
listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
|
|
92
80
|
/**
|
|
93
|
-
* Create file
|
|
94
|
-
*
|
|
95
81
|
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
|
|
96
82
|
|
|
97
83
|
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
@@ -110,8 +96,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
110
96
|
*/
|
|
111
97
|
createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
|
|
112
98
|
/**
|
|
113
|
-
* Get file
|
|
114
|
-
*
|
|
115
99
|
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
116
100
|
*
|
|
117
101
|
* @param {string} bucketId
|
|
@@ -121,8 +105,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
121
105
|
*/
|
|
122
106
|
getFile(bucketId: string, fileId: string): Promise<Models.File>;
|
|
123
107
|
/**
|
|
124
|
-
* Update file
|
|
125
|
-
*
|
|
126
108
|
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
127
109
|
*
|
|
128
110
|
* @param {string} bucketId
|
|
@@ -134,8 +116,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
134
116
|
*/
|
|
135
117
|
updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
|
|
136
118
|
/**
|
|
137
|
-
* Delete file
|
|
138
|
-
*
|
|
139
119
|
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
140
120
|
*
|
|
141
121
|
* @param {string} bucketId
|
|
@@ -145,8 +125,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
145
125
|
*/
|
|
146
126
|
deleteFile(bucketId: string, fileId: string): Promise<{}>;
|
|
147
127
|
/**
|
|
148
|
-
* Get file for download
|
|
149
|
-
*
|
|
150
128
|
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
151
129
|
*
|
|
152
130
|
* @param {string} bucketId
|
|
@@ -156,8 +134,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
156
134
|
*/
|
|
157
135
|
getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer>;
|
|
158
136
|
/**
|
|
159
|
-
* Get file preview
|
|
160
|
-
*
|
|
161
137
|
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
162
138
|
*
|
|
163
139
|
* @param {string} bucketId
|
|
@@ -178,8 +154,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
178
154
|
*/
|
|
179
155
|
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise<ArrayBuffer>;
|
|
180
156
|
/**
|
|
181
|
-
* Get file for view
|
|
182
|
-
*
|
|
183
157
|
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
184
158
|
*
|
|
185
159
|
* @param {string} bucketId
|
|
@@ -9,8 +9,6 @@ declare class Storage {
|
|
|
9
9
|
client: Client;
|
|
10
10
|
constructor(client: Client);
|
|
11
11
|
/**
|
|
12
|
-
* List buckets
|
|
13
|
-
*
|
|
14
12
|
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
15
13
|
*
|
|
16
14
|
* @param {string[]} queries
|
|
@@ -20,8 +18,6 @@ declare class Storage {
|
|
|
20
18
|
*/
|
|
21
19
|
listBuckets(queries?: string[], search?: string): Promise<Models.BucketList>;
|
|
22
20
|
/**
|
|
23
|
-
* Create bucket
|
|
24
|
-
*
|
|
25
21
|
* Create a new storage bucket.
|
|
26
22
|
*
|
|
27
23
|
* @param {string} bucketId
|
|
@@ -39,8 +35,6 @@ declare class Storage {
|
|
|
39
35
|
*/
|
|
40
36
|
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
|
|
41
37
|
/**
|
|
42
|
-
* Get bucket
|
|
43
|
-
*
|
|
44
38
|
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
45
39
|
*
|
|
46
40
|
* @param {string} bucketId
|
|
@@ -49,8 +43,6 @@ declare class Storage {
|
|
|
49
43
|
*/
|
|
50
44
|
getBucket(bucketId: string): Promise<Models.Bucket>;
|
|
51
45
|
/**
|
|
52
|
-
* Update bucket
|
|
53
|
-
*
|
|
54
46
|
* Update a storage bucket by its unique ID.
|
|
55
47
|
*
|
|
56
48
|
* @param {string} bucketId
|
|
@@ -68,8 +60,6 @@ declare class Storage {
|
|
|
68
60
|
*/
|
|
69
61
|
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
|
|
70
62
|
/**
|
|
71
|
-
* Delete bucket
|
|
72
|
-
*
|
|
73
63
|
* Delete a storage bucket by its unique ID.
|
|
74
64
|
*
|
|
75
65
|
* @param {string} bucketId
|
|
@@ -78,8 +68,6 @@ declare class Storage {
|
|
|
78
68
|
*/
|
|
79
69
|
deleteBucket(bucketId: string): Promise<{}>;
|
|
80
70
|
/**
|
|
81
|
-
* List files
|
|
82
|
-
*
|
|
83
71
|
* Get a list of all the user files. You can use the query params to filter your results.
|
|
84
72
|
*
|
|
85
73
|
* @param {string} bucketId
|
|
@@ -90,8 +78,6 @@ declare class Storage {
|
|
|
90
78
|
*/
|
|
91
79
|
listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
|
|
92
80
|
/**
|
|
93
|
-
* Create file
|
|
94
|
-
*
|
|
95
81
|
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
|
|
96
82
|
|
|
97
83
|
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
@@ -110,8 +96,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
110
96
|
*/
|
|
111
97
|
createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
|
|
112
98
|
/**
|
|
113
|
-
* Get file
|
|
114
|
-
*
|
|
115
99
|
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
116
100
|
*
|
|
117
101
|
* @param {string} bucketId
|
|
@@ -121,8 +105,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
121
105
|
*/
|
|
122
106
|
getFile(bucketId: string, fileId: string): Promise<Models.File>;
|
|
123
107
|
/**
|
|
124
|
-
* Update file
|
|
125
|
-
*
|
|
126
108
|
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
127
109
|
*
|
|
128
110
|
* @param {string} bucketId
|
|
@@ -134,8 +116,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
134
116
|
*/
|
|
135
117
|
updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
|
|
136
118
|
/**
|
|
137
|
-
* Delete file
|
|
138
|
-
*
|
|
139
119
|
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
140
120
|
*
|
|
141
121
|
* @param {string} bucketId
|
|
@@ -145,8 +125,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
145
125
|
*/
|
|
146
126
|
deleteFile(bucketId: string, fileId: string): Promise<{}>;
|
|
147
127
|
/**
|
|
148
|
-
* Get file for download
|
|
149
|
-
*
|
|
150
128
|
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
151
129
|
*
|
|
152
130
|
* @param {string} bucketId
|
|
@@ -156,8 +134,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
156
134
|
*/
|
|
157
135
|
getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer>;
|
|
158
136
|
/**
|
|
159
|
-
* Get file preview
|
|
160
|
-
*
|
|
161
137
|
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
162
138
|
*
|
|
163
139
|
* @param {string} bucketId
|
|
@@ -178,8 +154,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk
|
|
|
178
154
|
*/
|
|
179
155
|
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise<ArrayBuffer>;
|
|
180
156
|
/**
|
|
181
|
-
* Get file for view
|
|
182
|
-
*
|
|
183
157
|
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
184
158
|
*
|
|
185
159
|
* @param {string} bucketId
|
package/dist/services/storage.js
CHANGED
|
@@ -7,8 +7,6 @@ class Storage {
|
|
|
7
7
|
this.client = client;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* List buckets
|
|
11
|
-
*
|
|
12
10
|
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
13
11
|
*
|
|
14
12
|
* @param {string[]} queries
|
|
@@ -16,7 +14,7 @@ class Storage {
|
|
|
16
14
|
* @throws {AppwriteException}
|
|
17
15
|
* @returns {Promise<Models.BucketList>}
|
|
18
16
|
*/
|
|
19
|
-
|
|
17
|
+
listBuckets(queries, search) {
|
|
20
18
|
const apiPath = "/storage/buckets";
|
|
21
19
|
const payload = {};
|
|
22
20
|
if (typeof queries !== "undefined") {
|
|
@@ -29,7 +27,7 @@ class Storage {
|
|
|
29
27
|
const apiHeaders = {
|
|
30
28
|
"content-type": "application/json"
|
|
31
29
|
};
|
|
32
|
-
return
|
|
30
|
+
return this.client.call(
|
|
33
31
|
"get",
|
|
34
32
|
uri,
|
|
35
33
|
apiHeaders,
|
|
@@ -37,8 +35,6 @@ class Storage {
|
|
|
37
35
|
);
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
|
-
* Create bucket
|
|
41
|
-
*
|
|
42
38
|
* Create a new storage bucket.
|
|
43
39
|
*
|
|
44
40
|
* @param {string} bucketId
|
|
@@ -54,7 +50,7 @@ class Storage {
|
|
|
54
50
|
* @throws {AppwriteException}
|
|
55
51
|
* @returns {Promise<Models.Bucket>}
|
|
56
52
|
*/
|
|
57
|
-
|
|
53
|
+
createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
|
|
58
54
|
if (typeof bucketId === "undefined") {
|
|
59
55
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
60
56
|
}
|
|
@@ -97,7 +93,7 @@ class Storage {
|
|
|
97
93
|
const apiHeaders = {
|
|
98
94
|
"content-type": "application/json"
|
|
99
95
|
};
|
|
100
|
-
return
|
|
96
|
+
return this.client.call(
|
|
101
97
|
"post",
|
|
102
98
|
uri,
|
|
103
99
|
apiHeaders,
|
|
@@ -105,15 +101,13 @@ class Storage {
|
|
|
105
101
|
);
|
|
106
102
|
}
|
|
107
103
|
/**
|
|
108
|
-
* Get bucket
|
|
109
|
-
*
|
|
110
104
|
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
111
105
|
*
|
|
112
106
|
* @param {string} bucketId
|
|
113
107
|
* @throws {AppwriteException}
|
|
114
108
|
* @returns {Promise<Models.Bucket>}
|
|
115
109
|
*/
|
|
116
|
-
|
|
110
|
+
getBucket(bucketId) {
|
|
117
111
|
if (typeof bucketId === "undefined") {
|
|
118
112
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
119
113
|
}
|
|
@@ -123,7 +117,7 @@ class Storage {
|
|
|
123
117
|
const apiHeaders = {
|
|
124
118
|
"content-type": "application/json"
|
|
125
119
|
};
|
|
126
|
-
return
|
|
120
|
+
return this.client.call(
|
|
127
121
|
"get",
|
|
128
122
|
uri,
|
|
129
123
|
apiHeaders,
|
|
@@ -131,8 +125,6 @@ class Storage {
|
|
|
131
125
|
);
|
|
132
126
|
}
|
|
133
127
|
/**
|
|
134
|
-
* Update bucket
|
|
135
|
-
*
|
|
136
128
|
* Update a storage bucket by its unique ID.
|
|
137
129
|
*
|
|
138
130
|
* @param {string} bucketId
|
|
@@ -148,7 +140,7 @@ class Storage {
|
|
|
148
140
|
* @throws {AppwriteException}
|
|
149
141
|
* @returns {Promise<Models.Bucket>}
|
|
150
142
|
*/
|
|
151
|
-
|
|
143
|
+
updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
|
|
152
144
|
if (typeof bucketId === "undefined") {
|
|
153
145
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
154
146
|
}
|
|
@@ -188,7 +180,7 @@ class Storage {
|
|
|
188
180
|
const apiHeaders = {
|
|
189
181
|
"content-type": "application/json"
|
|
190
182
|
};
|
|
191
|
-
return
|
|
183
|
+
return this.client.call(
|
|
192
184
|
"put",
|
|
193
185
|
uri,
|
|
194
186
|
apiHeaders,
|
|
@@ -196,15 +188,13 @@ class Storage {
|
|
|
196
188
|
);
|
|
197
189
|
}
|
|
198
190
|
/**
|
|
199
|
-
* Delete bucket
|
|
200
|
-
*
|
|
201
191
|
* Delete a storage bucket by its unique ID.
|
|
202
192
|
*
|
|
203
193
|
* @param {string} bucketId
|
|
204
194
|
* @throws {AppwriteException}
|
|
205
195
|
* @returns {Promise<{}>}
|
|
206
196
|
*/
|
|
207
|
-
|
|
197
|
+
deleteBucket(bucketId) {
|
|
208
198
|
if (typeof bucketId === "undefined") {
|
|
209
199
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
210
200
|
}
|
|
@@ -214,7 +204,7 @@ class Storage {
|
|
|
214
204
|
const apiHeaders = {
|
|
215
205
|
"content-type": "application/json"
|
|
216
206
|
};
|
|
217
|
-
return
|
|
207
|
+
return this.client.call(
|
|
218
208
|
"delete",
|
|
219
209
|
uri,
|
|
220
210
|
apiHeaders,
|
|
@@ -222,8 +212,6 @@ class Storage {
|
|
|
222
212
|
);
|
|
223
213
|
}
|
|
224
214
|
/**
|
|
225
|
-
* List files
|
|
226
|
-
*
|
|
227
215
|
* Get a list of all the user files. You can use the query params to filter your results.
|
|
228
216
|
*
|
|
229
217
|
* @param {string} bucketId
|
|
@@ -232,7 +220,7 @@ class Storage {
|
|
|
232
220
|
* @throws {AppwriteException}
|
|
233
221
|
* @returns {Promise<Models.FileList>}
|
|
234
222
|
*/
|
|
235
|
-
|
|
223
|
+
listFiles(bucketId, queries, search) {
|
|
236
224
|
if (typeof bucketId === "undefined") {
|
|
237
225
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
238
226
|
}
|
|
@@ -248,7 +236,7 @@ class Storage {
|
|
|
248
236
|
const apiHeaders = {
|
|
249
237
|
"content-type": "application/json"
|
|
250
238
|
};
|
|
251
|
-
return
|
|
239
|
+
return this.client.call(
|
|
252
240
|
"get",
|
|
253
241
|
uri,
|
|
254
242
|
apiHeaders,
|
|
@@ -256,8 +244,6 @@ class Storage {
|
|
|
256
244
|
);
|
|
257
245
|
}
|
|
258
246
|
/**
|
|
259
|
-
* Create file
|
|
260
|
-
*
|
|
261
247
|
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
|
|
262
248
|
|
|
263
249
|
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
@@ -274,7 +260,7 @@ class Storage {
|
|
|
274
260
|
* @throws {AppwriteException}
|
|
275
261
|
* @returns {Promise<Models.File>}
|
|
276
262
|
*/
|
|
277
|
-
|
|
263
|
+
createFile(bucketId, fileId, file, permissions, onProgress = (progress) => {
|
|
278
264
|
}) {
|
|
279
265
|
if (typeof bucketId === "undefined") {
|
|
280
266
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
@@ -300,7 +286,7 @@ class Storage {
|
|
|
300
286
|
const apiHeaders = {
|
|
301
287
|
"content-type": "multipart/form-data"
|
|
302
288
|
};
|
|
303
|
-
return
|
|
289
|
+
return this.client.chunkedUpload(
|
|
304
290
|
"post",
|
|
305
291
|
uri,
|
|
306
292
|
apiHeaders,
|
|
@@ -309,8 +295,6 @@ class Storage {
|
|
|
309
295
|
);
|
|
310
296
|
}
|
|
311
297
|
/**
|
|
312
|
-
* Get file
|
|
313
|
-
*
|
|
314
298
|
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
315
299
|
*
|
|
316
300
|
* @param {string} bucketId
|
|
@@ -318,7 +302,7 @@ class Storage {
|
|
|
318
302
|
* @throws {AppwriteException}
|
|
319
303
|
* @returns {Promise<Models.File>}
|
|
320
304
|
*/
|
|
321
|
-
|
|
305
|
+
getFile(bucketId, fileId) {
|
|
322
306
|
if (typeof bucketId === "undefined") {
|
|
323
307
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
324
308
|
}
|
|
@@ -331,7 +315,7 @@ class Storage {
|
|
|
331
315
|
const apiHeaders = {
|
|
332
316
|
"content-type": "application/json"
|
|
333
317
|
};
|
|
334
|
-
return
|
|
318
|
+
return this.client.call(
|
|
335
319
|
"get",
|
|
336
320
|
uri,
|
|
337
321
|
apiHeaders,
|
|
@@ -339,8 +323,6 @@ class Storage {
|
|
|
339
323
|
);
|
|
340
324
|
}
|
|
341
325
|
/**
|
|
342
|
-
* Update file
|
|
343
|
-
*
|
|
344
326
|
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
345
327
|
*
|
|
346
328
|
* @param {string} bucketId
|
|
@@ -350,7 +332,7 @@ class Storage {
|
|
|
350
332
|
* @throws {AppwriteException}
|
|
351
333
|
* @returns {Promise<Models.File>}
|
|
352
334
|
*/
|
|
353
|
-
|
|
335
|
+
updateFile(bucketId, fileId, name, permissions) {
|
|
354
336
|
if (typeof bucketId === "undefined") {
|
|
355
337
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
356
338
|
}
|
|
@@ -369,7 +351,7 @@ class Storage {
|
|
|
369
351
|
const apiHeaders = {
|
|
370
352
|
"content-type": "application/json"
|
|
371
353
|
};
|
|
372
|
-
return
|
|
354
|
+
return this.client.call(
|
|
373
355
|
"put",
|
|
374
356
|
uri,
|
|
375
357
|
apiHeaders,
|
|
@@ -377,8 +359,6 @@ class Storage {
|
|
|
377
359
|
);
|
|
378
360
|
}
|
|
379
361
|
/**
|
|
380
|
-
* Delete file
|
|
381
|
-
*
|
|
382
362
|
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
383
363
|
*
|
|
384
364
|
* @param {string} bucketId
|
|
@@ -386,7 +366,7 @@ class Storage {
|
|
|
386
366
|
* @throws {AppwriteException}
|
|
387
367
|
* @returns {Promise<{}>}
|
|
388
368
|
*/
|
|
389
|
-
|
|
369
|
+
deleteFile(bucketId, fileId) {
|
|
390
370
|
if (typeof bucketId === "undefined") {
|
|
391
371
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
392
372
|
}
|
|
@@ -399,7 +379,7 @@ class Storage {
|
|
|
399
379
|
const apiHeaders = {
|
|
400
380
|
"content-type": "application/json"
|
|
401
381
|
};
|
|
402
|
-
return
|
|
382
|
+
return this.client.call(
|
|
403
383
|
"delete",
|
|
404
384
|
uri,
|
|
405
385
|
apiHeaders,
|
|
@@ -407,8 +387,6 @@ class Storage {
|
|
|
407
387
|
);
|
|
408
388
|
}
|
|
409
389
|
/**
|
|
410
|
-
* Get file for download
|
|
411
|
-
*
|
|
412
390
|
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
413
391
|
*
|
|
414
392
|
* @param {string} bucketId
|
|
@@ -416,7 +394,7 @@ class Storage {
|
|
|
416
394
|
* @throws {AppwriteException}
|
|
417
395
|
* @returns {Promise<ArrayBuffer>}
|
|
418
396
|
*/
|
|
419
|
-
|
|
397
|
+
getFileDownload(bucketId, fileId) {
|
|
420
398
|
if (typeof bucketId === "undefined") {
|
|
421
399
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
422
400
|
}
|
|
@@ -429,7 +407,7 @@ class Storage {
|
|
|
429
407
|
const apiHeaders = {
|
|
430
408
|
"content-type": "application/json"
|
|
431
409
|
};
|
|
432
|
-
return
|
|
410
|
+
return this.client.call(
|
|
433
411
|
"get",
|
|
434
412
|
uri,
|
|
435
413
|
apiHeaders,
|
|
@@ -438,8 +416,6 @@ class Storage {
|
|
|
438
416
|
);
|
|
439
417
|
}
|
|
440
418
|
/**
|
|
441
|
-
* Get file preview
|
|
442
|
-
*
|
|
443
419
|
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
444
420
|
*
|
|
445
421
|
* @param {string} bucketId
|
|
@@ -458,7 +434,7 @@ class Storage {
|
|
|
458
434
|
* @throws {AppwriteException}
|
|
459
435
|
* @returns {Promise<ArrayBuffer>}
|
|
460
436
|
*/
|
|
461
|
-
|
|
437
|
+
getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
|
|
462
438
|
if (typeof bucketId === "undefined") {
|
|
463
439
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
464
440
|
}
|
|
@@ -504,7 +480,7 @@ class Storage {
|
|
|
504
480
|
const apiHeaders = {
|
|
505
481
|
"content-type": "application/json"
|
|
506
482
|
};
|
|
507
|
-
return
|
|
483
|
+
return this.client.call(
|
|
508
484
|
"get",
|
|
509
485
|
uri,
|
|
510
486
|
apiHeaders,
|
|
@@ -513,8 +489,6 @@ class Storage {
|
|
|
513
489
|
);
|
|
514
490
|
}
|
|
515
491
|
/**
|
|
516
|
-
* Get file for view
|
|
517
|
-
*
|
|
518
492
|
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
519
493
|
*
|
|
520
494
|
* @param {string} bucketId
|
|
@@ -522,7 +496,7 @@ class Storage {
|
|
|
522
496
|
* @throws {AppwriteException}
|
|
523
497
|
* @returns {Promise<ArrayBuffer>}
|
|
524
498
|
*/
|
|
525
|
-
|
|
499
|
+
getFileView(bucketId, fileId) {
|
|
526
500
|
if (typeof bucketId === "undefined") {
|
|
527
501
|
throw new client.AppwriteException('Missing required parameter: "bucketId"');
|
|
528
502
|
}
|
|
@@ -535,7 +509,7 @@ class Storage {
|
|
|
535
509
|
const apiHeaders = {
|
|
536
510
|
"content-type": "application/json"
|
|
537
511
|
};
|
|
538
|
-
return
|
|
512
|
+
return this.client.call(
|
|
539
513
|
"get",
|
|
540
514
|
uri,
|
|
541
515
|
apiHeaders,
|