Skip to content

Commit 7b21d10

Browse files
authored
Merge pull request #56 from appwrite/dev
Dev
2 parents 10ec486 + ca2b06a commit 7b21d10

15 files changed

+39
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Appwrite React Native SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
88

9-
**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).**
9+
**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).**
1010

1111
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)
1212

docs/examples/avatars/get-browser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const result = avatars.getBrowser(
1010
Browser.AvantBrowser, // code
1111
0, // width (optional)
1212
0, // height (optional)
13-
0 // quality (optional)
13+
-1 // quality (optional)
1414
);
1515

1616
console.log(result);

docs/examples/avatars/get-credit-card.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const result = avatars.getCreditCard(
1010
CreditCard.AmericanExpress, // code
1111
0, // width (optional)
1212
0, // height (optional)
13-
0 // quality (optional)
13+
-1 // quality (optional)
1414
);
1515

1616
console.log(result);

docs/examples/avatars/get-flag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const result = avatars.getFlag(
1010
Flag.Afghanistan, // code
1111
0, // width (optional)
1212
0, // height (optional)
13-
0 // quality (optional)
13+
-1 // quality (optional)
1414
);
1515

1616
console.log(result);

docs/examples/databases/create-document.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { Client, Databases } from "react-native-appwrite";
22

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

79
const databases = new Databases(client);
810

docs/examples/functions/list-executions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const functions = new Functions(client);
88

99
const result = await functions.listExecutions(
1010
'<FUNCTION_ID>', // functionId
11-
[], // queries (optional)
12-
'<SEARCH>' // search (optional)
11+
[] // queries (optional)
1312
);
1413

1514
console.log(result);

docs/examples/storage/get-file-download.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const storage = new Storage(client);
88

99
const result = storage.getFileDownload(
1010
'<BUCKET_ID>', // bucketId
11-
'<FILE_ID>' // fileId
11+
'<FILE_ID>', // fileId
12+
'<TOKEN>' // token (optional)
1213
);
1314

1415
console.log(result);

docs/examples/storage/get-file-preview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ const result = storage.getFilePreview(
1212
0, // width (optional)
1313
0, // height (optional)
1414
ImageGravity.Center, // gravity (optional)
15-
0, // quality (optional)
15+
-1, // quality (optional)
1616
0, // borderWidth (optional)
1717
'', // borderColor (optional)
1818
0, // borderRadius (optional)
1919
0, // opacity (optional)
2020
-360, // rotation (optional)
2121
'', // background (optional)
22-
ImageFormat.Jpg // output (optional)
22+
ImageFormat.Jpg, // output (optional)
23+
'<TOKEN>' // token (optional)
2324
);
2425

2526
console.log(result);

docs/examples/storage/get-file-view.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const storage = new Storage(client);
88

99
const result = storage.getFileView(
1010
'<BUCKET_ID>', // bucketId
11-
'<FILE_ID>' // fileId
11+
'<FILE_ID>', // fileId
12+
'<TOKEN>' // token (optional)
1213
);
1314

1415
console.log(result);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-native-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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",
5-
"version": "0.7.4",
5+
"version": "0.9.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class Client {
114114
'x-sdk-name': 'React Native',
115115
'x-sdk-platform': 'client',
116116
'x-sdk-language': 'reactnative',
117-
'x-sdk-version': '0.7.4',
118-
'X-Appwrite-Response-Format': '1.6.0',
117+
'x-sdk-version': '0.9.0',
118+
'X-Appwrite-Response-Format': '1.7.0',
119119
};
120120

121121
/**

src/enums/image-format.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export enum ImageFormat {
22
Jpg = 'jpg',
33
Jpeg = 'jpeg',
4-
Gif = 'gif',
54
Png = 'png',
65
Webp = 'webp',
76
Heic = 'heic',

src/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ export namespace Models {
940940
*/
941941
errors: string;
942942
/**
943-
* Function execution duration in seconds.
943+
* Resource(function/site) execution duration in seconds.
944944
*/
945945
duration: number;
946946
/**

src/services/functions.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ export class Functions extends Service {
2020
*
2121
* @param {string} functionId
2222
* @param {string[]} queries
23-
* @param {string} search
2423
* @throws {AppwriteException}
2524
* @returns {Promise}
2625
*/
27-
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
26+
listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList> {
2827
if (typeof functionId === 'undefined') {
2928
throw new AppwriteException('Missing required parameter: "functionId"');
3029
}
@@ -36,10 +35,6 @@ export class Functions extends Service {
3635
payload['queries'] = queries;
3736
}
3837

39-
if (typeof search !== 'undefined') {
40-
payload['search'] = search;
41-
}
42-
4338
const uri = new URL(this.client.config.endpoint + apiPath);
4439
return this.client.call('get', uri, {
4540
}, payload);

src/services/storage.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,11 @@ export class Storage extends Service {
258258
*
259259
* @param {string} bucketId
260260
* @param {string} fileId
261+
* @param {string} token
261262
* @throws {AppwriteException}
262263
* @returns {URL}
263264
*/
264-
getFileDownload(bucketId: string, fileId: string): URL {
265+
getFileDownload(bucketId: string, fileId: string, token?: string): URL {
265266
if (typeof bucketId === 'undefined') {
266267
throw new AppwriteException('Missing required parameter: "bucketId"');
267268
}
@@ -273,6 +274,10 @@ export class Storage extends Service {
273274
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
274275
const payload: Payload = {};
275276

277+
if (typeof token !== 'undefined') {
278+
payload['token'] = token;
279+
}
280+
276281
const uri = new URL(this.client.config.endpoint + apiPath);
277282
payload['project'] = this.client.config.project;
278283

@@ -303,10 +308,11 @@ export class Storage extends Service {
303308
* @param {number} rotation
304309
* @param {string} background
305310
* @param {ImageFormat} output
311+
* @param {string} token
306312
* @throws {AppwriteException}
307313
* @returns {URL}
308314
*/
309-
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 {
315+
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 {
310316
if (typeof bucketId === 'undefined') {
311317
throw new AppwriteException('Missing required parameter: "bucketId"');
312318
}
@@ -362,6 +368,10 @@ export class Storage extends Service {
362368
payload['output'] = output;
363369
}
364370

371+
if (typeof token !== 'undefined') {
372+
payload['token'] = token;
373+
}
374+
365375
const uri = new URL(this.client.config.endpoint + apiPath);
366376
payload['project'] = this.client.config.project;
367377

@@ -379,10 +389,11 @@ export class Storage extends Service {
379389
*
380390
* @param {string} bucketId
381391
* @param {string} fileId
392+
* @param {string} token
382393
* @throws {AppwriteException}
383394
* @returns {URL}
384395
*/
385-
getFileView(bucketId: string, fileId: string): URL {
396+
getFileView(bucketId: string, fileId: string, token?: string): URL {
386397
if (typeof bucketId === 'undefined') {
387398
throw new AppwriteException('Missing required parameter: "bucketId"');
388399
}
@@ -394,6 +405,10 @@ export class Storage extends Service {
394405
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
395406
const payload: Payload = {};
396407

408+
if (typeof token !== 'undefined') {
409+
payload['token'] = token;
410+
}
411+
397412
const uri = new URL(this.client.config.endpoint + apiPath);
398413
payload['project'] = this.client.config.project;
399414

0 commit comments

Comments
 (0)