Skip to content

Commit

Permalink
Add new push message parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Dec 10, 2024
1 parent 7a2418c commit 3dbec65
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Node.js SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.1-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)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ const result = await databases.updateStringAttribute(
'', // key
false, // required
'<DEFAULT>', // default
null, // size (optional)
1, // size (optional)
'' // newKey (optional)
);
11 changes: 7 additions & 4 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const messaging = new sdk.Messaging(client);

const result = await messaging.createPush(
'<MESSAGE_ID>', // messageId
'<TITLE>', // title
'<BODY>', // body
'<TITLE>', // title (optional)
'<BODY>', // body (optional)
[], // topics (optional)
[], // users (optional)
[], // targets (optional)
Expand All @@ -21,7 +21,10 @@ const result = await messaging.createPush(
'<SOUND>', // sound (optional)
'<COLOR>', // color (optional)
'<TAG>', // tag (optional)
'<BADGE>', // badge (optional)
null, // badge (optional)
false, // draft (optional)
'' // scheduledAt (optional)
'', // scheduledAt (optional)
false, // contentAvailable (optional)
false, // critical (optional)
sdk.MessagePriority.Normal // priority (optional)
);
5 changes: 4 additions & 1 deletion docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ const result = await messaging.updatePush(
'<TAG>', // tag (optional)
null, // badge (optional)
false, // draft (optional)
'' // scheduledAt (optional)
'', // scheduledAt (optional)
false, // contentAvailable (optional)
false, // critical (optional)
sdk.MessagePriority.Normal // priority (optional)
);
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": "node-appwrite",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "14.1.0",
"version": "14.2.0",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
8 changes: 6 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AppwriteException extends Error {
}

function getUserAgent() {
let ua = 'AppwriteNodeJSSDK/14.1.0';
let ua = 'AppwriteNodeJSSDK/14.2.0';

// `process` is a global in Node.js, but not fully available in all runtimes.
const platform: string[] = [];
Expand Down Expand Up @@ -82,7 +82,7 @@ class Client {
'x-sdk-name': 'Node.js',
'x-sdk-platform': 'server',
'x-sdk-language': 'nodejs',
'x-sdk-version': '14.1.0',
'x-sdk-version': '14.2.0',
'user-agent' : getUserAgent(),
'X-Appwrite-Response-Format': '1.6.0',
};
Expand Down Expand Up @@ -305,6 +305,10 @@ class Client {
return response;
}

async ping(): Promise<string> {
return this.call('GET', new URL(this.config.endpoint + '/ping'));
}

async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {
const { uri, options } = this.prepareRequest(method, url, headers, params);

Expand Down
1 change: 1 addition & 0 deletions src/enums/image-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export enum ImageFormat {
Gif = 'gif',
Png = 'png',
Webp = 'webp',
Avif = 'avif',
}
4 changes: 4 additions & 0 deletions src/enums/message-priority.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum MessagePriority {
Normal = 'normal',
High = 'high',
}
15 changes: 14 additions & 1 deletion src/enums/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum Runtime {
Node190 = 'node-19.0',
Node200 = 'node-20.0',
Node210 = 'node-21.0',
Node22 = 'node-22',
Php80 = 'php-8.0',
Php81 = 'php-8.1',
Php82 = 'php-8.2',
Expand All @@ -19,30 +20,42 @@ export enum Runtime {
Python311 = 'python-3.11',
Python312 = 'python-3.12',
Pythonml311 = 'python-ml-3.11',
Deno121 = 'deno-1.21',
Deno124 = 'deno-1.24',
Deno135 = 'deno-1.35',
Deno140 = 'deno-1.40',
Deno146 = 'deno-1.46',
Deno20 = 'deno-2.0',
Dart215 = 'dart-2.15',
Dart216 = 'dart-2.16',
Dart217 = 'dart-2.17',
Dart218 = 'dart-2.18',
Dart30 = 'dart-3.0',
Dart31 = 'dart-3.1',
Dart33 = 'dart-3.3',
Dotnet31 = 'dotnet-3.1',
Dart35 = 'dart-3.5',
Dotnet60 = 'dotnet-6.0',
Dotnet70 = 'dotnet-7.0',
Dotnet80 = 'dotnet-8.0',
Java80 = 'java-8.0',
Java110 = 'java-11.0',
Java170 = 'java-17.0',
Java180 = 'java-18.0',
Java210 = 'java-21.0',
Java22 = 'java-22',
Swift55 = 'swift-5.5',
Swift58 = 'swift-5.8',
Swift59 = 'swift-5.9',
Swift510 = 'swift-5.10',
Kotlin16 = 'kotlin-1.6',
Kotlin18 = 'kotlin-1.8',
Kotlin19 = 'kotlin-1.9',
Kotlin20 = 'kotlin-2.0',
Cpp17 = 'cpp-17',
Cpp20 = 'cpp-20',
Bun10 = 'bun-1.0',
Bun11 = 'bun-1.1',
Go123 = 'go-1.23',
Static1 = 'static-1',
Flutter324 = 'flutter-3.24',
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export { IndexType } from './enums/index-type';
export { Runtime } from './enums/runtime';
export { ExecutionMethod } from './enums/execution-method';
export { Name } from './enums/name';
export { MessagePriority } from './enums/message-priority';
export { SmtpEncryption } from './enums/smtp-encryption';
export { Compression } from './enums/compression';
export { ImageGravity } from './enums/image-gravity';
Expand Down
100 changes: 96 additions & 4 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Attribute size.
*/
Expand Down Expand Up @@ -527,6 +535,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Minimum value to enforce for new documents.
*/
Expand Down Expand Up @@ -568,6 +584,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Minimum value to enforce for new documents.
*/
Expand Down Expand Up @@ -609,6 +633,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Default value for attribute when not provided. Cannot be set when attribute is required.
*/
Expand Down Expand Up @@ -642,6 +674,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* String format.
*/
Expand Down Expand Up @@ -679,6 +719,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Array of elements in enumerated type.
*/
Expand Down Expand Up @@ -720,6 +768,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* String format.
*/
Expand Down Expand Up @@ -757,6 +813,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* String format.
*/
Expand Down Expand Up @@ -794,6 +858,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* ISO 8601 format.
*/
Expand Down Expand Up @@ -831,6 +903,14 @@ export namespace Models {
* Is attribute an array?
*/
array?: boolean;
/**
* Attribute creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Attribute update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* The ID of the related collection.
*/
Expand Down Expand Up @@ -884,6 +964,14 @@ export namespace Models {
* Index orders.
*/
orders?: string[];
/**
* Index creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Index update date in ISO 8601 format.
*/
$updatedAt: string;
}
/**
* Document
Expand Down Expand Up @@ -1596,11 +1684,11 @@ export namespace Models {
*/
userId: string;
/**
* User name.
* User name. Hide this attribute by toggling membership privacy in the Console.
*/
userName: string;
/**
* User email address.
* User email address. Hide this attribute by toggling membership privacy in the Console.
*/
userEmail: string;
/**
Expand All @@ -1624,7 +1712,7 @@ export namespace Models {
*/
confirm: boolean;
/**
* Multi factor authentication status, true if the user has MFA enabled or false otherwise.
* 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;
/**
Expand Down Expand Up @@ -1689,7 +1777,7 @@ export namespace Models {
*/
events: string[];
/**
* Function execution schedult in CRON format.
* Function execution schedule in CRON format.
*/
schedule: string;
/**
Expand Down Expand Up @@ -2506,5 +2594,9 @@ export namespace Models {
* The target identifier.
*/
identifier: string;
/**
* Is the target expired.
*/
expired: boolean;
}
}
Loading

0 comments on commit 3dbec65

Please sign in to comment.