Skip to content

Commit

Permalink
chore: release rc
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 17, 2024
1 parent c2c1258 commit 851e598
Show file tree
Hide file tree
Showing 13 changed files with 264 additions and 31 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.5.7-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.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)
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ const client = new sdk.Client()
const account = new sdk.Account(client);

const result = await account.deleteMfaAuthenticator(
sdk.AuthenticatorType.Totp, // type
'<OTP>' // otp
sdk.AuthenticatorType.Totp // type
);
1 change: 1 addition & 0 deletions docs/examples/functions/create-execution.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const sdk = require('node-appwrite');
const fs = require('fs');

const client = new sdk.Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ const result = await functions.create(
'<TEMPLATE_REPOSITORY>', // templateRepository (optional)
'<TEMPLATE_OWNER>', // templateOwner (optional)
'<TEMPLATE_ROOT_DIRECTORY>', // templateRootDirectory (optional)
'<TEMPLATE_BRANCH>' // templateBranch (optional)
'<TEMPLATE_VERSION>' // templateVersion (optional)
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;') // Your project ID
.setKey('&lt;YOUR_API_KEY&gt;'); // Your secret API key
.setSession(''); // The user session to authenticate with

const functions = new sdk.Functions(client);

const result = await functions.downloadDeployment(
const result = await functions.getDeploymentDownload(
'<FUNCTION_ID>', // functionId
'<DEPLOYMENT_ID>' // deploymentId
);
11 changes: 11 additions & 0 deletions docs/examples/functions/get-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID

const functions = new sdk.Functions(client);

const result = await functions.getTemplate(
'<TEMPLATE_ID>' // templateId
);
14 changes: 14 additions & 0 deletions docs/examples/functions/list-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('&lt;YOUR_PROJECT_ID&gt;'); // Your project ID

const functions = new sdk.Functions(client);

const result = await functions.listTemplates(
[], // runtimes (optional)
[], // useCases (optional)
1, // limit (optional)
0 // offset (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.0.0-rc.1",
"version": "14.0.0-rc.2",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
6 changes: 3 additions & 3 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.0.0-rc.1';
let ua = 'AppwriteNodeJSSDK/14.0.0-rc.2';

// `process` is a global in Node.js, but not fully available in all runtimes.
const platform: string[] = [];
Expand Down Expand Up @@ -82,9 +82,9 @@ class Client {
'x-sdk-name': 'Node.js',
'x-sdk-platform': 'server',
'x-sdk-language': 'nodejs',
'x-sdk-version': '14.0.0-rc.1',
'x-sdk-version': '14.0.0-rc.2',
'user-agent' : getUserAgent(),
'X-Appwrite-Response-Format': '1.5.0',
'X-Appwrite-Response-Format': '1.6.0',
};

/**
Expand Down
144 changes: 144 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ export namespace Models {
*/
functions: Function[];
}
/**
* Function Templates List
*/
export type TemplateFunctionList = {
/**
* Total number of templates documents that matched your query.
*/
total: number;
/**
* List of templates.
*/
templates: TemplateFunction[];
}
/**
* Runtimes List
*/
Expand Down Expand Up @@ -1716,6 +1729,129 @@ export namespace Models {
*/
providerSilentMode: boolean;
}
/**
* Template Function
*/
export type TemplateFunction = {
/**
* Function Template Icon.
*/
icon: string;
/**
* Function Template ID.
*/
id: string;
/**
* Function Template Name.
*/
name: string;
/**
* Function Template Tagline.
*/
tagline: string;
/**
* Execution permissions.
*/
permissions: string[];
/**
* Function trigger events.
*/
events: string[];
/**
* Function execution schedult in CRON format.
*/
cron: string;
/**
* Function execution timeout in seconds.
*/
timeout: number;
/**
* Function use cases.
*/
useCases: string[];
/**
* List of runtimes that can be used with this template.
*/
runtimes: TemplateRuntime[];
/**
* Function Template Instructions.
*/
instructions: string;
/**
* VCS (Version Control System) Provider.
*/
vcsProvider: string;
/**
* VCS (Version Control System) Repository ID
*/
providerRepositoryId: string;
/**
* VCS (Version Control System) Owner.
*/
providerOwner: string;
/**
* VCS (Version Control System) branch version (tag).
*/
providerVersion: string;
/**
* Function variables.
*/
variables: TemplateVariable[];
/**
* Function scopes.
*/
scopes: string[];
}
/**
* Template Runtime
*/
export type TemplateRuntime = {
/**
* Runtime Name.
*/
name: string;
/**
* The build command used to build the deployment.
*/
commands: string;
/**
* The entrypoint file used to execute the deployment.
*/
entrypoint: string;
/**
* Path to function in VCS (Version Control System) repository
*/
providerRootDirectory: string;
}
/**
* Template Variable
*/
export type TemplateVariable = {
/**
* Variable Name.
*/
name: string;
/**
* Variable Description.
*/
description: string;
/**
* Variable Value.
*/
value: string;
/**
* Variable Placeholder.
*/
placeholder: string;
/**
* Is the variable required?
*/
required: boolean;
/**
* Variable Type.
*/
type: string;
}
/**
* Runtime
*/
Expand All @@ -1724,6 +1860,10 @@ export namespace Models {
* Runtime ID.
*/
$id: string;
/**
* Parent runtime key.
*/
key: string;
/**
* Runtime Name.
*/
Expand Down Expand Up @@ -1914,6 +2054,10 @@ export namespace Models {
* Function execution duration in seconds.
*/
duration: number;
/**
* The scheduled time for execution. If left empty, execution will be queued immediately.
*/
scheduledAt?: string;
}
/**
* Build
Expand Down
15 changes: 4 additions & 11 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
);
}
/**
* Add Authenticator
* Create Authenticator
*
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
*
Expand Down Expand Up @@ -332,22 +332,15 @@ This endpoint can also be used to convert an anonymous account to a normal one,
* Delete an authenticator for a user by ID.
*
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
const payload: Payload = {};
if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}
const uri = new URL(this.client.config.endpoint + apiPath);

const apiHeaders: { [header: string]: string } = {
Expand All @@ -362,7 +355,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
);
}
/**
* Create 2FA Challenge
* Create MFA Challenge
*
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
*
Expand Down Expand Up @@ -1378,7 +1371,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
);
}
/**
* Create phone verification (confirmation)
* Update phone verification (confirmation)
*
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user&#039;s phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
*
Expand Down
2 changes: 2 additions & 0 deletions src/services/avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre
*
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
This endpoint does not follow HTTP redirects.
*
* @param {string} url
* @throws {AppwriteException}
Expand Down Expand Up @@ -182,6 +183,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre
When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px.
This endpoint does not follow HTTP redirects.
*
* @param {string} url
* @param {number} width
Expand Down
Loading

0 comments on commit 851e598

Please sign in to comment.