Skip to content

Dev #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2025
Merged

Dev #56

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion docs/examples/avatars/get-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 3 additions & 1 deletion docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Client, Databases } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
.setSession('') // The user session to authenticate with
.setKey('') //
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token

const databases = new Databases(client);

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

const result = await functions.listExecutions(
'<FUNCTION_ID>', // functionId
[], // queries (optional)
'<SEARCH>' // search (optional)
[] // queries (optional)
);

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/storage/get-file-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const storage = new Storage(client);

const result = storage.getFileDownload(
'<BUCKET_ID>', // bucketId
'<FILE_ID>' // fileId
'<FILE_ID>', // fileId
'<TOKEN>' // token (optional)
);

console.log(result);
5 changes: 3 additions & 2 deletions docs/examples/storage/get-file-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>' // token (optional)
);

console.log(result);
3 changes: 2 additions & 1 deletion docs/examples/storage/get-file-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const storage = new Storage(client);

const result = storage.getFileView(
'<BUCKET_ID>', // bucketId
'<FILE_ID>' // fileId
'<FILE_ID>', // fileId
'<TOKEN>' // token (optional)
);

console.log(result);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "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": {
Expand Down
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

/**
Expand Down
1 change: 0 additions & 1 deletion src/enums/image-format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export enum ImageFormat {
Jpg = 'jpg',
Jpeg = 'jpeg',
Gif = 'gif',
Png = 'png',
Webp = 'webp',
Heic = 'heic',
Expand Down
2 changes: 1 addition & 1 deletion src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ export namespace Models {
*/
errors: string;
/**
* Function execution duration in seconds.
* Resource(function/site) execution duration in seconds.
*/
duration: number;
/**
Expand Down
7 changes: 1 addition & 6 deletions src/services/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Models.ExecutionList> {
listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList> {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
Expand All @@ -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);
Expand Down
21 changes: 18 additions & 3 deletions src/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
}
Expand All @@ -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;

Expand Down Expand Up @@ -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"');
}
Expand Down Expand Up @@ -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;

Expand All @@ -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"');
}
Expand All @@ -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;

Expand Down