Skip to content

Commit 0ce6c63

Browse files
authored
Merge pull request #108 from appwrite/dev
feat: React Native SDK update for version 0.32.0
2 parents ae369e8 + 38aa9c2 commit 0ce6c63

20 files changed

Lines changed: 341 additions & 52 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change log
22

3+
## 0.32.0
4+
5+
* Breaking: Renamed `Theme` enum to `BrowserTheme`.
6+
* Breaking: Removed `Models.DefaultPresence` and dropped the `Presence` generic from `presences` methods.
7+
* Added: Email metadata fields to `User`, plus `Membership.userAccessedAt` and `Presence.metadata`.
8+
* Updated: Requests now send an explicit `accept` header matching each endpoint's response type.
9+
310
## 0.30.1
411

512
* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs)

docs/examples/account/update-password.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const account = new Account(client);
99

1010
const result = await account.updatePassword({
1111
password: '',
12-
oldPassword: 'password' // optional
12+
oldPassword: '<OLD_PASSWORD>' // optional
1313
});
1414

1515
console.log(result);

docs/examples/avatars/get-screenshot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```javascript
2-
import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "react-native-appwrite";
2+
import { Client, Avatars, BrowserTheme, Timezone, BrowserPermission, ImageFormat } from "react-native-appwrite";
33

44
const client = new Client()
55
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
@@ -16,7 +16,7 @@ const result = avatars.getScreenshot({
1616
viewportWidth: 1920, // optional
1717
viewportHeight: 1080, // optional
1818
scale: 2, // optional
19-
theme: Theme.Dark, // optional
19+
theme: BrowserTheme.Dark, // optional
2020
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
2121
fullpage: true, // optional
2222
locale: 'en-US', // optional

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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 abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
5-
"version": "0.31.0",
5+
"version": "0.32.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class Client {
180180
'x-sdk-name': 'React Native',
181181
'x-sdk-platform': 'client',
182182
'x-sdk-language': 'reactnative',
183-
'x-sdk-version': '0.31.0',
183+
'x-sdk-version': '0.32.0',
184184
'X-Appwrite-Response-Format': '1.9.5',
185185
};
186186

@@ -264,7 +264,6 @@ class Client {
264264
* @return {this}
265265
*/
266266
setProject(value: string): this {
267-
this.headers['X-Appwrite-Project'] = value;
268267
this.config.project = value;
269268
return this;
270269
}
@@ -677,7 +676,9 @@ class Client {
677676
}
678677

679678
async ping(): Promise<unknown> {
680-
return this.call('GET', new URL(this.config.endpoint + '/ping'));
679+
return this.call('GET', new URL(this.config.endpoint + '/ping'), {
680+
'X-Appwrite-Project': this.config.project,
681+
});
681682
}
682683

683684
async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {
@@ -762,7 +763,12 @@ class Client {
762763
}
763764

764765
if (data && typeof data === 'object') {
765-
data.toString = () => JSONbig.stringify(data);
766+
Object.defineProperty(data, 'toString', {
767+
value: () => JSONbig.stringify(data),
768+
writable: true,
769+
enumerable: false,
770+
configurable: true,
771+
});
766772
}
767773

768774
return data;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export enum Theme {
1+
export enum BrowserTheme {
22
Light = 'light',
33
Dark = 'dark',
44
}

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export { OAuthProvider } from './enums/o-auth-provider';
2626
export { Browser } from './enums/browser';
2727
export { CreditCard } from './enums/credit-card';
2828
export { Flag } from './enums/flag';
29-
export { Theme } from './enums/theme';
29+
export { BrowserTheme } from './enums/browser-theme';
3030
export { Timezone } from './enums/timezone';
3131
export { BrowserPermission } from './enums/browser-permission';
3232
export { ImageFormat } from './enums/image-format';

src/models.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export namespace Models {
3636
/**
3737
* Presences List
3838
*/
39-
export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = {
39+
export type PresenceList = {
4040
/**
4141
* Total number of presences that matched your query.
4242
*/
@@ -357,13 +357,12 @@ export namespace Models {
357357
* Presence expiry date in ISO 8601 format.
358358
*/
359359
expiresAt?: string;
360+
/**
361+
* Presence metadata.
362+
*/
363+
metadata?: object;
360364
}
361365

362-
export type DefaultPresence = Presence & {
363-
[key: string]: any;
364-
[__default]: true;
365-
};
366-
367366
/**
368367
* Log
369368
*/
@@ -518,6 +517,26 @@ export namespace Models {
518517
* Email verification status.
519518
*/
520519
emailVerification: boolean;
520+
/**
521+
* Canonical form of the user email address.
522+
*/
523+
emailCanonical?: string;
524+
/**
525+
* Whether the user email is from a free email provider.
526+
*/
527+
emailIsFree?: boolean;
528+
/**
529+
* Whether the user email is from a disposable email provider.
530+
*/
531+
emailIsDisposable?: boolean;
532+
/**
533+
* Whether the user email is from a corporate domain.
534+
*/
535+
emailIsCorporate?: boolean;
536+
/**
537+
* Whether the user email is in its canonical form.
538+
*/
539+
emailIsCanonical?: boolean;
521540
/**
522541
* Phone verification status.
523542
*/
@@ -1073,6 +1092,10 @@ export namespace Models {
10731092
* Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console.
10741093
*/
10751094
mfa: boolean;
1095+
/**
1096+
* Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console.
1097+
*/
1098+
userAccessedAt: string;
10761099
/**
10771100
* User list of roles
10781101
*/

0 commit comments

Comments
 (0)