Skip to content
Closed
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log


## 18.3.0-rc.3

* Added: `Tracking` helper (was `AnalyticsTracking`) — construct it with the `Analytics` service and call `start()` to turn on the built-in events
* Changed: `Tracking` takes `new Analytics(client)` and a property id instead of an emitter callback; the adapter to `createEvent` now lives inside the SDK
* Changed: `enableAllAutoTracking()` is now `start()`
* Removed: `AnalyticsEventEmitter`; the option types are now `TrackingEventOptions` and `TrackingOptions`

## 18.2.0

* Added: `Avatars.updatePhoto` and `Avatars.deletePhoto` to upload and remove the current user's profile photo; `updatePhoto` returns the new `Account` model
Expand Down Expand Up @@ -543,3 +551,4 @@ Fix bigint and float parsing in SDK.

* Adds support for `databasesReadsTotal` and `databasesWritesTotal` attributes


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![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.3.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.2.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@18.3.0-rc.3"></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
});
```
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);
```
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.deleteProjectCache({
projectId: '<PROJECT_ID>',
});

console.log(result);
Expand Down
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);
```
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);
```
21 changes: 21 additions & 0 deletions docs/examples/analytics/create-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```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
timezone: '<TIMEZONE>', // optional
enabled: false, // optional
xpublic: 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);
```
21 changes: 21 additions & 0 deletions docs/examples/analytics/update-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```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
timezone: '<TIMEZONE>', // optional
enabled: false, // optional
xpublic: false, // optional
allowedOrigins: [], // optional
});

console.log(result);
```
2 changes: 1 addition & 1 deletion docs/examples/usage/list-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const client = new Client()
const usage = new Usage(client);

const result = await usage.listEvents({
metrics: [UsageEventMetric.NetworkRequests],
metrics: [UsageEventMetric.AnalyticsEvents],
queries: [], // optional
interval: UsageInterval.OneMinute, // optional
dimensions: [UsageEventDimension.Path], // optional
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/usage/list-gauges.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const client = new Client()
const usage = new Usage(client);

const result = await usage.listGauges({
metrics: [UsageGaugeMetric.Teams],
metrics: [UsageGaugeMetric.AnalyticsProperties],
queries: [], // optional
interval: UsageInterval.OneMinute, // optional
dimensions: [UsageGaugeDimension.ResourceId], // 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": "@appwrite.io/console",
"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": "18.2.0",
"version": "18.3.0-rc.3",
"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 @@ -413,7 +413,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '18.2.0',
'x-sdk-version': '18.3.0-rc.3',
'X-Appwrite-Response-Format': '2.3.0',
};

Expand Down
24 changes: 24 additions & 0 deletions src/enums/analytics-dimension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export enum AnalyticsDimension {
Country = 'country',
Region = 'region',
City = 'city',
Browser = 'browser',
OperatingSystem = 'operatingSystem',
Device = 'device',
ScreenSize = 'screenSize',
ReferrerSource = 'referrerSource',
Channel = 'channel',
UtmSource = 'utmSource',
UtmMedium = 'utmMedium',
UtmCampaign = 'utmCampaign',
UtmContent = 'utmContent',
UtmTerm = 'utmTerm',
Page = 'page',
Hostname = 'hostname',
EntryPage = 'entryPage',
ExitPage = 'exitPage',
TrafficType = 'trafficType',
BotName = 'botName',
BotCategory = 'botCategory',
EventName = 'eventName',
}
6 changes: 6 additions & 0 deletions src/enums/analytics-interval.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum AnalyticsInterval {
OneHour = '1h',
OneDay = '1d',
OneWeek = '1w',
OneMonth = '1m',
}
11 changes: 11 additions & 0 deletions src/enums/platform-resource-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export enum PlatformResourceType {
Projects = 'projects',
Organizations = 'organizations',
Users = 'users',
Memberships = 'memberships',
Rules = 'rules',
Keys = 'keys',
Platforms = 'platforms',
Webhooks = 'webhooks',
Certificates = 'certificates',
}
2 changes: 2 additions & 0 deletions src/enums/project-key-scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@ export enum ProjectKeyScopes {
Oauth2Read = 'oauth2.read',
Oauth2Write = 'oauth2.write',
Oauth2Introspect = 'oauth2.introspect',
AnalyticsRead = 'analytics.read',
AnalyticsWrite = 'analytics.write',
}
13 changes: 13 additions & 0 deletions src/enums/project-resource-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum ProjectResourceType {
Users = 'users',
Teams = 'teams',
Memberships = 'memberships',
Databases = 'databases',
Buckets = 'buckets',
Functions = 'functions',
Sites = 'sites',
Deployments = 'deployments',
Topics = 'topics',
Providers = 'providers',
Messages = 'messages',
}
1 change: 1 addition & 0 deletions src/enums/proxy-rule-deployment-resource-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum ProxyRuleDeploymentResourceType {
Function = 'function',
Site = 'site',
DedicatedDatabase = 'dedicatedDatabase',
}
1 change: 1 addition & 0 deletions src/enums/query-suggestion-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export enum QuerySuggestionResource {
ResourceTokens = 'resourcetokens',
Transactions = 'transactions',
TransactionLogs = 'transactionlogs',
AnalyticsProperties = 'analyticsproperties',
DedicatedDatabases = 'dedicateddatabases',
DedicatedDatabaseConfigs = 'dedicateddatabaseconfigs',
DedicatedDatabaseRuntimes = 'dedicateddatabaseruntimes',
Expand Down
Loading
Loading