diff --git a/README.md b/README.md index 3f24ffcd..178a7c6e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # 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.6.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.0-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) -**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 6bb005e5..433cbe59 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -10,7 +10,7 @@ const result = avatars.getBrowser( Browser.AvantBrowser, // code 0, // width (optional) 0, // height (optional) - 0 // quality (optional) + -1 // quality (optional) ); console.log(result); diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index bdaaf8bf..bbd0007f 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -10,7 +10,7 @@ const result = avatars.getCreditCard( CreditCard.AmericanExpress, // code 0, // width (optional) 0, // height (optional) - 0 // quality (optional) + -1 // quality (optional) ); console.log(result); diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index ac7aaf98..4e6070d1 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -10,7 +10,7 @@ const result = avatars.getFlag( Flag.Afghanistan, // code 0, // width (optional) 0, // height (optional) - 0 // quality (optional) + -1 // quality (optional) ); console.log(result); diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1b28231e..ec768fcf 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,7 +2,9 @@ import { Client, Databases } from "react-native-appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setSession('') // The user session to authenticate with + .setKey('') // + .setJWT(''); // Your secret JSON Web Token const databases = new Databases(client); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 6a1f5821..346f8c7e 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -8,8 +8,7 @@ const functions = new Functions(client); const result = await functions.listExecutions( '', // functionId - [], // queries (optional) - '' // search (optional) + [] // queries (optional) ); console.log(result); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index c8dcea3d..e21bad67 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -8,7 +8,8 @@ const storage = new Storage(client); const result = storage.getFileDownload( '', // bucketId - '' // fileId + '', // fileId + '' // token (optional) ); console.log(result); diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index b41236f6..6f116c5d 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -12,14 +12,15 @@ const result = storage.getFilePreview( 0, // width (optional) 0, // height (optional) ImageGravity.Center, // gravity (optional) - 0, // quality (optional) + -1, // quality (optional) 0, // borderWidth (optional) '', // borderColor (optional) 0, // borderRadius (optional) 0, // opacity (optional) -360, // rotation (optional) '', // background (optional) - ImageFormat.Jpg // output (optional) + ImageFormat.Jpg, // output (optional) + '' // token (optional) ); console.log(result); diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 06443a89..9b229f6a 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -8,7 +8,8 @@ const storage = new Storage(client); const result = storage.getFileView( '', // bucketId - '' // fileId + '', // fileId + '' // token (optional) ); console.log(result); diff --git a/package.json b/package.json index d720f4a8..55f72634 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.7.4", + "version": "0.9.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 13a71a62..bc3d647c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -114,8 +114,8 @@ class Client { 'x-sdk-name': 'React Native', 'x-sdk-platform': 'client', 'x-sdk-language': 'reactnative', - 'x-sdk-version': '0.7.4', - 'X-Appwrite-Response-Format': '1.6.0', + 'x-sdk-version': '0.9.0', + 'X-Appwrite-Response-Format': '1.7.0', }; /** diff --git a/src/enums/image-format.ts b/src/enums/image-format.ts index bcbe3e93..5aad5f08 100644 --- a/src/enums/image-format.ts +++ b/src/enums/image-format.ts @@ -1,7 +1,6 @@ export enum ImageFormat { Jpg = 'jpg', Jpeg = 'jpeg', - Gif = 'gif', Png = 'png', Webp = 'webp', Heic = 'heic', diff --git a/src/models.ts b/src/models.ts index 02394388..f6db5fab 100644 --- a/src/models.ts +++ b/src/models.ts @@ -940,7 +940,7 @@ export namespace Models { */ errors: string; /** - * Function execution duration in seconds. + * Resource(function/site) execution duration in seconds. */ duration: number; /** diff --git a/src/services/functions.ts b/src/services/functions.ts index d278537a..4f41fe09 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -20,11 +20,10 @@ export class Functions extends Service { * * @param {string} functionId * @param {string[]} queries - * @param {string} search * @throws {AppwriteException} * @returns {Promise} */ - listExecutions(functionId: string, queries?: string[], search?: string): Promise { + listExecutions(functionId: string, queries?: string[]): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -36,10 +35,6 @@ export class Functions extends Service { payload['queries'] = queries; } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - const uri = new URL(this.client.config.endpoint + apiPath); return this.client.call('get', uri, { }, payload); diff --git a/src/services/storage.ts b/src/services/storage.ts index 3b1ac8a8..0df7865e 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -258,10 +258,11 @@ export class Storage extends Service { * * @param {string} bucketId * @param {string} fileId + * @param {string} token * @throws {AppwriteException} * @returns {URL} */ - getFileDownload(bucketId: string, fileId: string): URL { + getFileDownload(bucketId: string, fileId: string, token?: string): URL { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -273,6 +274,10 @@ export class Storage extends Service { 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); payload['project'] = this.client.config.project; @@ -303,10 +308,11 @@ export class Storage extends Service { * @param {number} rotation * @param {string} background * @param {ImageFormat} output + * @param {string} token * @throws {AppwriteException} * @returns {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): 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): URL { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -362,6 +368,10 @@ export class Storage extends Service { payload['output'] = output; } + if (typeof token !== 'undefined') { + payload['token'] = token; + } + const uri = new URL(this.client.config.endpoint + apiPath); payload['project'] = this.client.config.project; @@ -379,10 +389,11 @@ export class Storage extends Service { * * @param {string} bucketId * @param {string} fileId + * @param {string} token * @throws {AppwriteException} * @returns {URL} */ - getFileView(bucketId: string, fileId: string): URL { + getFileView(bucketId: string, fileId: string, token?: string): URL { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -394,6 +405,10 @@ export class Storage extends Service { 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); payload['project'] = this.client.config.project;