From 686550b47d5c774ae674c2d39f475c7830c5d4b4 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Jun 2025 07:59:26 +0000 Subject: [PATCH 1/3] chore: regenerate sdk --- README.md | 2 +- package.json | 2 +- src/client.ts | 6 +- src/services/account.ts | 1 + src/services/avatars.ts | 324 +++++++++++++++++++++++++++++++++++--- src/services/databases.ts | 1 + src/services/functions.ts | 1 + src/services/graphql.ts | 1 + src/services/locale.ts | 1 + src/services/messaging.ts | 1 + src/services/storage.ts | 152 +++++++++++++++++- src/services/teams.ts | 1 + 12 files changed, 461 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 178a7c6e..542c5c3e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite React Native SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/package.json b/package.json index cd6bfdae..690e55c4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-appwrite", "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.9.2", + "version": "0.9.1", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 49e675b4..d3908252 100644 --- a/src/client.ts +++ b/src/client.ts @@ -115,7 +115,7 @@ class Client { 'x-sdk-name': 'React Native', 'x-sdk-platform': 'client', 'x-sdk-language': 'reactnative', - 'x-sdk-version': '0.9.2', + 'x-sdk-version': '0.9.1', 'X-Appwrite-Response-Format': '1.7.0', }; @@ -432,7 +432,7 @@ class Client { } } - async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise { + async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise { method = method.toUpperCase(); headers = Object.assign({}, this.headers, headers); @@ -488,6 +488,8 @@ class Client { if (response.headers.get('content-type')?.includes('application/json')) { data = await response.json(); + } else if (responseType === 'arrayBuffer') { + data = await response.arrayBuffer(); } else { data = { message: await response.text() diff --git a/src/services/account.ts b/src/services/account.ts index bcd37339..b48f2549 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1457,4 +1457,5 @@ export class Account extends Service { 'content-type': 'application/json', }, payload); } + }; diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 1d640843..f0784ed2 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -33,9 +33,9 @@ export class Avatars extends Service { * @param {number} height * @param {number} quality * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getBrowser(code: Browser, width?: number, height?: number, quality?: number): URL { + getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -62,7 +62,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -81,9 +82,9 @@ export class Avatars extends Service { * @param {number} height * @param {number} quality * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): URL { + getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -110,7 +111,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -121,9 +123,9 @@ export class Avatars extends Service { * * @param {string} url * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getFavicon(url: string): URL { + getFavicon(url: string): Promise { if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } @@ -142,7 +144,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -162,9 +165,9 @@ export class Avatars extends Service { * @param {number} height * @param {number} quality * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getFlag(code: Flag, width?: number, height?: number, quality?: number): URL { + getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -191,7 +194,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -211,9 +215,9 @@ export class Avatars extends Service { * @param {number} width * @param {number} height * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getImage(url: string, width?: number, height?: number): URL { + getImage(url: string, width?: number, height?: number): Promise { if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } @@ -240,7 +244,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -266,9 +271,9 @@ export class Avatars extends Service { * @param {number} height * @param {string} background * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getInitials(name?: string, width?: number, height?: number, background?: string): URL { + getInitials(name?: string, width?: number, height?: number, background?: string): Promise { const apiPath = '/avatars/initials'; const payload: Payload = {}; @@ -295,7 +300,8 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -308,9 +314,9 @@ export class Avatars extends Service { * @param {number} margin * @param {boolean} download * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getQR(text: string, size?: number, margin?: number, download?: boolean): URL { + getQR(text: string, size?: number, margin?: number, download?: boolean): Promise { if (typeof text === 'undefined') { throw new AppwriteException('Missing required parameter: "text"'); } @@ -341,6 +347,284 @@ export class Avatars extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); + } + + + /** + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user [GET + * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) + * endpoint. Use width, height and quality arguments to change the output + * settings. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * @param {Browser} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + + */ + getBrowserURL(code: Browser, width?: number, height?: number, quality?: number): URL { + const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); + const payload: Payload = {}; + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * The credit card endpoint will return you the icon of the credit card + * provider you need. Use width, height and quality arguments to change the + * output settings. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param {CreditCard} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + + */ + getCreditCardURL(code: CreditCard, width?: number, height?: number, quality?: number): URL { + const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); + const payload: Payload = {}; + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} url + * @throws {AppwriteException} + * @returns {URL} + + */ + getFaviconURL(url: string): URL { + const apiPath = '/avatars/favicon'; + const payload: Payload = {}; + + if (typeof url !== 'undefined') { + payload['url'] = url; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. Country codes + * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param {Flag} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + + */ + getFlagURL(code: Flag, width?: number, height?: number, quality?: number): URL { + const apiPath = '/avatars/flags/{code}'.replace('{code}', code); + const payload: Payload = {}; + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {AppwriteException} + * @returns {URL} + + */ + getImageURL(url: string, width?: number, height?: number): URL { + const apiPath = '/avatars/image'; + const payload: Payload = {}; + + if (typeof url !== 'undefined') { + payload['url'] = url; + } + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled + * with preserved aspect ratio. If both dimensions are 0, the API provides an + * image at source quality. If dimensions are not specified, the default size + * of image returned is 100x100px. + * + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} background + * @throws {AppwriteException} + * @returns {URL} + + */ + getInitialsURL(name?: string, width?: number, height?: number, background?: string): URL { + const apiPath = '/avatars/initials'; + const payload: Payload = {}; + + if (typeof name !== 'undefined') { + payload['name'] = name; + } + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + if (typeof background !== 'undefined') { + payload['background'] = background; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Converts a given plain text to a QR code image. You can use the query + * parameters to change the size and style of the resulting image. + * + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {AppwriteException} + * @returns {URL} + + */ + getQRURL(text: string, size?: number, margin?: number, download?: boolean): URL { + const apiPath = '/avatars/qr'; + const payload: Payload = {}; + + if (typeof text !== 'undefined') { + payload['text'] = text; + } + + if (typeof size !== 'undefined') { + payload['size'] = size; + } + + if (typeof margin !== 'undefined') { + payload['margin'] = margin; + } + + if (typeof download !== 'undefined') { + payload['download'] = download; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + return uri; } }; diff --git a/src/services/databases.ts b/src/services/databases.ts index e8bb0ab8..ac0ce85c 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -252,4 +252,5 @@ export class Databases extends Service { 'content-type': 'application/json', }, payload); } + }; diff --git a/src/services/functions.ts b/src/services/functions.ts index 4f41fe09..b2668c4d 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -118,4 +118,5 @@ export class Functions extends Service { return this.client.call('get', uri, { }, payload); } + }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index a24adaa4..89820038 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -64,4 +64,5 @@ export class Graphql extends Service { 'content-type': 'application/json', }, payload); } + }; diff --git a/src/services/locale.ts b/src/services/locale.ts index 6498bd98..1937f5f9 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -145,4 +145,5 @@ export class Locale extends Service { return this.client.call('get', uri, { }, payload); } + }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 6e33b9ab..2c021b01 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -77,4 +77,5 @@ export class Messaging extends Service { 'content-type': 'application/json', }, payload); } + }; diff --git a/src/services/storage.ts b/src/services/storage.ts index 0df7865e..77ae2d8d 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -260,9 +260,9 @@ export class Storage extends Service { * @param {string} fileId * @param {string} token * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getFileDownload(bucketId: string, fileId: string, token?: string): URL { + getFileDownload(bucketId: string, fileId: string, token?: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -285,7 +285,8 @@ export class Storage extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -310,9 +311,9 @@ export class Storage extends Service { * @param {ImageFormat} output * @param {string} token * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL { + getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -379,7 +380,8 @@ export class Storage extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri; + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); } /** @@ -391,9 +393,9 @@ export class Storage extends Service { * @param {string} fileId * @param {string} token * @throws {AppwriteException} - * @returns {URL} + * @returns {ArrayBuffer} */ - getFileView(bucketId: string, fileId: string, token?: string): URL { + getFileView(bucketId: string, fileId: string, token?: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -416,6 +418,140 @@ export class Storage extends Service { for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return this.client.call('get', uri, { + }, payload, 'arrayBuffer'); + } + + + /** + * Get a file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} bucketId + * @param {string} fileId + * @param {string} token + * @throws {AppwriteException} + * @returns {URL} + + */ + getFileDownloadURL(bucketId: string, fileId: string, token?: string): URL { + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + + if (typeof token !== 'undefined') { + payload['token'] = token; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. Preview is + * supported only for image files smaller than 10MB. + * + * @param {string} bucketId + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {ImageGravity} gravity + * @param {number} quality + * @param {number} borderWidth + * @param {string} borderColor + * @param {number} borderRadius + * @param {number} opacity + * @param {number} rotation + * @param {string} background + * @param {ImageFormat} output + * @param {string} token + * @throws {AppwriteException} + * @returns {URL} + + */ + getFilePreviewURL(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL { + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + + if (typeof width !== 'undefined') { + payload['width'] = width; + } + + if (typeof height !== 'undefined') { + payload['height'] = height; + } + + if (typeof gravity !== 'undefined') { + payload['gravity'] = gravity; + } + + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + + if (typeof borderWidth !== 'undefined') { + payload['borderWidth'] = borderWidth; + } + + if (typeof borderColor !== 'undefined') { + payload['borderColor'] = borderColor; + } + + if (typeof borderRadius !== 'undefined') { + payload['borderRadius'] = borderRadius; + } + + if (typeof opacity !== 'undefined') { + payload['opacity'] = opacity; + } + + if (typeof rotation !== 'undefined') { + payload['rotation'] = rotation; + } + + if (typeof background !== 'undefined') { + payload['background'] = background; + } + + if (typeof output !== 'undefined') { + payload['output'] = output; + } + + if (typeof token !== 'undefined') { + payload['token'] = token; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + + return uri; + } + + /** + * Get a file content by its unique ID. This endpoint is similar to the + * download method but returns with no 'Content-Disposition: attachment' + * header. + * + * @param {string} bucketId + * @param {string} fileId + * @param {string} token + * @throws {AppwriteException} + * @returns {URL} + + */ + getFileViewURL(bucketId: string, fileId: string, token?: string): URL { + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + + if (typeof token !== 'undefined') { + payload['token'] = token; + } + + const uri = new URL(this.client.config.endpoint + apiPath); + return uri; } }; diff --git a/src/services/teams.ts b/src/services/teams.ts index 98e459f6..d2a70f98 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -455,4 +455,5 @@ export class Teams extends Service { 'content-type': 'application/json', }, payload); } + }; From 5a6a99840e77c75545fa43fc13999dcd651afbf7 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Jun 2025 08:07:57 +0000 Subject: [PATCH 2/3] chore: fix formatting --- package.json | 2 +- src/client.ts | 2 +- src/services/account.ts | 1 - src/services/avatars.ts | 8 -------- src/services/databases.ts | 1 - src/services/functions.ts | 1 - src/services/graphql.ts | 1 - src/services/locale.ts | 1 - src/services/messaging.ts | 1 - src/services/storage.ts | 4 ---- src/services/teams.ts | 1 - 11 files changed, 2 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 690e55c4..ebce0e85 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-appwrite", "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.9.1", + "version": "0.10.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index d3908252..481c7a0f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -115,7 +115,7 @@ class Client { 'x-sdk-name': 'React Native', 'x-sdk-platform': 'client', 'x-sdk-language': 'reactnative', - 'x-sdk-version': '0.9.1', + 'x-sdk-version': '0.10.0', 'X-Appwrite-Response-Format': '1.7.0', }; diff --git a/src/services/account.ts b/src/services/account.ts index b48f2549..bcd37339 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1457,5 +1457,4 @@ export class Account extends Service { 'content-type': 'application/json', }, payload); } - }; diff --git a/src/services/avatars.ts b/src/services/avatars.ts index f0784ed2..5795bfce 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -351,7 +351,6 @@ export class Avatars extends Service { }, payload, 'arrayBuffer'); } - /** * You can use this endpoint to show different browser icons to your users. * The code argument receives the browser code as it appears in your user [GET @@ -370,7 +369,6 @@ export class Avatars extends Service { * @param {number} quality * @throws {AppwriteException} * @returns {URL} - */ getBrowserURL(code: Browser, width?: number, height?: number, quality?: number): URL { const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); @@ -410,7 +408,6 @@ export class Avatars extends Service { * @param {number} quality * @throws {AppwriteException} * @returns {URL} - */ getCreditCardURL(code: CreditCard, width?: number, height?: number, quality?: number): URL { const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); @@ -442,7 +439,6 @@ export class Avatars extends Service { * @param {string} url * @throws {AppwriteException} * @returns {URL} - */ getFaviconURL(url: string): URL { const apiPath = '/avatars/favicon'; @@ -475,7 +471,6 @@ export class Avatars extends Service { * @param {number} quality * @throws {AppwriteException} * @returns {URL} - */ getFlagURL(code: Flag, width?: number, height?: number, quality?: number): URL { const apiPath = '/avatars/flags/{code}'.replace('{code}', code); @@ -516,7 +511,6 @@ export class Avatars extends Service { * @param {number} height * @throws {AppwriteException} * @returns {URL} - */ getImageURL(url: string, width?: number, height?: number): URL { const apiPath = '/avatars/image'; @@ -563,7 +557,6 @@ export class Avatars extends Service { * @param {string} background * @throws {AppwriteException} * @returns {URL} - */ getInitialsURL(name?: string, width?: number, height?: number, background?: string): URL { const apiPath = '/avatars/initials'; @@ -601,7 +594,6 @@ export class Avatars extends Service { * @param {boolean} download * @throws {AppwriteException} * @returns {URL} - */ getQRURL(text: string, size?: number, margin?: number, download?: boolean): URL { const apiPath = '/avatars/qr'; diff --git a/src/services/databases.ts b/src/services/databases.ts index ac0ce85c..e8bb0ab8 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -252,5 +252,4 @@ export class Databases extends Service { 'content-type': 'application/json', }, payload); } - }; diff --git a/src/services/functions.ts b/src/services/functions.ts index b2668c4d..4f41fe09 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -118,5 +118,4 @@ export class Functions extends Service { return this.client.call('get', uri, { }, payload); } - }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 89820038..a24adaa4 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -64,5 +64,4 @@ export class Graphql extends Service { 'content-type': 'application/json', }, payload); } - }; diff --git a/src/services/locale.ts b/src/services/locale.ts index 1937f5f9..6498bd98 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -145,5 +145,4 @@ export class Locale extends Service { return this.client.call('get', uri, { }, payload); } - }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 2c021b01..6e33b9ab 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -77,5 +77,4 @@ export class Messaging extends Service { 'content-type': 'application/json', }, payload); } - }; diff --git a/src/services/storage.ts b/src/services/storage.ts index 77ae2d8d..e574d6bc 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -422,7 +422,6 @@ export class Storage extends Service { }, payload, 'arrayBuffer'); } - /** * Get a file content by its unique ID. The endpoint response return with a * 'Content-Disposition: attachment' header that tells the browser to start @@ -433,7 +432,6 @@ export class Storage extends Service { * @param {string} token * @throws {AppwriteException} * @returns {URL} - */ getFileDownloadURL(bucketId: string, fileId: string, token?: string): URL { const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); @@ -471,7 +469,6 @@ export class Storage extends Service { * @param {string} token * @throws {AppwriteException} * @returns {URL} - */ getFilePreviewURL(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL { const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); @@ -540,7 +537,6 @@ export class Storage extends Service { * @param {string} token * @throws {AppwriteException} * @returns {URL} - */ getFileViewURL(bucketId: string, fileId: string, token?: string): URL { const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); diff --git a/src/services/teams.ts b/src/services/teams.ts index d2a70f98..98e459f6 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -455,5 +455,4 @@ export class Teams extends Service { 'content-type': 'application/json', }, payload); } - }; From 1068161afeda3ca950765ac45f161e6a7b825bac Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Jun 2025 08:14:10 +0000 Subject: [PATCH 3/3] chore: add changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bc7d893..56e176f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change log +## 0.10.0 + +* Add generate file URL methods like`getFilePreviewURL`, `getFileViewURL` etc. +* Update (breaking) existing methods like `getFilePreview` to download the image instead of returning URLs + +## 0.9.2 + +* Fix `devKeys` by removing credentials from requests when the key is set + +## 0.9.1 + +* Add `setDevkey` and `upsertDocument` methods + ## 0.9.0 * Add `token` param to `getFilePreview` and `getFileView` for File tokens usage