node-appwrite
Advanced tools
Comparing version
@@ -18,3 +18,3 @@ 'use strict'; | ||
function getUserAgent() { | ||
let ua = "AppwriteNodeJSSDK/16.1.0-rc.1"; | ||
let ua = "AppwriteNodeJSSDK/17.0.0"; | ||
const platform = []; | ||
@@ -55,5 +55,5 @@ if (typeof process !== "undefined") { | ||
"x-sdk-language": "nodejs", | ||
"x-sdk-version": "16.1.0-rc.1", | ||
"x-sdk-version": "17.0.0", | ||
"user-agent": getUserAgent(), | ||
"X-Appwrite-Response-Format": "1.6.0" | ||
"X-Appwrite-Response-Format": "1.7.0" | ||
}; | ||
@@ -60,0 +60,0 @@ } |
declare enum ImageFormat { | ||
Jpg = "jpg", | ||
Jpeg = "jpeg", | ||
Gif = "gif", | ||
Png = "png", | ||
@@ -6,0 +5,0 @@ Webp = "webp", |
@@ -6,3 +6,2 @@ 'use strict'; | ||
ImageFormat2["Jpeg"] = "jpeg"; | ||
ImageFormat2["Gif"] = "gif"; | ||
ImageFormat2["Png"] = "png"; | ||
@@ -9,0 +8,0 @@ ImageFormat2["Webp"] = "webp"; |
@@ -23,2 +23,3 @@ declare enum Runtime { | ||
Pythonml311 = "python-ml-3.11", | ||
Pythonml312 = "python-ml-3.12", | ||
Deno121 = "deno-1.21", | ||
@@ -34,2 +35,3 @@ Deno124 = "deno-1.24", | ||
Dart218 = "dart-2.18", | ||
Dart219 = "dart-2.19", | ||
Dart30 = "dart-3.0", | ||
@@ -62,5 +64,7 @@ Dart31 = "dart-3.1", | ||
Static1 = "static-1", | ||
Flutter324 = "flutter-3.24" | ||
Flutter324 = "flutter-3.24", | ||
Flutter327 = "flutter-3.27", | ||
Flutter329 = "flutter-3.29" | ||
} | ||
export { Runtime }; |
@@ -25,2 +25,3 @@ 'use strict'; | ||
Runtime2["Pythonml311"] = "python-ml-3.11"; | ||
Runtime2["Pythonml312"] = "python-ml-3.12"; | ||
Runtime2["Deno121"] = "deno-1.21"; | ||
@@ -36,2 +37,3 @@ Runtime2["Deno124"] = "deno-1.24"; | ||
Runtime2["Dart218"] = "dart-2.18"; | ||
Runtime2["Dart219"] = "dart-2.19"; | ||
Runtime2["Dart30"] = "dart-3.0"; | ||
@@ -65,2 +67,4 @@ Runtime2["Dart31"] = "dart-3.1"; | ||
Runtime2["Flutter324"] = "flutter-3.24"; | ||
Runtime2["Flutter327"] = "flutter-3.27"; | ||
Runtime2["Flutter329"] = "flutter-3.29"; | ||
return Runtime2; | ||
@@ -67,0 +71,0 @@ })(Runtime || {}); |
@@ -10,4 +10,6 @@ export { AppwriteException, Client, Payload, UploadProgress } from './client.js'; | ||
export { Messaging } from './services/messaging.js'; | ||
export { Sites } from './services/sites.js'; | ||
export { Storage } from './services/storage.js'; | ||
export { Teams } from './services/teams.js'; | ||
export { Tokens } from './services/tokens.js'; | ||
export { Users } from './services/users.js'; | ||
@@ -28,2 +30,4 @@ export { Query, QueryTypes, QueryTypesList } from './query.js'; | ||
export { Runtime } from './enums/runtime.js'; | ||
export { VCSDeploymentType } from './enums/v-c-s-deployment-type.js'; | ||
export { DeploymentDownloadType } from './enums/deployment-download-type.js'; | ||
export { ExecutionMethod } from './enums/execution-method.js'; | ||
@@ -33,2 +37,5 @@ export { Name } from './enums/name.js'; | ||
export { SmtpEncryption } from './enums/smtp-encryption.js'; | ||
export { Framework } from './enums/framework.js'; | ||
export { BuildRuntime } from './enums/build-runtime.js'; | ||
export { Adapter } from './enums/adapter.js'; | ||
export { Compression } from './enums/compression.js'; | ||
@@ -35,0 +42,0 @@ export { ImageGravity } from './enums/image-gravity.js'; |
@@ -12,4 +12,6 @@ 'use strict'; | ||
var messaging = require('./services/messaging'); | ||
var sites = require('./services/sites'); | ||
var storage = require('./services/storage'); | ||
var teams = require('./services/teams'); | ||
var tokens = require('./services/tokens'); | ||
var users = require('./services/users'); | ||
@@ -29,2 +31,4 @@ var permission = require('./permission'); | ||
var runtime = require('./enums/runtime'); | ||
var vCSDeploymentType = require('./enums/v-c-s-deployment-type'); | ||
var deploymentDownloadType = require('./enums/deployment-download-type'); | ||
var executionMethod = require('./enums/execution-method'); | ||
@@ -34,2 +38,5 @@ var name = require('./enums/name'); | ||
var smtpEncryption = require('./enums/smtp-encryption'); | ||
var framework = require('./enums/framework'); | ||
var buildRuntime = require('./enums/build-runtime'); | ||
var adapter = require('./enums/adapter'); | ||
var compression = require('./enums/compression'); | ||
@@ -87,2 +94,6 @@ var imageGravity = require('./enums/image-gravity'); | ||
}); | ||
Object.defineProperty(exports, 'Sites', { | ||
enumerable: true, | ||
get: function () { return sites.Sites; } | ||
}); | ||
Object.defineProperty(exports, 'Storage', { | ||
@@ -96,2 +107,6 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, 'Tokens', { | ||
enumerable: true, | ||
get: function () { return tokens.Tokens; } | ||
}); | ||
Object.defineProperty(exports, 'Users', { | ||
@@ -153,2 +168,10 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, 'VCSDeploymentType', { | ||
enumerable: true, | ||
get: function () { return vCSDeploymentType.VCSDeploymentType; } | ||
}); | ||
Object.defineProperty(exports, 'DeploymentDownloadType', { | ||
enumerable: true, | ||
get: function () { return deploymentDownloadType.DeploymentDownloadType; } | ||
}); | ||
Object.defineProperty(exports, 'ExecutionMethod', { | ||
@@ -170,2 +193,14 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, 'Framework', { | ||
enumerable: true, | ||
get: function () { return framework.Framework; } | ||
}); | ||
Object.defineProperty(exports, 'BuildRuntime', { | ||
enumerable: true, | ||
get: function () { return buildRuntime.BuildRuntime; } | ||
}); | ||
Object.defineProperty(exports, 'Adapter', { | ||
enumerable: true, | ||
get: function () { return adapter.Adapter; } | ||
}); | ||
Object.defineProperty(exports, 'Compression', { | ||
@@ -172,0 +207,0 @@ enumerable: true, |
@@ -456,3 +456,2 @@ import { Client } from '../client.js'; | ||
* Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. | ||
* | ||
@@ -551,6 +550,7 @@ * @param {string} databaseId | ||
* @param {string[]} orders | ||
* @param {number[]} lengths | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Index>} | ||
*/ | ||
createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[]): Promise<Models.Index>; | ||
createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[], lengths?: number[]): Promise<Models.Index>; | ||
/** | ||
@@ -557,0 +557,0 @@ * Get index by ID. |
import { Client, UploadProgress } from '../client.js'; | ||
import { Models } from '../models.js'; | ||
import { Runtime } from '../enums/runtime.js'; | ||
import { VCSDeploymentType } from '../enums/v-c-s-deployment-type.js'; | ||
import { DeploymentDownloadType } from '../enums/deployment-download-type.js'; | ||
import { ExecutionMethod } from '../enums/execution-method.js'; | ||
@@ -39,6 +41,2 @@ import '../query.js'; | ||
* @param {string} providerRootDirectory | ||
* @param {string} templateRepository | ||
* @param {string} templateOwner | ||
* @param {string} templateRootDirectory | ||
* @param {string} templateVersion | ||
* @param {string} specification | ||
@@ -48,3 +46,3 @@ * @throws {AppwriteException} | ||
*/ | ||
create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise<Models.Function>; | ||
create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise<Models.Function>; | ||
/** | ||
@@ -59,3 +57,2 @@ * Get a list of all runtimes that are currently active on your instance. | ||
* List allowed function specifications for this instance. | ||
* | ||
@@ -108,5 +105,14 @@ * @throws {AppwriteException} | ||
/** | ||
* Get a list of all the project's code deployments. You can use the query params to filter your results. | ||
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Function>} | ||
*/ | ||
updateFunctionDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; | ||
/** | ||
* Get a list of all the function's code deployments. You can use the query params to filter your results. | ||
* | ||
* @param {string} functionId | ||
* @param {string[]} queries | ||
@@ -135,49 +141,69 @@ * @param {string} search | ||
/** | ||
* Get a code deployment by its unique ID. | ||
* Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {string} buildId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; | ||
createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; | ||
/** | ||
* Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. | ||
* Create a deployment based on a template. | ||
Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {string} repository | ||
* @param {string} owner | ||
* @param {string} rootDirectory | ||
* @param {string} version | ||
* @param {boolean} activate | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Function>} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; | ||
createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, version: string, activate?: boolean): Promise<Models.Deployment>; | ||
/** | ||
* Delete a code deployment by its unique ID. | ||
* Create a deployment when a function is connected to VCS. | ||
This endpoint lets you create deployment from a branch, commit, or a tag. | ||
* | ||
* @param {string} functionId | ||
* @param {VCSDeploymentType} type | ||
* @param {string} reference | ||
* @param {boolean} activate | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
createVcsDeployment(functionId: string, type: VCSDeploymentType, reference: string, activate?: boolean): Promise<Models.Deployment>; | ||
/** | ||
* Get a function deployment by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; | ||
getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; | ||
/** | ||
* Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. | ||
* Delete a code deployment by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {string} buildId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
*/ | ||
createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}>; | ||
deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; | ||
/** | ||
* Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. | ||
* Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {DeploymentDownloadType} type | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Build>} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
updateDeploymentBuild(functionId: string, deploymentId: string): Promise<Models.Build>; | ||
getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; | ||
/** | ||
* Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. | ||
* Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. | ||
* | ||
@@ -187,5 +213,5 @@ * @param {string} functionId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
getDeploymentDownload(functionId: string, deploymentId: string): Promise<ArrayBuffer>; | ||
updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>; | ||
/** | ||
@@ -196,7 +222,6 @@ * Get a list of all the current user function execution logs. You can use the query params to filter your results. | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.ExecutionList>} | ||
*/ | ||
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>; | ||
listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList>; | ||
/** | ||
@@ -227,3 +252,2 @@ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. | ||
* Delete a function execution by its unique ID. | ||
* | ||
@@ -250,6 +274,7 @@ * @param {string} functionId | ||
* @param {string} value | ||
* @param {boolean} secret | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Variable>} | ||
*/ | ||
createVariable(functionId: string, key: string, value: string): Promise<Models.Variable>; | ||
createVariable(functionId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; | ||
/** | ||
@@ -271,6 +296,7 @@ * Get a variable by its unique ID. | ||
* @param {string} value | ||
* @param {boolean} secret | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Variable>} | ||
*/ | ||
updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise<Models.Variable>; | ||
updateVariable(functionId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>; | ||
/** | ||
@@ -277,0 +303,0 @@ * Delete a variable by its unique ID. |
@@ -55,6 +55,2 @@ 'use strict'; | ||
* @param {string} providerRootDirectory | ||
* @param {string} templateRepository | ||
* @param {string} templateOwner | ||
* @param {string} templateRootDirectory | ||
* @param {string} templateVersion | ||
* @param {string} specification | ||
@@ -64,3 +60,3 @@ * @throws {AppwriteException} | ||
*/ | ||
create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateVersion, specification) { | ||
create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification) { | ||
if (typeof functionId === "undefined") { | ||
@@ -128,14 +124,2 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof templateRepository !== "undefined") { | ||
payload["templateRepository"] = templateRepository; | ||
} | ||
if (typeof templateOwner !== "undefined") { | ||
payload["templateOwner"] = templateOwner; | ||
} | ||
if (typeof templateRootDirectory !== "undefined") { | ||
payload["templateRootDirectory"] = templateRootDirectory; | ||
} | ||
if (typeof templateVersion !== "undefined") { | ||
payload["templateVersion"] = templateVersion; | ||
} | ||
if (typeof specification !== "undefined") { | ||
@@ -174,8 +158,7 @@ payload["specification"] = specification; | ||
/** | ||
* List allowed function specifications for this instance. | ||
* | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.SpecificationList>} | ||
*/ | ||
* List allowed function specifications for this instance. | ||
* | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.SpecificationList>} | ||
*/ | ||
listSpecifications() { | ||
@@ -335,5 +318,36 @@ const apiPath = "/functions/specifications"; | ||
/** | ||
* Get a list of all the project's code deployments. You can use the query params to filter your results. | ||
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Function>} | ||
*/ | ||
updateFunctionDeployment(functionId, deploymentId) { | ||
if (typeof functionId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof deploymentId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "deploymentId"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployment".replace("{functionId}", functionId); | ||
const payload = {}; | ||
if (typeof deploymentId !== "undefined") { | ||
payload["deploymentId"] = deploymentId; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
const apiHeaders = { | ||
"content-type": "application/json" | ||
}; | ||
return this.client.call( | ||
"patch", | ||
uri, | ||
apiHeaders, | ||
payload | ||
); | ||
} | ||
/** | ||
* Get a list of all the function's code deployments. You can use the query params to filter your results. | ||
* | ||
* @param {string} functionId | ||
* @param {string[]} queries | ||
@@ -418,10 +432,11 @@ * @param {string} search | ||
/** | ||
* Get a code deployment by its unique ID. | ||
* Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {string} buildId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
getDeployment(functionId, deploymentId) { | ||
createDuplicateDeployment(functionId, deploymentId, buildId) { | ||
if (typeof functionId === "undefined") { | ||
@@ -433,8 +448,16 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const apiPath = "/functions/{functionId}/deployments/duplicate".replace("{functionId}", functionId); | ||
const payload = {}; | ||
if (typeof deploymentId !== "undefined") { | ||
payload["deploymentId"] = deploymentId; | ||
} | ||
if (typeof buildId !== "undefined") { | ||
payload["buildId"] = buildId; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
const apiHeaders = {}; | ||
const apiHeaders = { | ||
"content-type": "application/json" | ||
}; | ||
return this.client.call( | ||
"get", | ||
"post", | ||
uri, | ||
@@ -446,18 +469,48 @@ apiHeaders, | ||
/** | ||
* Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Function>} | ||
*/ | ||
updateDeployment(functionId, deploymentId) { | ||
* Create a deployment based on a template. | ||
Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. | ||
* | ||
* @param {string} functionId | ||
* @param {string} repository | ||
* @param {string} owner | ||
* @param {string} rootDirectory | ||
* @param {string} version | ||
* @param {boolean} activate | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
createTemplateDeployment(functionId, repository, owner, rootDirectory, version, activate) { | ||
if (typeof functionId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof deploymentId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "deploymentId"'); | ||
if (typeof repository === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "repository"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
if (typeof owner === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "owner"'); | ||
} | ||
if (typeof rootDirectory === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "rootDirectory"'); | ||
} | ||
if (typeof version === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "version"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/template".replace("{functionId}", functionId); | ||
const payload = {}; | ||
if (typeof repository !== "undefined") { | ||
payload["repository"] = repository; | ||
} | ||
if (typeof owner !== "undefined") { | ||
payload["owner"] = owner; | ||
} | ||
if (typeof rootDirectory !== "undefined") { | ||
payload["rootDirectory"] = rootDirectory; | ||
} | ||
if (typeof version !== "undefined") { | ||
payload["version"] = version; | ||
} | ||
if (typeof activate !== "undefined") { | ||
payload["activate"] = activate; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -468,3 +521,3 @@ const apiHeaders = { | ||
return this.client.call( | ||
"patch", | ||
"post", | ||
uri, | ||
@@ -476,18 +529,34 @@ apiHeaders, | ||
/** | ||
* Delete a code deployment by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
*/ | ||
deleteDeployment(functionId, deploymentId) { | ||
* Create a deployment when a function is connected to VCS. | ||
This endpoint lets you create deployment from a branch, commit, or a tag. | ||
* | ||
* @param {string} functionId | ||
* @param {VCSDeploymentType} type | ||
* @param {string} reference | ||
* @param {boolean} activate | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
createVcsDeployment(functionId, type, reference, activate) { | ||
if (typeof functionId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof deploymentId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "deploymentId"'); | ||
if (typeof type === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "type"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
if (typeof reference === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "reference"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/vcs".replace("{functionId}", functionId); | ||
const payload = {}; | ||
if (typeof type !== "undefined") { | ||
payload["type"] = type; | ||
} | ||
if (typeof reference !== "undefined") { | ||
payload["reference"] = reference; | ||
} | ||
if (typeof activate !== "undefined") { | ||
payload["activate"] = activate; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -498,3 +567,3 @@ const apiHeaders = { | ||
return this.client.call( | ||
"delete", | ||
"post", | ||
uri, | ||
@@ -506,11 +575,10 @@ apiHeaders, | ||
/** | ||
* Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. | ||
* Get a function deployment by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {string} buildId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
createBuild(functionId, deploymentId, buildId) { | ||
getDeployment(functionId, deploymentId) { | ||
if (typeof functionId === "undefined") { | ||
@@ -522,13 +590,8 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}/build".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const payload = {}; | ||
if (typeof buildId !== "undefined") { | ||
payload["buildId"] = buildId; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
const apiHeaders = { | ||
"content-type": "application/json" | ||
}; | ||
const apiHeaders = {}; | ||
return this.client.call( | ||
"post", | ||
"get", | ||
uri, | ||
@@ -540,3 +603,3 @@ apiHeaders, | ||
/** | ||
* Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. | ||
* Delete a code deployment by its unique ID. | ||
* | ||
@@ -546,5 +609,5 @@ * @param {string} functionId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Build>} | ||
* @returns {Promise<{}>} | ||
*/ | ||
updateDeploymentBuild(functionId, deploymentId) { | ||
deleteDeployment(functionId, deploymentId) { | ||
if (typeof functionId === "undefined") { | ||
@@ -556,3 +619,3 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}/build".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const payload = {}; | ||
@@ -564,3 +627,3 @@ const uri = new URL(this.client.config.endpoint + apiPath); | ||
return this.client.call( | ||
"patch", | ||
"delete", | ||
uri, | ||
@@ -572,10 +635,11 @@ apiHeaders, | ||
/** | ||
* Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. | ||
* Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @param {DeploymentDownloadType} type | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getDeploymentDownload(functionId, deploymentId) { | ||
getDeploymentDownload(functionId, deploymentId, type) { | ||
if (typeof functionId === "undefined") { | ||
@@ -589,2 +653,5 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
const payload = {}; | ||
if (typeof type !== "undefined") { | ||
payload["type"] = type; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -601,2 +668,30 @@ const apiHeaders = {}; | ||
/** | ||
* Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. | ||
* | ||
* @param {string} functionId | ||
* @param {string} deploymentId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Deployment>} | ||
*/ | ||
updateDeploymentStatus(functionId, deploymentId) { | ||
if (typeof functionId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof deploymentId === "undefined") { | ||
throw new client.AppwriteException('Missing required parameter: "deploymentId"'); | ||
} | ||
const apiPath = "/functions/{functionId}/deployments/{deploymentId}/status".replace("{functionId}", functionId).replace("{deploymentId}", deploymentId); | ||
const payload = {}; | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
const apiHeaders = { | ||
"content-type": "application/json" | ||
}; | ||
return this.client.call( | ||
"patch", | ||
uri, | ||
apiHeaders, | ||
payload | ||
); | ||
} | ||
/** | ||
* Get a list of all the current user function execution logs. You can use the query params to filter your results. | ||
@@ -606,7 +701,6 @@ * | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.ExecutionList>} | ||
*/ | ||
listExecutions(functionId, queries, search) { | ||
listExecutions(functionId, queries) { | ||
if (typeof functionId === "undefined") { | ||
@@ -620,5 +714,2 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof search !== "undefined") { | ||
payload["search"] = search; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -708,10 +799,9 @@ const apiHeaders = {}; | ||
/** | ||
* Delete a function execution by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} executionId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
*/ | ||
* Delete a function execution by its unique ID. | ||
* | ||
* @param {string} functionId | ||
* @param {string} executionId | ||
* @throws {AppwriteException} | ||
* @returns {Promise<{}>} | ||
*/ | ||
deleteExecution(functionId, executionId) { | ||
@@ -765,6 +855,7 @@ if (typeof functionId === "undefined") { | ||
* @param {string} value | ||
* @param {boolean} secret | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Variable>} | ||
*/ | ||
createVariable(functionId, key, value) { | ||
createVariable(functionId, key, value, secret) { | ||
if (typeof functionId === "undefined") { | ||
@@ -787,2 +878,5 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof secret !== "undefined") { | ||
payload["secret"] = secret; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -832,6 +926,7 @@ const apiHeaders = { | ||
* @param {string} value | ||
* @param {boolean} secret | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.Variable>} | ||
*/ | ||
updateVariable(functionId, variableId, key, value) { | ||
updateVariable(functionId, variableId, key, value, secret) { | ||
if (typeof functionId === "undefined") { | ||
@@ -854,2 +949,5 @@ throw new client.AppwriteException('Missing required parameter: "functionId"'); | ||
} | ||
if (typeof secret !== "undefined") { | ||
payload["secret"] = secret; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -856,0 +954,0 @@ const apiHeaders = { |
@@ -132,6 +132,7 @@ import { Client, UploadProgress } from '../client.js'; | ||
* @param {string} fileId | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer>; | ||
getFileDownload(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; | ||
/** | ||
@@ -153,6 +154,7 @@ * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. | ||
* @param {ImageFormat} output | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise<ArrayBuffer>; | ||
getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer>; | ||
/** | ||
@@ -163,8 +165,9 @@ * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. | ||
* @param {string} fileId | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFileView(bucketId: string, fileId: string): Promise<ArrayBuffer>; | ||
getFileView(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; | ||
} | ||
export { Storage }; |
@@ -386,6 +386,7 @@ 'use strict'; | ||
* @param {string} fileId | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFileDownload(bucketId, fileId) { | ||
getFileDownload(bucketId, fileId, token) { | ||
if (typeof bucketId === "undefined") { | ||
@@ -399,2 +400,5 @@ throw new client.AppwriteException('Missing required parameter: "bucketId"'); | ||
const payload = {}; | ||
if (typeof token !== "undefined") { | ||
payload["token"] = token; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -426,6 +430,7 @@ const apiHeaders = {}; | ||
* @param {ImageFormat} output | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) { | ||
getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) { | ||
if (typeof bucketId === "undefined") { | ||
@@ -472,2 +477,5 @@ throw new client.AppwriteException('Missing required parameter: "bucketId"'); | ||
} | ||
if (typeof token !== "undefined") { | ||
payload["token"] = token; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -488,6 +496,7 @@ const apiHeaders = {}; | ||
* @param {string} fileId | ||
* @param {string} token | ||
* @throws {AppwriteException} | ||
* @returns {Promise<ArrayBuffer>} | ||
*/ | ||
getFileView(bucketId, fileId) { | ||
getFileView(bucketId, fileId, token) { | ||
if (typeof bucketId === "undefined") { | ||
@@ -501,2 +510,5 @@ throw new client.AppwriteException('Missing required parameter: "bucketId"'); | ||
const payload = {}; | ||
if (typeof token !== "undefined") { | ||
payload["token"] = token; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -503,0 +515,0 @@ const apiHeaders = {}; |
@@ -194,6 +194,8 @@ import { Client } from '../client.js'; | ||
* @param {string} userId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.MembershipList>} | ||
*/ | ||
listMemberships(userId: string): Promise<Models.MembershipList>; | ||
listMemberships(userId: string, queries?: string[], search?: string): Promise<Models.MembershipList>; | ||
/** | ||
@@ -200,0 +202,0 @@ * Enable or disable MFA on a user account. |
@@ -675,6 +675,8 @@ 'use strict'; | ||
* @param {string} userId | ||
* @param {string[]} queries | ||
* @param {string} search | ||
* @throws {AppwriteException} | ||
* @returns {Promise<Models.MembershipList>} | ||
*/ | ||
listMemberships(userId) { | ||
listMemberships(userId, queries, search) { | ||
if (typeof userId === "undefined") { | ||
@@ -685,2 +687,8 @@ throw new client.AppwriteException('Missing required parameter: "userId"'); | ||
const payload = {}; | ||
if (typeof queries !== "undefined") { | ||
payload["queries"] = queries; | ||
} | ||
if (typeof search !== "undefined") { | ||
payload["search"] = search; | ||
} | ||
const uri = new URL(this.client.config.endpoint + apiPath); | ||
@@ -687,0 +695,0 @@ const apiHeaders = {}; |
@@ -5,3 +5,3 @@ { | ||
"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": "16.1.0-rc.1", | ||
"version": "17.0.0", | ||
"license": "BSD-3-Clause", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
# Appwrite Node.js SDK | ||
 | ||
 | ||
 | ||
[](https://travis-ci.com/appwrite/sdk-generator) | ||
@@ -9,3 +9,3 @@ [](https://twitter.com/appwrite) | ||
**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** | ||
**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** | ||
@@ -12,0 +12,0 @@ > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2601844
12.16%273
18.18%31185
12.09%0
-100%80
1.27%2
100%3
50%1
Infinity%14
7.69%