Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.6.1-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.2-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)
Expand Down
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.2",
"version": "0.7.3",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
13 changes: 10 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '0.7.2',
'x-sdk-version': '0.7.3',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand All @@ -128,8 +128,12 @@ class Client {
* @returns {this}
*/
setEndpoint(endpoint: string): this {
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
}

this.config.endpoint = endpoint;
this.config.endpointRealtime = this.config.endpointRealtime || this.config.endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
this.config.endpointRealtime = endpoint.replace('https://', 'wss://').replace('http://', 'ws://');

return this;
}
Expand All @@ -142,8 +146,11 @@ class Client {
* @returns {this}
*/
setEndpointRealtime(endpointRealtime: string): this {
this.config.endpointRealtime = endpointRealtime;
if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
}

this.config.endpointRealtime = endpointRealtime;
return this;
}

Expand Down
1 change: 1 addition & 0 deletions src/enums/o-auth-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export enum OAuthProvider {
Dropbox = 'dropbox',
Etsy = 'etsy',
Facebook = 'facebook',
Figma = 'figma',
Github = 'github',
Gitlab = 'gitlab',
Google = 'google',
Expand Down
8 changes: 0 additions & 8 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -144,7 +143,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -207,7 +205,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -390,7 +387,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -409,7 +405,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -559,7 +554,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -696,7 +690,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -959,7 +952,6 @@ export class Account extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down
2 changes: 0 additions & 2 deletions src/services/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Databases extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -131,7 +130,6 @@ export class Databases extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down
2 changes: 0 additions & 2 deletions src/services/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class Functions extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -122,7 +121,6 @@ export class Functions extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}
};
8 changes: 0 additions & 8 deletions src/services/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -47,7 +46,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -64,7 +62,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -81,7 +78,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -98,7 +94,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -115,7 +110,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -133,7 +127,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand All @@ -150,7 +143,6 @@ export class Locale extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}
};
2 changes: 0 additions & 2 deletions src/services/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class Storage extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -185,7 +184,6 @@ export class Storage extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down
5 changes: 0 additions & 5 deletions src/services/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class Teams extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -98,7 +97,6 @@ export class Teams extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -183,7 +181,6 @@ export class Teams extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -286,7 +283,6 @@ export class Teams extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down Expand Up @@ -425,7 +421,6 @@ export class Teams extends Service {

const uri = new URL(this.client.config.endpoint + apiPath);
return this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}

Expand Down