Skip to content

Dev #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 17, 2025
Merged

Dev #26

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 .github/workflows/autoclose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Auto-close External Pull Requests

on:
pull_request_target:
types: [opened, reopened]

jobs:
auto_close:
uses: appwrite/.github/.github/workflows/autoclose.yml@main
secrets:
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite Deno SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.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.2-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
3 changes: 2 additions & 1 deletion docs/examples/databases/update-boolean-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const response = await databases.updateBooleanAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
false // default
false, // default
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-datetime-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const response = await databases.updateDatetimeAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
'' // default
'', // default
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-email-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const response = await databases.updateEmailAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
'email@example.com' // default
'email@example.com', // default
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-enum-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ const response = await databases.updateEnumAttribute(
'', // key
[], // elements
false, // required
'<DEFAULT>' // default
'<DEFAULT>', // default
'' // newKey (optional)
);
7 changes: 4 additions & 3 deletions docs/examples/databases/update-float-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const response = await databases.updateFloatAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
null, // min
null, // max
null // default
null, // default
null, // min (optional)
null, // max (optional)
'' // newKey (optional)
);
7 changes: 4 additions & 3 deletions docs/examples/databases/update-integer-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const response = await databases.updateIntegerAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
null, // min
null, // max
null // default
null, // default
null, // min (optional)
null, // max (optional)
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-ip-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const response = await databases.updateIpAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
'' // default
'', // default
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-relationship-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ const response = await databases.updateRelationshipAttribute(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'', // key
RelationMutate.Cascade // onDelete (optional)
RelationMutate.Cascade, // onDelete (optional)
'' // newKey (optional)
);
4 changes: 3 additions & 1 deletion docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ const response = await databases.updateStringAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
'<DEFAULT>' // default
'<DEFAULT>', // default
1, // size (optional)
'' // newKey (optional)
);
3 changes: 2 additions & 1 deletion docs/examples/databases/update-url-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const response = await databases.updateUrlAttribute(
'<COLLECTION_ID>', // collectionId
'', // key
false, // required
'https://example.com' // default
'https://example.com', // default
'' // newKey (optional)
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const health = new Health(client);

const response = await health.getQueueUsageDump(
const response = await health.getQueueStatsResources(
null // threshold (optional)
);
10 changes: 0 additions & 10 deletions docs/examples/health/get-queue.md

This file was deleted.

13 changes: 8 additions & 5 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts";
import { Client, Messaging, MessagePriority } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -9,8 +9,8 @@ const messaging = new Messaging(client);

const response = 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 response = 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)
MessagePriority.Normal // priority (optional)
);
7 changes: 5 additions & 2 deletions docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts";
import { Client, Messaging, MessagePriority } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -23,5 +23,8 @@ const response = await messaging.updatePush(
'<TAG>', // tag (optional)
null, // badge (optional)
false, // draft (optional)
'' // scheduledAt (optional)
'', // scheduledAt (optional)
false, // contentAvailable (optional)
false, // critical (optional)
MessagePriority.Normal // priority (optional)
);
2 changes: 2 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { IndexType } from "./src/enums/index-type.ts";
import { Runtime } from "./src/enums/runtime.ts";
import { ExecutionMethod } from "./src/enums/execution-method.ts";
import { Name } from "./src/enums/name.ts";
import { MessagePriority } from "./src/enums/message-priority.ts";
import { SmtpEncryption } from "./src/enums/smtp-encryption.ts";
import { Compression } from "./src/enums/compression.ts";
import { ImageGravity } from "./src/enums/image-gravity.ts";
Expand Down Expand Up @@ -66,6 +67,7 @@ export {
Runtime,
ExecutionMethod,
Name,
MessagePriority,
SmtpEncryption,
Compression,
ImageGravity,
Expand Down
11 changes: 7 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class Client {
endpoint: string = 'https://cloud.appwrite.io/v1';
headers: Payload = {
'content-type': '',
'user-agent' : `AppwriteDenoSDK/12.0.0 (${Deno.build.os}; ${Deno.build.arch})`,
'user-agent' : `AppwriteDenoSDK/14.0.0 (${Deno.build.os}; ${Deno.build.arch})`,
'x-sdk-name': 'Deno',
'x-sdk-platform': 'server',
'x-sdk-language': 'deno',
'x-sdk-version': '12.0.0',
'x-sdk-version': '14.0.0',
'X-Appwrite-Response-Format':'1.6.0',
};

Expand Down Expand Up @@ -113,8 +113,11 @@ export class Client {
* @return this
*/
setEndpoint(endpoint: string): this {
this.endpoint = endpoint;
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
}

this.endpoint = endpoint;
return this;
}

Expand Down Expand Up @@ -180,7 +183,7 @@ export class Client {
} catch (error) {
throw new AppwriteException(text, response.status, "", text);
}
throw new AppwriteException(json.message, json.code, json.type, json);
throw new AppwriteException(json.message, json.code, json.type, text);
}

if (responseType === "arraybuffer") {
Expand Down
1 change: 1 addition & 0 deletions src/enums/credit-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export enum CreditCard {
Visa = 'visa',
MIR = 'mir',
Maestro = 'maestro',
Rupay = 'rupay',
}
2 changes: 2 additions & 0 deletions src/enums/image-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export enum ImageFormat {
Gif = 'gif',
Png = 'png',
Webp = 'webp',
Heic = 'heic',
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',
}
4 changes: 2 additions & 2 deletions src/enums/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export enum Name {
V1Audits = 'v1-audits',
V1Mails = 'v1-mails',
V1Functions = 'v1-functions',
V1Usage = 'v1-usage',
V1UsageDump = 'v1-usage-dump',
V1StatsResources = 'v1-stats-resources',
V1StatsUsage = 'v1-stats-usage',
V1Webhooks = 'v1-webhooks',
V1Certificates = 'v1-certificates',
V1Builds = 'v1-builds',
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 @@ -13,6 +13,7 @@ export enum OAuthProvider {
Dropbox = 'dropbox',
Etsy = 'etsy',
Facebook = 'facebook',
Figma = 'figma',
Github = 'github',
Gitlab = 'gitlab',
Google = 'google',
Expand Down
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',
}
Loading