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

## 19.0.0

* Breaking: removed the `Assistant` service (`assistant.chat`) and `_APP_ASSISTANT_ENABLED` from `ConsoleVariables`
* Breaking: `waf.getRule` and `waf.listRules` return the action-specific rule models (`WafRuleBypass`, `WafRuleChallenge`, `WafRuleDeny`, `WafRuleRateLimit`, `WafRuleRedirect`); `WafRule` is removed
* Breaking: removed the `deno-1.21`, `deno-1.24` and `deno-1.35` runtimes from `Runtime` and `BuildRuntime`
* Updated: `X-Appwrite-Response-Format` is now `2.4.0`
* Updated: missing fields in API responses are filled with their documented defaults
* Added: `Analytics` service: `listProperties`, `createProperty`, `getProperty`, `updateProperty`, `deleteProperty`, `createEvent` and `listMetrics`, with `AnalyticsDimension` and `AnalyticsInterval` enums
* Added: `Tracking` helper that auto-tracks pageviews, outbound links, downloads, scroll depth and engagement time
* Added: `admin` threat methods `listThreats`, `createThreat`, `getThreat`, `deleteThreat` and `updateThreatStatus`
* Added: `admin` cache methods `deletePlatformCache`, `deletePlatformResourceCache`, `deleteProjectCache` and `deleteProjectResourceCache`
* Added: `project.updatePasswordRotationPolicy` and the `PolicyPasswordRotation` model
* Added: optional `state` on `account.createOAuth2Session` and `account.createOAuth2Token`
* Added: optional `fingerprints` on `project.createAndroidPlatform` and `project.updateAndroidPlatform`, and on `PlatformAndroid`
* Added: optional `membershipId` on `teams.createMembership`
* Added: `project.listEnvironments`, `createEnvironment`, `getEnvironment`, `updateEnvironment` and `deleteEnvironment`, with `parentId` on `Project` and `environments` on `BillingPlan`
* Added: `trigram` in `DatabasesIndexType` and `TablesDBIndexType`, and `supportForTrigramIndex` on `ConsoleVariables`
* Added: the package ships the spec it was generated from as `spec.json`, exported as `@appwrite.io/console/spec.json`
* Added: `analytics.read` and `analytics.write` key scopes, analytics usage metrics, and `avatarsStorageTotal` on `UsageOrganization`

## 18.4.1

* Fixed: added `ProjectAuthMethodId.Passkey`, so `project.updateAuthMethod` can enable passkeys
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Console SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.3.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.4.0-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)

**This SDK targets Appwrite server version latest as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.
**This SDK targets Appwrite server version 2.4.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.

Appwrite is an open-source backend as a service server that abstracts and simplifies 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 Console 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)

Expand All @@ -33,7 +33,7 @@ import { Client, Account } from '@appwrite.io/console';
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@18.4.1"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@19.0.0"></script>
```

## Getting Started
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
});
```
24 changes: 24 additions & 0 deletions docs/examples/admin/create-threat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```javascript
import {
Client,
Admin,
ThreatResourceType,
ThreatStatus,
} from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.createThreat({
projectId: '<PROJECT_ID>',
resourceType: ThreatResourceType.Projects,
resourceId: '<RESOURCE_ID>',
description: '<DESCRIPTION>', // optional
status: ThreatStatus.Open, // optional
});

console.log(result);
```
13 changes: 13 additions & 0 deletions docs/examples/admin/delete-platform-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```javascript
import { Client, Admin } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.deletePlatformCache();

console.log(result);
```
16 changes: 16 additions & 0 deletions docs/examples/admin/delete-platform-resource-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Admin, PlatformResourceType } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.deletePlatformResourceCache({
resourceType: PlatformResourceType.Projects,
resourceId: '<RESOURCE_ID>', // optional
});

console.log(result);
```
15 changes: 15 additions & 0 deletions docs/examples/admin/delete-project-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Admin } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.deleteProjectCache({
projectId: '<PROJECT_ID>',
});

console.log(result);
```
17 changes: 17 additions & 0 deletions docs/examples/admin/delete-project-resource-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Admin, ProjectResourceType } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.deleteProjectResourceCache({
projectId: '<PROJECT_ID>',
resourceType: ProjectResourceType.Users,
resourceId: '<RESOURCE_ID>', // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
```javascript
import { Client, Assistant } from '@appwrite.io/console';
import { Client, Admin } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const assistant = new Assistant(client);
const admin = new Admin(client);

const result = await assistant.chat({
prompt: '<PROMPT>',
const result = await admin.deleteThreat({
threatId: '<THREAT_ID>',
});

console.log(result);
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/admin/get-threat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Admin } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.getThreat({
threatId: '<THREAT_ID>',
});

console.log(result);
```
16 changes: 16 additions & 0 deletions docs/examples/admin/list-threats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Admin } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

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

console.log(result);
```
16 changes: 16 additions & 0 deletions docs/examples/admin/update-threat-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Admin, ThreatStatus } from '@appwrite.io/console';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const admin = new Admin(client);

const result = await admin.updateThreatStatus({
threatId: '<THREAT_ID>',
status: ThreatStatus.Open,
});

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 '@appwrite.io/console';

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);
```
19 changes: 19 additions & 0 deletions docs/examples/analytics/create-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```javascript
import { Client, Analytics } from '@appwrite.io/console';

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.createProperty({
propertyId: '<PROPERTY_ID>',
name: '<NAME>',
domain: '<DOMAIN>', // optional
enabled: false, // optional
allowedOrigins: [], // optional
});

console.log(result);
```
15 changes: 15 additions & 0 deletions docs/examples/analytics/delete-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Analytics } from '@appwrite.io/console';

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.deleteProperty({
propertyId: '<PROPERTY_ID>',
});

console.log(result);
```
15 changes: 15 additions & 0 deletions docs/examples/analytics/get-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, Analytics } from '@appwrite.io/console';

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.getProperty({
propertyId: '<PROPERTY_ID>',
});

console.log(result);
```
27 changes: 27 additions & 0 deletions docs/examples/analytics/list-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```javascript
import {
Client,
Analytics,
AnalyticsInterval,
AnalyticsDimension,
} from '@appwrite.io/console';

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.listMetrics({
propertyId: '<PROPERTY_ID>',
queries: [], // optional
interval: AnalyticsInterval.OneHour, // optional
dimensions: [AnalyticsDimension.Country], // optional
dateRange: '<DATE_RANGE>', // optional
startAt: '2020-10-15T06:38:00.000+00:00', // optional
endAt: '2020-10-15T06:38:00.000+00:00', // optional
limit: 1, // optional
});

console.log(result);
```
17 changes: 17 additions & 0 deletions docs/examples/analytics/list-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Analytics } from '@appwrite.io/console';

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.listProperties({
queries: [], // optional
search: '<SEARCH>', // optional
total: false, // optional
});

console.log(result);
```
19 changes: 19 additions & 0 deletions docs/examples/analytics/update-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```javascript
import { Client, Analytics } from '@appwrite.io/console';

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.updateProperty({
propertyId: '<PROPERTY_ID>',
name: '<NAME>', // optional
domain: '<DOMAIN>', // optional
enabled: false, // optional
allowedOrigins: [], // optional
});

console.log(result);
```
2 changes: 1 addition & 1 deletion docs/examples/oauth2/authorize-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const result = await oauth2.authorizePost({
prompt: '<PROMPT>', // optional
maxAge: 0, // optional
authorizationDetails: '<AUTHORIZATION_DETAILS>', // optional
resource: '', // optional
resource: [], // optional
audience: '<AUDIENCE>', // optional
requestUri: '<REQUEST_URI>', // optional
});
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/oauth2/authorize.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const result = await oauth2.authorize({
prompt: '<PROMPT>', // optional
maxAge: 0, // optional
authorizationDetails: '<AUTHORIZATION_DETAILS>', // optional
resource: '', // optional
resource: [], // optional
audience: '<AUDIENCE>', // optional
requestUri: '<REQUEST_URI>', // optional
});
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/oauth2/create-device-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await oauth2.createDeviceAuthorization({
clientId: '<CLIENT_ID>', // optional
scope: '<SCOPE>', // optional
authorizationDetails: '<AUTHORIZATION_DETAILS>', // optional
resource: '', // optional
resource: [], // optional
audience: '<AUDIENCE>', // optional
});

Expand Down
Loading