diff --git a/CHANGELOG.md b/CHANGELOG.md index bbee4e7c..fe57112a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 26.0.0 + +* Breaking: Renamed `Theme` enum to `BrowserTheme`, changing `avatars.getScreenshot()` `theme` param type. +* Breaking: Made `presences` `list`/`get`/`upsert`/`update` non-generic and removed `Models.DefaultPresence`. +* Added: Email metadata fields to `User` (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`). +* Added: `Membership.userAccessedAt` and `Presence.metadata` fields. +* Fixed: Removed `Client.setKey()` and `Client.setForwardedUserAgent()` methods that were exposed on the client SDK by mistake. +* Fixed: `toString()` on response objects now returns valid JSON via `JSONbig.stringify`, preserving large integers. +* Updated: Requests now send an explicit `accept` header matching each endpoint's response type. + ## 25.1.1 * Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) diff --git a/README.md b/README.md index 6ebf9c36..8044285e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 360c577f..3f87ddc8 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -9,7 +9,7 @@ const account = new Account(client); const result = await account.updatePassword({ password: '', - oldPassword: 'password' // optional + oldPassword: '' // optional }); console.log(result); diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 8804b1e8..d45f1e6e 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "appwrite"; +import { Client, Avatars, BrowserTheme, Timezone, BrowserPermission, ImageFormat } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -16,11 +16,11 @@ const result = avatars.getScreenshot({ viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: Theme.Dark, // optional + theme: BrowserTheme.Dark, // optional userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional - timezone: Timezone.AmericaNewYork, // optional + timezone: Timezone.AfricaAbidjan, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional diff --git a/package-lock.json b/package-lock.json index 90218546..a3aa13e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appwrite", - "version": "25.2.0", + "version": "26.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "appwrite", - "version": "25.2.0", + "version": "26.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 3472cc0c..b3307c14 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "25.2.0", + "version": "26.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 30160ffe..15a03579 100644 --- a/src/client.ts +++ b/src/client.ts @@ -354,11 +354,9 @@ class Client { endpoint: string; endpointRealtime: string; project: string; - key: string; jwt: string; locale: string; session: string; - forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; @@ -368,11 +366,9 @@ class Client { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', - key: '', jwt: '', locale: '', session: '', - forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', @@ -384,9 +380,9 @@ class Client { */ headers: Headers = { 'x-sdk-name': 'Web', - 'x-sdk-platform': 'server', + 'x-sdk-platform': 'client', 'x-sdk-language': 'web', - 'x-sdk-version': '25.2.0', + 'x-sdk-version': '26.0.0', 'X-Appwrite-Response-Format': '1.9.5', }; @@ -456,24 +452,9 @@ class Client { * @return {this} */ setProject(value: string): this { - this.headers['X-Appwrite-Project'] = value; this.config.project = value; return this; } - /** - * Set Key - * - * Your secret API key - * - * @param value string - * - * @return {this} - */ - setKey(value: string): this { - this.headers['X-Appwrite-Key'] = value; - this.config.key = value; - return this; - } /** * Set JWT * @@ -514,20 +495,6 @@ class Client { this.config.session = value; return this; } - /** - * Set ForwardedUserAgent - * - * The user agent string of the client that made the request - * - * @param value string - * - * @return {this} - */ - setForwardedUserAgent(value: string): this { - this.headers['X-Forwarded-User-Agent'] = value; - this.config.forwardeduseragent = value; - return this; - } /** * Set DevKey * @@ -1075,7 +1042,9 @@ class Client { } async ping(): Promise { - return this.call('GET', new URL(this.config.endpoint + '/ping')); + return this.call('GET', new URL(this.config.endpoint + '/ping'), { + 'X-Appwrite-Project': this.config.project, + }); } async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise { @@ -1128,7 +1097,12 @@ class Client { } if (data && typeof data === 'object') { - data.toString = () => JSONbig.stringify(data); + Object.defineProperty(data, 'toString', { + value: () => JSONbig.stringify(data), + writable: true, + enumerable: false, + configurable: true, + }); } return data; diff --git a/src/enums/theme.ts b/src/enums/browser-theme.ts similarity index 60% rename from src/enums/theme.ts rename to src/enums/browser-theme.ts index 5e823a9b..9f8c382a 100644 --- a/src/enums/theme.ts +++ b/src/enums/browser-theme.ts @@ -1,4 +1,4 @@ -export enum Theme { +export enum BrowserTheme { Light = 'light', Dark = 'dark', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 89b0a515..ab6c1550 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ export { OAuthProvider } from './enums/o-auth-provider'; export { Browser } from './enums/browser'; export { CreditCard } from './enums/credit-card'; export { Flag } from './enums/flag'; -export { Theme } from './enums/theme'; +export { BrowserTheme } from './enums/browser-theme'; export { Timezone } from './enums/timezone'; export { BrowserPermission } from './enums/browser-permission'; export { ImageFormat } from './enums/image-format'; diff --git a/src/models.ts b/src/models.ts index 9556fba0..3eb788c4 100644 --- a/src/models.ts +++ b/src/models.ts @@ -39,7 +39,7 @@ export namespace Models { /** * Presences List */ - export type PresenceList = { + export type PresenceList = { /** * Total number of presences that matched your query. */ @@ -360,13 +360,12 @@ export namespace Models { * Presence expiry date in ISO 8601 format. */ expiresAt?: string; + /** + * Presence metadata. + */ + metadata?: object; } - export type DefaultPresence = Presence & { - [key: string]: any; - [__default]: true; - }; - /** * Log */ @@ -521,6 +520,26 @@ export namespace Models { * Email verification status. */ emailVerification: boolean; + /** + * Canonical form of the user email address. + */ + emailCanonical?: string; + /** + * Whether the user email is from a free email provider. + */ + emailIsFree?: boolean; + /** + * Whether the user email is from a disposable email provider. + */ + emailIsDisposable?: boolean; + /** + * Whether the user email is from a corporate domain. + */ + emailIsCorporate?: boolean; + /** + * Whether the user email is in its canonical form. + */ + emailIsCanonical?: boolean; /** * Phone verification status. */ @@ -1076,6 +1095,10 @@ export namespace Models { * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. */ mfa: boolean; + /** + * Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console. + */ + userAccessedAt: string; /** * User list of roles */ diff --git a/src/services/account.ts b/src/services/account.ts index 5a3f7926..896931c7 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -26,6 +26,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -108,7 +110,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -178,7 +182,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -238,6 +244,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -289,6 +297,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -341,7 +350,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -401,6 +412,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -455,7 +468,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -508,7 +523,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -560,7 +577,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -624,7 +643,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -687,7 +708,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -740,6 +763,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -792,6 +816,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -848,7 +873,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -903,7 +930,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -970,7 +999,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1036,7 +1067,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1061,6 +1094,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1084,6 +1119,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1108,6 +1145,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1131,6 +1170,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1155,7 +1196,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1179,7 +1222,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1204,7 +1249,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1228,7 +1275,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1283,7 +1332,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1298,7 +1349,7 @@ export class Account { * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * * @param {string} params.password - New user password. Must be at least 8 chars. - * @param {string} params.oldPassword - Current user password. Must be at least 8 chars. + * @param {string} params.oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise>} */ @@ -1307,7 +1358,7 @@ export class Account { * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * * @param {string} password - New user password. Must be at least 8 chars. - * @param {string} oldPassword - Current user password. Must be at least 8 chars. + * @param {string} oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. @@ -1346,7 +1397,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1412,7 +1465,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1436,6 +1491,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1490,7 +1547,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1556,7 +1615,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1636,7 +1697,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1660,6 +1723,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1683,6 +1748,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1707,7 +1773,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1777,7 +1845,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1844,7 +1914,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1928,6 +2000,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'text/html', } payload['project'] = this.client.config.project; @@ -2000,7 +2074,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2066,7 +2142,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2118,6 +2196,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2169,7 +2249,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2221,6 +2303,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2245,7 +2328,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2318,7 +2403,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2381,7 +2468,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2433,6 +2522,7 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2512,7 +2602,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2598,7 +2690,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2680,6 +2774,8 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'text/html', } payload['project'] = this.client.config.project; @@ -2755,7 +2851,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2816,7 +2914,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2878,7 +2978,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2944,7 +3046,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3011,7 +3115,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3035,7 +3141,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3101,7 +3209,9 @@ export class Account { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/avatars.ts b/src/services/avatars.ts index eea5a0f8..90893900 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -5,7 +5,7 @@ import type { Models } from '../models'; import { Browser } from '../enums/browser'; import { CreditCard } from '../enums/credit-card'; import { Flag } from '../enums/flag'; -import { Theme } from '../enums/theme'; +import { BrowserTheme } from '../enums/browser-theme'; import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; @@ -84,6 +84,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; @@ -164,6 +166,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; @@ -223,6 +227,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } payload['project'] = this.client.config.project; @@ -303,6 +309,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; @@ -381,6 +389,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } payload['project'] = this.client.config.project; @@ -465,6 +475,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; @@ -544,6 +556,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; @@ -567,7 +581,7 @@ export class Avatars { * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {BrowserTheme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". * @param {string} params.userAgent - Custom user agent string. Defaults to browser default. * @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. * @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. @@ -585,7 +599,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {string} */ - getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): string; + getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): string; /** * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. * @@ -598,7 +612,7 @@ export class Avatars { * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {BrowserTheme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". * @param {string} userAgent - Custom user agent string. Defaults to browser default. * @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. * @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. @@ -617,15 +631,15 @@ export class Avatars { * @returns {string} * @deprecated Use the object parameter style method for a better developer experience. */ - getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): string; + getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): string; getScreenshot( - paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, - ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] + paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, + ...rest: [(object)?, (number)?, (number)?, (number)?, (BrowserTheme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] ): string { - let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; } else { params = { url: paramsOrFirst as string, @@ -633,7 +647,7 @@ export class Avatars { viewportWidth: rest[1] as number, viewportHeight: rest[2] as number, scale: rest[3] as number, - theme: rest[4] as Theme, + theme: rest[4] as BrowserTheme, userAgent: rest[5] as string, fullpage: rest[6] as boolean, locale: rest[7] as string, @@ -741,6 +755,8 @@ export class Avatars { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } payload['project'] = this.client.config.project; diff --git a/src/services/databases.ts b/src/services/databases.ts index 51a58d81..7421d142 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -51,6 +51,8 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -102,7 +104,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -154,6 +158,8 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -220,7 +226,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -272,6 +280,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -332,7 +341,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -421,6 +432,8 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -515,7 +528,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -597,6 +612,8 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -685,7 +702,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -774,7 +793,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -849,6 +870,7 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -945,7 +967,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1041,7 +1065,9 @@ export class Databases { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/functions.ts b/src/services/functions.ts index fc3f50ce..14864b79 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -67,6 +67,8 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -161,7 +163,9 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -221,6 +225,8 @@ export class Functions { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/graphql.ts b/src/services/graphql.ts index e995f66e..0823f622 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -54,8 +54,10 @@ export class Graphql { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -110,8 +112,10 @@ export class Graphql { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/locale.ts b/src/services/locale.ts index fe85eeb5..41583e29 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -25,6 +25,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -48,6 +50,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -71,6 +75,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -94,6 +100,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -117,6 +125,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -140,6 +150,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -163,6 +175,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -186,6 +200,8 @@ export class Locale { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/messaging.ts b/src/services/messaging.ts index d6c45bcd..8b3ef813 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -72,7 +72,9 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -132,6 +134,7 @@ export class Messaging { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/presences.ts b/src/services/presences.ts index f9df9e18..46678203 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -18,9 +18,9 @@ export class Presences { * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise>} + * @returns {Promise} */ - list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise>; + list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise; /** * List presence logs. Expired entries are filtered out automatically. * @@ -29,14 +29,14 @@ export class Presences { * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise>} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], total?: boolean, ttl?: number): Promise>; - list( + list(queries?: string[], total?: boolean, ttl?: number): Promise; + list( paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], ...rest: [(boolean)?, (number)?] - ): Promise> { + ): Promise { let params: { queries?: string[], total?: boolean, ttl?: number }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -68,6 +68,8 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -84,22 +86,22 @@ export class Presences { * * @param {string} params.presenceId - Presence unique ID. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - get(params: { presenceId: string }): Promise; + get(params: { presenceId: string }): Promise; /** * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. * * * @param {string} presenceId - Presence unique ID. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - get(presenceId: string): Promise; - get( + get(presenceId: string): Promise; + get( paramsOrFirst: { presenceId: string } | string - ): Promise { + ): Promise { let params: { presenceId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -121,6 +123,8 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -141,9 +145,9 @@ export class Presences { * @param {string} params.expiresAt - Presence expiry datetime. * @param {object} params.metadata - Presence metadata object. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - upsert(params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; + upsert(params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; /** * Create or update a presence log by its user ID. * @@ -154,14 +158,14 @@ export class Presences { * @param {string} expiresAt - Presence expiry datetime. * @param {object} metadata - Presence metadata object. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert(presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; - upsert( + upsert(presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; + upsert( paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, ...rest: [(string)?, (string[])?, (string)?, (object)?] - ): Promise { + ): Promise { let params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -206,7 +210,9 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -228,9 +234,9 @@ export class Presences { * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - update(params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; + update(params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -242,14 +248,14 @@ export class Presences { * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; - update( + update(presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; + update( paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] - ): Promise { + ): Promise { let params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -296,7 +302,9 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -350,6 +358,7 @@ export class Presences { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } diff --git a/src/services/storage.ts b/src/services/storage.ts index 814b14b7..485f59de 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -75,6 +75,8 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -171,7 +173,9 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', + 'accept': 'application/json', } return this.client.chunkedUpload( @@ -232,6 +236,8 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -305,7 +311,9 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -365,6 +373,7 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -432,6 +441,8 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } payload['project'] = this.client.config.project; @@ -576,6 +587,8 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } payload['project'] = this.client.config.project; @@ -643,6 +656,8 @@ export class Storage { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } payload['project'] = this.client.config.project; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index fa671f14..06a034a2 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -51,6 +51,8 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -102,7 +104,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -154,6 +158,8 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -220,7 +226,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -272,6 +280,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -332,7 +341,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -420,6 +431,8 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -513,7 +526,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -594,6 +609,8 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -681,7 +698,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -769,7 +788,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -843,6 +864,7 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -938,7 +960,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1033,7 +1057,9 @@ export class TablesDB { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/teams.ts b/src/services/teams.ts index 870f8a5b..7d169454 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -66,6 +66,8 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -138,7 +140,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -190,6 +194,8 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -252,7 +258,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -304,6 +312,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -378,6 +387,8 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -489,7 +500,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -549,6 +562,8 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -620,7 +635,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -680,6 +697,7 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -766,7 +784,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -818,6 +838,8 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -880,7 +902,9 @@ export class Teams { const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call(