Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Jan 10, 2024
1 parent 08f34b6 commit c544752
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
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:

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.3"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.4"></script>
```


Expand Down
18 changes: 18 additions & 0 deletions docs/examples/account/delete-authenticator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Client, Account } from "@appwrite.io/console";

const client = new Client();

const account = new Account(client);

client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;

const promise = account.deleteAuthenticator('totp', '[OTP]');

promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@appwrite.io/console",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "0.6.0-rc.3",
"version": "0.6.0-rc.4",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '0.6.0-rc.3',
'x-sdk-version': '0.6.0-rc.4',
'X-Appwrite-Response-Format': '1.4.0',
};

Expand Down
31 changes: 31 additions & 0 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,37 @@ export class Account extends Service {
}, payload);
}

/**
* Delete Authenticator
*
*
* @param {string} provider
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteAuthenticator<Preferences extends Models.Preferences>(provider: string, otp: string): Promise<Models.User<Preferences>> {
if (typeof provider === 'undefined') {
throw new AppwriteException('Missing required parameter: "provider"');
}

if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}

const apiPath = '/account/mfa/{provider}'.replace('{provider}', provider);
const payload: Payload = {};

if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}

const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('delete', uri, {
'content-type': 'application/json',
}, payload);
}

/**
* Update name
*
Expand Down

0 comments on commit c544752

Please sign in to comment.