From 33e64a25e39c55df1e60c95dbb113b380dbac934 Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Wed, 13 Sep 2023 04:07:19 +0530 Subject: [PATCH 1/7] jwt expiration update method for projects class created --- src/client.ts | 2 +- src/services/projects.ts | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index 7205a47c..2b7d642a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -4,7 +4,7 @@ import { Models } from './models'; import { Service } from './service'; type Payload = { - [key: string]: any; + [key: string]: unknown; } type Headers = { diff --git a/src/services/projects.ts b/src/services/projects.ts index c2ba0bac..876236b3 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -5,10 +5,10 @@ import type { UploadProgress, Payload } from '../client'; export class Projects extends Service { - constructor(client: Client) - { + constructor(client: Client) + { super(client); - } + } /** * List Projects @@ -282,6 +282,37 @@ export class Projects extends Service { }, payload); } + /** + * Update Project JWT Expiration Duration + * + * + * @param {string} projectId + * @param {number} jwtExpiration + * @throws {AppwriteException} + * @returns {Promise} + */ + async updateJwtExpiration(projectId: string, jwtExpiration: number): Promise { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + if (typeof jwtExpiration === 'undefined') { + throw new AppwriteException('Missing required parameter: "jwtExpiration"'); + } + + const path = `/projects/${projectId}/auth/jwt-expiration`; + const payload: Payload = {}; + + if (typeof jwtExpiration !== 'undefined') { + payload['jwtExpiration'] = jwtExpiration; + } + + const uri = new URL(this.client.config.endpoint + path); + return await this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + } + /** * Update Project users limit * From de25284b46e4138594d831756033db6c465ac071 Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Wed, 13 Sep 2023 19:28:37 +0530 Subject: [PATCH 2/7] linting --- src/services/project.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/project.ts b/src/services/project.ts index c295d267..88bbe8bb 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -5,10 +5,10 @@ import type { UploadProgress, Payload } from '../client'; export class Project extends Service { - constructor(client: Client) - { + constructor(client: Client) + { super(client); - } + } /** * Get usage stats for a project From d677cfb01c0ec4e5934a621de5e6637bc27616e2 Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Wed, 13 Sep 2023 19:31:29 +0530 Subject: [PATCH 3/7] linting restored --- src/services/project.ts | 4 ++-- src/services/projects.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/project.ts b/src/services/project.ts index 88bbe8bb..980221ce 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -6,9 +6,9 @@ import type { UploadProgress, Payload } from '../client'; export class Project extends Service { constructor(client: Client) - { + { super(client); - } + } /** * Get usage stats for a project diff --git a/src/services/projects.ts b/src/services/projects.ts index 876236b3..e08c227b 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -6,9 +6,9 @@ import type { UploadProgress, Payload } from '../client'; export class Projects extends Service { constructor(client: Client) - { + { super(client); - } + } /** * List Projects From 24727c774e07937081baf2510dffb1eae12db6cc Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Wed, 13 Sep 2023 19:32:15 +0530 Subject: [PATCH 4/7] linting restored --- src/services/project.ts | 2 +- src/services/projects.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/project.ts b/src/services/project.ts index 980221ce..c295d267 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -5,7 +5,7 @@ import type { UploadProgress, Payload } from '../client'; export class Project extends Service { - constructor(client: Client) + constructor(client: Client) { super(client); } diff --git a/src/services/projects.ts b/src/services/projects.ts index e08c227b..cfb6e772 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -5,7 +5,7 @@ import type { UploadProgress, Payload } from '../client'; export class Projects extends Service { - constructor(client: Client) + constructor(client: Client) { super(client); } From f263aeaf32bec9b01ffdc985f1b777939b5fff39 Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Wed, 13 Sep 2023 19:32:49 +0530 Subject: [PATCH 5/7] linting restored --- src/services/projects.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/projects.ts b/src/services/projects.ts index cfb6e772..77d55064 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -5,7 +5,7 @@ import type { UploadProgress, Payload } from '../client'; export class Projects extends Service { - constructor(client: Client) + constructor(client: Client) { super(client); } From bc7ee570d1b2b510486eceddbcfd947708312450 Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Thu, 14 Sep 2023 19:12:23 +0530 Subject: [PATCH 6/7] added jwtExpiration to Project Model --- src/models.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/models.ts b/src/models.ts index 732fe073..bdaa2379 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2146,6 +2146,10 @@ export namespace Models { * Session duration in seconds. */ authDuration: number; + /** + * JWT expiration duration in seconds. + */ + jwtExpiration: number; /** * Max users allowed. 0 is unlimited. */ From f877a841f3c2d508f6ba0efd68f7603b9a2b87ae Mon Sep 17 00:00:00 2001 From: MukeshSingh Date: Thu, 14 Sep 2023 20:06:04 +0530 Subject: [PATCH 7/7] type reverted --- src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index 2b7d642a..7205a47c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -4,7 +4,7 @@ import { Models } from './models'; import { Service } from './service'; type Payload = { - [key: string]: unknown; + [key: string]: any; } type Headers = {