Skip to content
4 changes: 4 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
31 changes: 31 additions & 0 deletions src/services/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Models.Project> {
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
*
Expand Down