node-appwrite
Version:
Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
287 lines (282 loc) • 11.9 kB
text/typescript
import { Client, UploadProgress } from '../client.mjs';
import { Models } from '../models.mjs';
import { Framework } from '../enums/framework.mjs';
import { BuildRuntime } from '../enums/build-runtime.mjs';
import { Adapter } from '../enums/adapter.mjs';
import { VCSDeploymentType } from '../enums/v-c-s-deployment-type.mjs';
import { DeploymentDownloadType } from '../enums/deployment-download-type.mjs';
import '../query.mjs';
declare class Sites {
client: Client;
constructor(client: Client);
/**
* Get a list of all the project's sites. You can use the query params to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.SiteList>}
*/
list(queries?: string[], search?: string): Promise<Models.SiteList>;
/**
* Create a new site.
*
* @param {string} siteId
* @param {string} name
* @param {Framework} framework
* @param {BuildRuntime} buildRuntime
* @param {boolean} enabled
* @param {boolean} logging
* @param {number} timeout
* @param {string} installCommand
* @param {string} buildCommand
* @param {string} outputDirectory
* @param {Adapter} adapter
* @param {string} installationId
* @param {string} fallbackFile
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise<Models.Site>;
/**
* Get a list of all frameworks that are currently available on the server instance.
*
* @throws {AppwriteException}
* @returns {Promise<Models.FrameworkList>}
*/
listFrameworks(): Promise<Models.FrameworkList>;
/**
* List allowed site specifications for this instance.
*
* @throws {AppwriteException}
* @returns {Promise<Models.SpecificationList>}
*/
listSpecifications(): Promise<Models.SpecificationList>;
/**
* Get a site by its unique ID.
*
* @param {string} siteId
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
get(siteId: string): Promise<Models.Site>;
/**
* Update site by its unique ID.
*
* @param {string} siteId
* @param {string} name
* @param {Framework} framework
* @param {boolean} enabled
* @param {boolean} logging
* @param {number} timeout
* @param {string} installCommand
* @param {string} buildCommand
* @param {string} outputDirectory
* @param {BuildRuntime} buildRuntime
* @param {Adapter} adapter
* @param {string} fallbackFile
* @param {string} installationId
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise<Models.Site>;
/**
* Delete a site by its unique ID.
*
* @param {string} siteId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(siteId: string): Promise<{}>;
/**
* Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.
*
* @param {string} siteId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
updateSiteDeployment(siteId: string, deploymentId: string): Promise<Models.Site>;
/**
* Get a list of all the site's code deployments. You can use the query params to filter your results.
*
* @param {string} siteId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
*/
listDeployments(siteId: string, queries?: string[], search?: string): Promise<Models.DeploymentList>;
/**
* Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID.
*
* @param {string} siteId
* @param {File} code
* @param {boolean} activate
* @param {string} installCommand
* @param {string} buildCommand
* @param {string} outputDirectory
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDeployment(siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>;
/**
* Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory 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} siteId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDuplicateDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.
*
* @param {string} siteId
* @param {string} repository
* @param {string} owner
* @param {string} rootDirectory
* @param {string} version
* @param {boolean} activate
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, version: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Create a deployment when a site is connected to VCS.
This endpoint lets you create deployment from a branch, commit, or a tag.
*
* @param {string} siteId
* @param {VCSDeploymentType} type
* @param {string} reference
* @param {boolean} activate
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createVcsDeployment(siteId: string, type: VCSDeploymentType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Get a site deployment by its unique ID.
*
* @param {string} siteId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Delete a site deployment by its unique ID.
*
* @param {string} siteId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteDeployment(siteId: string, deploymentId: string): Promise<{}>;
/**
* Get a site 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} siteId
* @param {string} deploymentId
* @param {DeploymentDownloadType} type
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>;
/**
* Cancel an ongoing site 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} siteId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
updateDeploymentStatus(siteId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Get a list of all site logs. You can use the query params to filter your results.
*
* @param {string} siteId
* @param {string[]} queries
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
*/
listLogs(siteId: string, queries?: string[]): Promise<Models.ExecutionList>;
/**
* Get a site request log by its unique ID.
*
* @param {string} siteId
* @param {string} logId
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
getLog(siteId: string, logId: string): Promise<Models.Execution>;
/**
* Delete a site log by its unique ID.
*
* @param {string} siteId
* @param {string} logId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteLog(siteId: string, logId: string): Promise<{}>;
/**
* Get a list of all variables of a specific site.
*
* @param {string} siteId
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
*/
listVariables(siteId: string): Promise<Models.VariableList>;
/**
* Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.
*
* @param {string} siteId
* @param {string} key
* @param {string} value
* @param {boolean} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
createVariable(siteId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} siteId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
getVariable(siteId: string, variableId: string): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
*
* @param {string} siteId
* @param {string} variableId
* @param {string} key
* @param {string} value
* @param {boolean} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
updateVariable(siteId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
/**
* Delete a variable by its unique ID.
*
* @param {string} siteId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteVariable(siteId: string, variableId: string): Promise<{}>;
}
export { Sites };