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

## 1.3.0

* Added: `analytics.createEvent` in a new `Analytics` service to send tracking events
* Added: `avatars.updatePhoto` and `avatars.deletePhoto` to manage the user's custom profile photo, and the `Account` model
* Added: `Webflow` to the `OAuthProvider` enum
* Added: optional `state` on `account.createOAuth2Session` and `account.createOAuth2Token`, returned unchanged on the success and failure URLs
* Added: optional `duration` on `account.createEmailPasswordSession` to set the session length
* Added: optional `current` on `account.deleteSessions` to keep the current session signed in
* Added: optional `membershipId` on `teams.createMembership`
* Added: optional `total` on `account.listSessions`, the `locale` list methods and `listTransactions`

## 1.2.0

* Added: `account` passkey methods `listPasskeys`, `createPasskey`, `getPasskey`, `updatePasskey`, `deletePasskey` and `updatePasskeyVerification`
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const account = new Account(client);
const result = await account.createEmailPasswordSession({
email: 'email@example.com',
password: 'password',
duration: 60, // optional
});

console.log(result);
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-o-auth-2-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ account.createOAuth2Session({
success: 'https://example.com', // optional
failure: 'https://example.com', // optional
scopes: [], // optional
state: '<STATE>', // optional
});
```
1 change: 1 addition & 0 deletions docs/examples/account/create-o-auth-2-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ account.createOAuth2Token({
success: 'https://example.com', // optional
failure: 'https://example.com', // optional
scopes: [], // optional
state: '<STATE>', // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/account/delete-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const account = new Account(client);

const result = await account.deleteSessions();
const result = await account.deleteSessions({
current: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/account/list-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const account = new Account(client);

const result = await account.listSessions();
const result = await account.listSessions({
total: false, // optional
});

console.log(result);
```
27 changes: 27 additions & 0 deletions docs/examples/analytics/create-event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```javascript
import { Client, Analytics } 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

const analytics = new Analytics(client);

const result = await analytics.createEvent({
propertyId: '<PROPERTY_ID>',
name: '<NAME>',
url: 'https://example.com',
domain: '<DOMAIN>', // optional
referrer: '<REFERRER>', // optional
screenWidth: null, // optional
sessionHash: '<SESSION_HASH>', // optional
scrollDepth: 0, // optional
engagementTime: 0, // optional
props: [], // optional
userId: '<USER_ID>', // optional
ip: '<IP>', // optional
userAgent: '<USER_AGENT>', // optional
});

console.log(result);
```
13 changes: 13 additions & 0 deletions docs/examples/avatars/delete-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```javascript
import { Client, Avatars } 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

const avatars = new Avatars(client);

const result = await avatars.deletePhoto();

console.log(result);
```
20 changes: 20 additions & 0 deletions docs/examples/avatars/update-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
import { Client, Avatars } 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

const avatars = new Avatars(client);

const result = await avatars.updatePhoto({
file: {
name: 'image.png',
type: 'image/png',
size: 1024,
uri: 'file:///path/to/image.png',
},
});

console.log(result);
```
1 change: 1 addition & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const databases = new Databases(client);

const result = await databases.listTransactions({
queries: [], // optional
total: false, // optional
});

console.log(result);
Expand Down
1 change: 1 addition & 0 deletions docs/examples/documentsdb/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const documentsDB = new DocumentsDB(client);

const result = await documentsDB.listTransactions({
queries: [], // optional
total: false, // optional
});

console.log(result);
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/locale/list-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listCodes();
const result = await locale.listCodes({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-continents.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listContinents();
const result = await locale.listContinents({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries-eu.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listCountriesEU();
const result = await locale.listCountriesEU({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries-phones.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listCountriesPhones();
const result = await locale.listCountriesPhones({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listCountries();
const result = await locale.listCountries({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-currencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listCurrencies();
const result = await locale.listCurrencies({
total: false, // optional
});

console.log(result);
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const client = new Client()

const locale = new Locale(client);

const result = await locale.listLanguages();
const result = await locale.listLanguages({
total: false, // optional
});

console.log(result);
```
1 change: 1 addition & 0 deletions docs/examples/tablesdb/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const tablesDB = new TablesDB(client);

const result = await tablesDB.listTransactions({
queries: [], // optional
total: false, // optional
});

console.log(result);
Expand Down
1 change: 1 addition & 0 deletions docs/examples/teams/create-membership.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const result = await teams.createMembership({
phone: '+12065550100', // optional
url: 'https://example.com', // optional
name: '<NAME>', // optional
membershipId: '<MEMBERSHIP_ID>', // optional
});

console.log(result);
Expand Down
1 change: 1 addition & 0 deletions docs/examples/vectorsdb/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const vectorsDB = new VectorsDB(client);

const result = await vectorsDB.listTransactions({
queries: [], // optional
total: false, // optional
});

console.log(result);
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": "1.2.0",
"version": "1.3.0",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '1.2.0',
'x-sdk-version': '1.3.0',
'X-Appwrite-Response-Format': '2.3.0',
};

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 @@ -41,6 +41,7 @@ export enum OAuthProvider {
Tradeshift = 'tradeshift',
TradeshiftBox = 'tradeshiftBox',
Twitch = 'twitch',
Webflow = 'webflow',
Wordpress = 'wordpress',
X = 'x',
Yahoo = 'yahoo',
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { Client, AppwriteException } from './client';
export { Account } from './services/account';
export { Analytics } from './services/analytics';
export { Avatars } from './services/avatars';
export { Databases } from './services/databases';
export { DocumentsDB } from './services/documents-db';
Expand Down
104 changes: 104 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,110 @@ export namespace Models {
threads: number;
};

/**
* Account
*/
export type Account<
Preferences extends Models.Preferences = Models.DefaultPreferences,
> = {
/**
* User ID.
*/
$id: string;
/**
* User creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* User update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* User name.
*/
name: string;
/**
* User registration date in ISO 8601 format.
*/
registration: string;
/**
* User status. Pass `true` for enabled and `false` for disabled.
*/
status: boolean;
/**
* Labels for the user.
*/
labels: string[];
/**
* Password update time in ISO 8601 format.
*/
passwordUpdate: string;
/**
* User email address.
*/
email: string;
/**
* User phone number in E.164 format.
*/
phone: string;
/**
* 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;
/**
* Whether the password was found in a known data breach the last time it was checked. Null when the password has never been checked.
*/
passwordPwned?: boolean;
/**
* Phone verification status.
*/
phoneVerification: boolean;
/**
* Multi factor authentication status.
*/
mfa: boolean;
/**
* User preferences as a key-value object
*/
prefs: Preferences;
/**
* A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider.
*/
targets: Target[];
/**
* Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours.
*/
accessedAt: string;
/**
* Whether the user can impersonate other users.
*/
impersonator?: boolean;
/**
* ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data.
*/
impersonatorUserId?: string;
};

/**
* Preferences
*/
Expand Down
Loading
Loading