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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change log

## 0.32.0

* Breaking: Renamed `Theme` enum to `BrowserTheme`.
* Breaking: Removed `Models.DefaultPresence` and dropped the `Presence` generic from `presences` methods.
* Added: Email metadata fields to `User`, plus `Membership.userAccessedAt` and `Presence.metadata`.
* Updated: Requests now send an explicit `accept` header matching each endpoint's response type.

## 0.30.1

* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const account = new Account(client);

const result = await account.updatePassword({
password: '',
oldPassword: 'password' // optional
oldPassword: '<OLD_PASSWORD>' // optional
});

console.log(result);
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "react-native-appwrite";
import { Client, Avatars, BrowserTheme, Timezone, BrowserPermission, ImageFormat } from "react-native-appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -16,7 +16,7 @@ const result = avatars.getScreenshot({
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: Theme.Dark, // optional
theme: BrowserTheme.Dark, // optional
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
fullpage: true, // optional
locale: 'en-US', // optional
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
"version": "0.31.0",
"version": "0.32.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
14 changes: 10 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '0.31.0',
'x-sdk-version': '0.32.0',
'X-Appwrite-Response-Format': '1.9.5',
};

Expand Down Expand Up @@ -264,7 +264,6 @@ class Client {
* @return {this}
*/
setProject(value: string): this {
this.headers['X-Appwrite-Project'] = value;
this.config.project = value;
return this;
}
Expand Down Expand Up @@ -677,7 +676,9 @@ class Client {
}

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

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

if (data && typeof data === 'object') {
data.toString = () => JSONbig.stringify(data);
Object.defineProperty(data, 'toString', {
value: () => JSONbig.stringify(data),
writable: true,
enumerable: false,
configurable: true,
});
}

return data;
Expand Down
2 changes: 1 addition & 1 deletion src/enums/theme.ts → src/enums/browser-theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Theme {
export enum BrowserTheme {
Light = 'light',
Dark = 'dark',
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export { OAuthProvider } from './enums/o-auth-provider';
export { Browser } from './enums/browser';
export { CreditCard } from './enums/credit-card';
export { Flag } from './enums/flag';
export { Theme } from './enums/theme';
export { BrowserTheme } from './enums/browser-theme';
export { Timezone } from './enums/timezone';
export { BrowserPermission } from './enums/browser-permission';
export { ImageFormat } from './enums/image-format';
Expand Down
35 changes: 29 additions & 6 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export namespace Models {
/**
* Presences List
*/
export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = {
export type PresenceList = {
/**
* Total number of presences that matched your query.
*/
Expand Down Expand Up @@ -357,13 +357,12 @@ export namespace Models {
* Presence expiry date in ISO 8601 format.
*/
expiresAt?: string;
/**
* Presence metadata.
*/
metadata?: object;
}

export type DefaultPresence = Presence & {
[key: string]: any;
[__default]: true;
};

/**
* Log
*/
Expand Down Expand Up @@ -518,6 +517,26 @@ export namespace Models {
* Email verification status.
*/
emailVerification: boolean;
/**
* Canonical form of the user email address.
*/
emailCanonical?: string;
/**
* Whether the user email is from a free email provider.
*/
emailIsFree?: boolean;
/**
* Whether the user email is from a disposable email provider.
*/
emailIsDisposable?: boolean;
/**
* Whether the user email is from a corporate domain.
*/
emailIsCorporate?: boolean;
/**
* Whether the user email is in its canonical form.
*/
emailIsCanonical?: boolean;
/**
* Phone verification status.
*/
Expand Down Expand Up @@ -1073,6 +1092,10 @@ export namespace Models {
* Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console.
*/
mfa: boolean;
/**
* Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console.
*/
userAccessedAt: string;
/**
* User list of roles
*/
Expand Down
Loading