Skip to content

Commit

Permalink
Release candidate for 1.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Feb 27, 2024
1 parent 9a9657d commit 5079b87
Show file tree
Hide file tree
Showing 21 changed files with 161 additions and 86 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/[email protected].13"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/[email protected].14"></script>
```


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

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

const account = new Account(client);

const result = await account.updatePhoneSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);

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

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -16,7 +16,7 @@ const result = await messaging.createEmail(
[], // cc (optional)
[], // bcc (optional)
[], // attachments (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
false, // html (optional)
'' // scheduledAt (optional)
);
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging, MessageStatus } from "@appwrite.io/console";
import { Client, Messaging } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -21,7 +21,7 @@ const result = await messaging.createPush(
'<COLOR>', // color (optional)
'<TAG>', // tag (optional)
'<BADGE>', // badge (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
'' // scheduledAt (optional)
);

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/messaging/create-sms.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging, MessageStatus } from "@appwrite.io/console";
import { Client, Messaging } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -12,7 +12,7 @@ const result = await messaging.createSms(
[], // topics (optional)
[], // users (optional)
[], // targets (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
'' // scheduledAt (optional)
);

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

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -13,7 +13,7 @@ const result = await messaging.updateEmail(
[], // targets (optional)
'<SUBJECT>', // subject (optional)
'<CONTENT>', // content (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
false, // html (optional)
[], // cc (optional)
[], // bcc (optional)
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging, MessageStatus } from "@appwrite.io/console";
import { Client, Messaging } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -21,7 +21,7 @@ const result = await messaging.updatePush(
'<COLOR>', // color (optional)
'<TAG>', // tag (optional)
null, // badge (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
'' // scheduledAt (optional)
);

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

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -12,7 +12,7 @@ const result = await messaging.updateSms(
[], // users (optional)
[], // targets (optional)
'<CONTENT>', // content (optional)
MessageStatus.Draft, // status (optional)
false, // draft (optional)
'' // scheduledAt (optional)
);

Expand Down
3 changes: 1 addition & 2 deletions docs/examples/users/delete-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const users = new Users(client);

const result = await users.deleteAuthenticator(
'<USER_ID>', // userId
AuthenticatorType.Totp, // type
'<OTP>' // otp
AuthenticatorType.Totp // type
);

console.log(response);
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.13",
"version": "0.6.0-rc.14",
"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.13',
'x-sdk-version': '0.6.0-rc.14',
'X-Appwrite-Response-Format': '1.5.0',
};

Expand Down
1 change: 0 additions & 1 deletion src/enums/index-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export enum IndexType {
Key = 'key',
Fulltext = 'fulltext',
Unique = 'unique',
Spatial = 'spatial',
}
5 changes: 0 additions & 5 deletions src/enums/message-status.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export { Runtime } from './enums/runtime';
export { FunctionUsageRange } from './enums/function-usage-range';
export { ExecutionMethod } from './enums/execution-method';
export { Name } from './enums/name';
export { MessageStatus } from './enums/message-status';
export { SmtpEncryption } from './enums/smtp-encryption';
export { ProjectUsageRange } from './enums/project-usage-range';
export { Region } from './enums/region';
Expand Down
59 changes: 54 additions & 5 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export class Account extends Service {
/**
* Update MFA
*
* Enable or disable MFA on an account.
*
* @param {boolean} mfa
* @throws {AppwriteException}
Expand Down Expand Up @@ -295,6 +296,7 @@ export class Account extends Service {
/**
* Create MFA Challenge (confirmation)
*
* Complete the MFA challenge by providing the one-time password.
*
* @param {string} challengeId
* @param {string} otp
Expand Down Expand Up @@ -330,6 +332,7 @@ export class Account extends Service {
/**
* List Factors
*
* List the factors available on the account to be used as a MFA challange.
*
* @throws {AppwriteException}
* @returns {Promise}
Expand All @@ -347,6 +350,10 @@ export class Account extends Service {
/**
* Add Authenticator
*
* Add an authenticator app to be used as an MFA factor. Verify the
* authenticator using the [verify
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
*
* @param {AuthenticatorType} type
* @throws {AppwriteException}
Expand All @@ -369,6 +376,9 @@ export class Account extends Service {
/**
* Verify Authenticator
*
* Verify an authenticator app after adding it using the [add
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* method.
*
* @param {AuthenticatorType} type
* @param {string} otp
Expand Down Expand Up @@ -400,6 +410,7 @@ export class Account extends Service {
/**
* Delete Authenticator
*
* Delete an authenticator for a user by ID.
*
* @param {AuthenticatorType} type
* @param {string} otp
Expand Down Expand Up @@ -777,7 +788,7 @@ export class Account extends Service {
}

/**
* Create session (deprecated)
* Update magic URL session
*
* Use this endpoint to create a session from token. Provide the **userId**
* and **secret** parameters from the successful response of authentication
Expand Down Expand Up @@ -875,6 +886,44 @@ export class Account extends Service {
}
}

/**
* Update phone session
*
* Use this endpoint to create a session from token. Provide the **userId**
* and **secret** parameters from the successful response of authentication
* flows initiated by token creation. For example, magic URL and phone login.
*
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise}
*/
async updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}

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

const apiPath = '/account/sessions/phone';
const payload: Payload = {};

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

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

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

/**
* Create session
*
Expand Down Expand Up @@ -938,7 +987,7 @@ export class Account extends Service {
}

/**
* Update (or renew) a session
* Update (or renew) session
*
* Extend session's expiry to increase it's lifespan. Extending a session is
* useful when session length is short such as 5 minutes.
Expand Down Expand Up @@ -1009,7 +1058,7 @@ export class Account extends Service {
}

/**
* Create a push target
* Create push target
*
*
* @param {string} targetId
Expand Down Expand Up @@ -1049,7 +1098,7 @@ export class Account extends Service {
}

/**
* Update a push target
* Update push target
*
*
* @param {string} targetId
Expand Down Expand Up @@ -1080,7 +1129,7 @@ export class Account extends Service {
}

/**
* Delete a push target
* Delete push target
*
*
* @param {string} targetId
Expand Down
Loading

0 comments on commit 5079b87

Please sign in to comment.