Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Mar 4, 2024
1 parent 626c965 commit 600da47
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Account, } from "@appwrite.io/console";
import { Client, Account, AuthenticatorType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -7,7 +7,7 @@ const client = new Client()
const account = new Account(client);

const result = await account.createMfaAuthenticator(
.Totp // type
AuthenticatorType.Totp // type
);

console.log(response);
4 changes: 2 additions & 2 deletions docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Account, } from "@appwrite.io/console";
import { Client, Account, AuthenticationFactor } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -7,7 +7,7 @@ const client = new Client()
const account = new Account(client);

const result = await account.createMfaChallenge(
.Email // factor
AuthenticationFactor.Email // factor
);

console.log(response);
4 changes: 2 additions & 2 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Account, } from "@appwrite.io/console";
import { Client, Account, AuthenticatorType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -7,7 +7,7 @@ const client = new Client()
const account = new Account(client);

const result = await account.deleteMfaAuthenticator(
.Totp, // type
AuthenticatorType.Totp, // type
'<OTP>' // otp
);

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

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -7,7 +7,7 @@ const client = new Client()
const account = new Account(client);

const result = await account.updateMfaAuthenticator(
.Totp, // type
AuthenticatorType.Totp, // type
'<OTP>' // otp
);

Expand Down
2 changes: 1 addition & 1 deletion src/enums/factor.ts → src/enums/authentication-factor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Factor {
export enum AuthenticationFactor {
Email = 'email',
Phone = 'phone',
Totp = 'totp',
Expand Down
3 changes: 3 additions & 0 deletions src/enums/authenticator-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum AuthenticatorType {
Totp = 'totp',
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export type { QueryTypes, QueryTypesList } from './query';
export { Permission } from './permission';
export { Role } from './role';
export { ID } from './id';
export { Type } from './enums/type';
export { Factor } from './enums/factor';
export { AuthenticatorType } from './enums/authenticator-type';
export { AuthenticationFactor } from './enums/authentication-factor';
export { OAuthProvider } from './enums/o-auth-provider';
export { Browser } from './enums/browser';
export { CreditCard } from './enums/credit-card';
Expand Down Expand Up @@ -54,4 +54,5 @@ export { ImageFormat } from './enums/image-format';
export { StorageUsageRange } from './enums/storage-usage-range';
export { PasswordHash } from './enums/password-hash';
export { UserUsageRange } from './enums/user-usage-range';
export { Type } from './enums/type';
export { MessagingProviderType } from './enums/messaging-provider-type';
20 changes: 10 additions & 10 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Service } from '../service';
import { AppwriteException, Client } from '../client';
import type { Models } from '../models';
import type { UploadProgress, Payload } from '../client';
import { Type } from '../enums/type';
import { Factor } from '../enums/factor';
import { AuthenticatorType } from '../enums/authenticator-type';
import { AuthenticationFactor } from '../enums/authentication-factor';
import { OAuthProvider } from '../enums/o-auth-provider';

export class Account extends Service {
Expand Down Expand Up @@ -275,11 +275,11 @@ export class Account extends Service {
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
*
* @param {Type} type
* @param {AuthenticatorType} type
* @throws {AppwriteException}
* @returns {Promise}
*/
async createMfaAuthenticator(type: Type): Promise<Models.MfaType> {
async createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
Expand All @@ -300,12 +300,12 @@ export class Account extends Service {
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* method.
*
* @param {Type} type
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
Expand All @@ -332,12 +332,12 @@ export class Account extends Service {
*
* Delete an authenticator for a user by ID.
*
* @param {Type} type
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
Expand Down Expand Up @@ -366,11 +366,11 @@ export class Account extends Service {
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
* method.
*
* @param {Factor} factor
* @param {AuthenticationFactor} factor
* @throws {AppwriteException}
* @returns {Promise}
*/
async createMfaChallenge(factor: Factor): Promise<Models.MfaChallenge> {
async createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
if (typeof factor === 'undefined') {
throw new AppwriteException('Missing required parameter: "factor"');
}
Expand Down

0 comments on commit 600da47

Please sign in to comment.