Skip to content

Commit 2b38592

Browse files
feat: support for 0.14.x
1 parent 2040f64 commit 2b38592

File tree

11 files changed

+104
-61
lines changed

11 files changed

+104
-61
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite Deno SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-0.13.0-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-0.14.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**This SDK is compatible with Appwrite server version 0.13.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/releases).**
9+
**This SDK is compatible with Appwrite server version 0.14.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/releases).**
1010

1111
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Deno SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ client
1212
;
1313

1414

15-
let promise = account.delete();
15+
let promise = account.updateStatus();
1616

1717
promise.then(function (response) {
1818
console.log(response);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as sdk from "https://deno.land/x/appwrite/mod.ts";
33
// Init SDK
44
let client = new sdk.Client();
55

6-
let health = new sdk.Health(client);
6+
let users = new sdk.Users(client);
77

88
client
99
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
@@ -12,7 +12,7 @@ client
1212
;
1313

1414

15-
let promise = health.getQueueUsage();
15+
let promise = users.getMemberships('[USER_ID]');
1616

1717
promise.then(function (response) {
1818
console.log(response);

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class Client {
1111
endpoint: string = 'https://appwrite.io/v1';
1212
headers: Payload = {
1313
'content-type': '',
14-
'x-sdk-version': 'appwrite:deno:3.1.0',
14+
'x-sdk-version': 'appwrite:deno:4.0.0',
1515
'X-Appwrite-Response-Format':'0.13.0',
1616
};
1717

src/models.d.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,18 +1035,22 @@ export namespace Models {
10351035
* User ID.
10361036
*/
10371037
userId: string;
1038-
/**
1039-
* Team ID.
1040-
*/
1041-
teamId: string;
10421038
/**
10431039
* User name.
10441040
*/
1045-
name: string;
1041+
userName: string;
10461042
/**
10471043
* User email address.
10481044
*/
1049-
email: string;
1045+
userEmail: string;
1046+
/**
1047+
* Team ID.
1048+
*/
1049+
teamId: string;
1050+
/**
1051+
* Team name.
1052+
*/
1053+
teamName: string;
10501054
/**
10511055
* Date, the user has been invited to join the team in Unix timestamp.
10521056
*/
@@ -1240,9 +1244,9 @@ export namespace Models {
12401244
*/
12411245
statusCode: number;
12421246
/**
1243-
* The script stdout output string. Logs the last 4,000 characters of the execution stdout output.
1247+
* The script response output string. Logs the last 4,000 characters of the execution response output.
12441248
*/
1245-
stdout: string;
1249+
response: string;
12461250
/**
12471251
* The script stderr output string. Logs the last 4,000 characters of the execution stderr output
12481252
*/

src/services/account.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,6 @@ export class Account extends Service {
2929
'content-type': 'application/json',
3030
}, payload);
3131
}
32-
/**
33-
* Delete Account
34-
*
35-
* Delete a currently logged in user account. Behind the scene, the user
36-
* record is not deleted but permanently blocked from any access. This is done
37-
* to avoid deleted accounts being overtaken by new users with the same email
38-
* address. Any user-related resources like documents or storage files should
39-
* be deleted separately.
40-
*
41-
* @throws {AppwriteException}
42-
* @returns {Promise}
43-
*/
44-
async delete(): Promise<Response> {
45-
let path = '/account';
46-
let payload: Payload = {};
47-
48-
return await this.client.call('delete', path, {
49-
'content-type': 'application/json',
50-
}, payload);
51-
}
5232
/**
5333
* Update Account Email
5434
*
@@ -144,7 +124,7 @@ export class Account extends Service {
144124
*
145125
* Update currently logged in user password. For validation, user is required
146126
* to pass in the new password, and the old password. For users created with
147-
* OAuth and Team Invites, oldPassword is optional.
127+
* OAuth, Team Invites and Magic URL, oldPassword is optional.
148128
*
149129
* @param {string} password
150130
* @param {string} oldPassword
@@ -365,6 +345,10 @@ export class Account extends Service {
365345
/**
366346
* Update Session (Refresh Tokens)
367347
*
348+
* Access tokens have limited lifespan and expire to mitigate security risks.
349+
* If session was created using an OAuth provider, this route can be used to
350+
* "refresh" the access token.
351+
*
368352
* @param {string} sessionId
369353
* @throws {AppwriteException}
370354
* @returns {Promise}
@@ -405,6 +389,24 @@ export class Account extends Service {
405389
'content-type': 'application/json',
406390
}, payload);
407391
}
392+
/**
393+
* Update Account Status
394+
*
395+
* Block the currently logged in user account. Behind the scene, the user
396+
* record is not deleted but permanently blocked from any access. To
397+
* completely delete a user, use the Users API instead.
398+
*
399+
* @throws {AppwriteException}
400+
* @returns {Promise}
401+
*/
402+
async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
403+
let path = '/account/status';
404+
let payload: Payload = {};
405+
406+
return await this.client.call('patch', path, {
407+
'content-type': 'application/json',
408+
}, payload);
409+
}
408410
/**
409411
* Create Email Verification
410412
*

src/services/avatars.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ export class Avatars extends Service {
1717
* Get Browser Icon
1818
*
1919
* You can use this endpoint to show different browser icons to your users.
20-
* The code argument receives the browser code as it appears in your user
21-
* /account/sessions endpoint. Use width, height and quality arguments to
22-
* change the output settings.
20+
* The code argument receives the browser code as it appears in your user [GET
21+
* /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use
22+
* width, height and quality arguments to change the output settings.
23+
*
24+
* When one dimension is specified and the other is 0, the image is scaled
25+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
26+
* image at source quality. If dimensions are not specified, the default size
27+
* of image returned is 100x100px.
2328
*
2429
* @param {string} code
2530
* @param {number} width
@@ -58,6 +63,12 @@ export class Avatars extends Service {
5863
* The credit card endpoint will return you the icon of the credit card
5964
* provider you need. Use width, height and quality arguments to change the
6065
* output settings.
66+
*
67+
* When one dimension is specified and the other is 0, the image is scaled
68+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
69+
* image at source quality. If dimensions are not specified, the default size
70+
* of image returned is 100x100px.
71+
*
6172
*
6273
* @param {string} code
6374
* @param {number} width
@@ -123,6 +134,12 @@ export class Avatars extends Service {
123134
* You can use this endpoint to show different country flags icons to your
124135
* users. The code argument receives the 2 letter country code. Use width,
125136
* height and quality arguments to change the output settings.
137+
*
138+
* When one dimension is specified and the other is 0, the image is scaled
139+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
140+
* image at source quality. If dimensions are not specified, the default size
141+
* of image returned is 100x100px.
142+
*
126143
*
127144
* @param {string} code
128145
* @param {number} width
@@ -162,6 +179,12 @@ export class Avatars extends Service {
162179
* you want. This endpoint is very useful if you need to crop and display
163180
* remote images in your app or in case you want to make sure a 3rd party
164181
* image is properly served using a TLS protocol.
182+
*
183+
* When one dimension is specified and the other is 0, the image is scaled
184+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
185+
* image at source quality. If dimensions are not specified, the default size
186+
* of image returned is 400x400px.
187+
*
165188
*
166189
* @param {string} url
167190
* @param {number} width
@@ -206,6 +229,12 @@ export class Avatars extends Service {
206229
* default, a random theme will be selected. The random theme will persist for
207230
* the user's initials when reloading the same theme will always return for
208231
* the same initials.
232+
*
233+
* When one dimension is specified and the other is 0, the image is scaled
234+
* with preserved aspect ratio. If both dimensions are 0, the API provides an
235+
* image at source quality. If dimensions are not specified, the default size
236+
* of image returned is 100x100px.
237+
*
209238
*
210239
* @param {string} name
211240
* @param {number} width
@@ -248,6 +277,7 @@ export class Avatars extends Service {
248277
*
249278
* Converts a given plain text to a QR code image. You can use the query
250279
* parameters to change the size and style of the resulting image.
280+
*
251281
*
252282
* @param {string} text
253283
* @param {number} size

src/services/database.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,7 @@ export class Database extends Service {
857857
/**
858858
* Delete Document
859859
*
860-
* Delete a document by its unique ID. This endpoint deletes only the parent
861-
* documents, its attributes and relations to other documents. Child documents
862-
* **will not** be deleted.
860+
* Delete a document by its unique ID.
863861
*
864862
* @param {string} collectionId
865863
* @param {string} documentId

src/services/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class Functions extends Service {
127127
}, payload);
128128
}
129129
/**
130-
* List the currently active function runtimes.
130+
* List runtimes
131131
*
132132
* Get a list of all runtimes that are currently active on your instance.
133133
*

src/services/health.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,6 @@ export class Health extends Service {
127127
'content-type': 'application/json',
128128
}, payload);
129129
}
130-
/**
131-
* Get Usage Queue
132-
*
133-
* Get the number of usage stats that are waiting to be processed in the
134-
* Appwrite internal queue server.
135-
*
136-
* @throws {AppwriteException}
137-
* @returns {Promise}
138-
*/
139-
async getQueueUsage(): Promise<Models.HealthQueue> {
140-
let path = '/health/queue/usage';
141-
let payload: Payload = {};
142-
143-
return await this.client.call('get', path, {
144-
'content-type': 'application/json',
145-
}, payload);
146-
}
147130
/**
148131
* Get Webhooks Queue
149132
*

0 commit comments

Comments
 (0)