Email Sorter Beta

Ich habe soweit automatisiert the Emails sortieren aber ich muss noch schauen was es fur bugs es gibt wenn die app online  ist deswegen wurde ich mit diesen Commit die website veroffentlichen obwohjl es sein konnte  das es noch nicht fertig ist und verkaufs bereit
This commit is contained in:
2026-01-22 19:32:12 +01:00
parent 95349af50b
commit abf761db07
596 changed files with 56405 additions and 51231 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -2,333 +2,119 @@ import { Client } from '../client.mjs';
import { Browser } from '../enums/browser.mjs';
import { CreditCard } from '../enums/credit-card.mjs';
import { Flag } from '../enums/flag.mjs';
import { Theme } from '../enums/theme.mjs';
import { Timezone } from '../enums/timezone.mjs';
import { Output } from '../enums/output.mjs';
import '../models.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
import '../query.mjs';
declare class Avatars {
client: Client;
constructor(client: Client);
/**
* Get browser icon
*
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* 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 100x100px.
*
* @param {Browser} params.code - Browser Code.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Browser} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getBrowser(params: {
code: Browser;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
*
* 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 100x100px.
*
* @param {Browser} code - Browser Code.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get credit card icon
*
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {CreditCard} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getCreditCard(params: {
code: CreditCard;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
*
* 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 100x100px.
*
*
* @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get favicon
*
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
This endpoint does not follow HTTP redirects.
*
* This endpoint does not follow HTTP redirects.
*
* @param {string} params.url - Website URL which you want to fetch the favicon from.
* @param {string} url
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFavicon(params: {
url: string;
}): Promise<ArrayBuffer>;
/**
* 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 - Website URL which you want to fetch the favicon from.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFavicon(url: string): Promise<ArrayBuffer>;
/**
* Get country flag
*
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {Flag} params.code - Country Code. ISO Alpha-2 country code format.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Flag} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFlag(params: {
code: Flag;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
*
* 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 100x100px.
*
*
* @param {Flag} code - Country Code. ISO Alpha-2 country code format.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get image from URL
*
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
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.
*
* 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} params.url - Image URL which you want to crop.
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
* @param {string} url
* @param {number} width
* @param {number} height
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getImage(params: {
url: string;
width?: number;
height?: number;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
*
* 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 - Image URL which you want to crop.
* @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
* @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>;
/**
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
* Get user initials
*
* You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} background
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getInitials(params?: {
name?: string;
width?: number;
height?: number;
background?: string;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
*
* You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.
*
* 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 100x100px.
*
*
* @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>;
/**
* Get QR code
*
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
*
* @param {string} params.text - Plain text to be converted to QR code image.
* @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
* @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
* @param {boolean} params.download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
* @param {string} text
* @param {number} size
* @param {number} margin
* @param {boolean} download
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getQR(params: {
text: string;
size?: number;
margin?: number;
download?: boolean;
}): Promise<ArrayBuffer>;
/**
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
*
* @param {string} text - Plain text to be converted to QR code image.
* @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
* @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
* @param {boolean} download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>;
/**
* Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
*
* You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
*
* When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
*
* @param {string} params.url - Website URL which you want to capture.
* @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty.
* @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
* @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
* @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
* @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light".
* @param {string} params.userAgent - Custom user agent string. Defaults to browser default.
* @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
* @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
* @param {Timezone} params.timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
* @param {number} params.latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
* @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
* @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
* @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
* @param {string[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
* @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
* @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
* @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
* @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Output} params.output - Output format type (jpeg, jpg, png, gif and webp).
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getScreenshot(params: {
url: string;
headers?: object;
viewportWidth?: number;
viewportHeight?: number;
scale?: number;
theme?: Theme;
userAgent?: string;
fullpage?: boolean;
locale?: string;
timezone?: Timezone;
latitude?: number;
longitude?: number;
accuracy?: number;
touch?: boolean;
permissions?: string[];
sleep?: number;
width?: number;
height?: number;
quality?: number;
output?: Output;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
*
* You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
*
* When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
*
* @param {string} url - Website URL which you want to capture.
* @param {object} headers - HTTP headers to send with the browser request. Defaults to empty.
* @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
* @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
* @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
* @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light".
* @param {string} userAgent - Custom user agent string. Defaults to browser default.
* @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
* @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
* @param {Timezone} timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
* @param {number} latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
* @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
* @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
* @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
* @param {string[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
* @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
* @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
* @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
* @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Output} output - Output format type (jpeg, jpg, png, gif and webp).
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output): Promise<ArrayBuffer>;
}
export { Avatars };

View File

@@ -2,333 +2,119 @@ import { Client } from '../client.js';
import { Browser } from '../enums/browser.js';
import { CreditCard } from '../enums/credit-card.js';
import { Flag } from '../enums/flag.js';
import { Theme } from '../enums/theme.js';
import { Timezone } from '../enums/timezone.js';
import { Output } from '../enums/output.js';
import '../models.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
import '../query.js';
declare class Avatars {
client: Client;
constructor(client: Client);
/**
* Get browser icon
*
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* 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 100x100px.
*
* @param {Browser} params.code - Browser Code.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Browser} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getBrowser(params: {
code: Browser;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
*
* 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 100x100px.
*
* @param {Browser} code - Browser Code.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get credit card icon
*
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {CreditCard} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getCreditCard(params: {
code: CreditCard;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
*
* 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 100x100px.
*
*
* @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get favicon
*
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL.
This endpoint does not follow HTTP redirects.
*
* This endpoint does not follow HTTP redirects.
*
* @param {string} params.url - Website URL which you want to fetch the favicon from.
* @param {string} url
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFavicon(params: {
url: string;
}): Promise<ArrayBuffer>;
/**
* 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 - Website URL which you want to fetch the favicon from.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFavicon(url: string): Promise<ArrayBuffer>;
/**
* Get country flag
*
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {Flag} params.code - Country Code. ISO Alpha-2 country code format.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Flag} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFlag(params: {
code: Flag;
width?: number;
height?: number;
quality?: number;
}): Promise<ArrayBuffer>;
/**
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
*
* 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 100x100px.
*
*
* @param {Flag} code - Country Code. ISO Alpha-2 country code format.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>;
/**
* Get image from URL
*
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
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.
*
* 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} params.url - Image URL which you want to crop.
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
* @param {string} url
* @param {number} width
* @param {number} height
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getImage(params: {
url: string;
width?: number;
height?: number;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
*
* 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 - Image URL which you want to crop.
* @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400.
* @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>;
/**
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
* Get user initials
*
* You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
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 100x100px.
*
* 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 100x100px.
*
*
* @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
* @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} background
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getInitials(params?: {
name?: string;
width?: number;
height?: number;
background?: string;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned.
*
* You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials.
*
* 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 100x100px.
*
*
* @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars.
* @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100.
* @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100.
* @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>;
/**
* Get QR code
*
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
*
* @param {string} params.text - Plain text to be converted to QR code image.
* @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
* @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
* @param {boolean} params.download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
* @param {string} text
* @param {number} size
* @param {number} margin
* @param {boolean} download
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getQR(params: {
text: string;
size?: number;
margin?: number;
download?: boolean;
}): Promise<ArrayBuffer>;
/**
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
*
* @param {string} text - Plain text to be converted to QR code image.
* @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400.
* @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1.
* @param {boolean} download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>;
/**
* Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
*
* You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
*
* When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
*
* @param {string} params.url - Website URL which you want to capture.
* @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty.
* @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
* @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
* @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
* @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light".
* @param {string} params.userAgent - Custom user agent string. Defaults to browser default.
* @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
* @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
* @param {Timezone} params.timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
* @param {number} params.latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
* @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
* @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
* @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
* @param {string[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
* @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
* @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
* @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
* @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Output} params.output - Output format type (jpeg, jpg, png, gif and webp).
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getScreenshot(params: {
url: string;
headers?: object;
viewportWidth?: number;
viewportHeight?: number;
scale?: number;
theme?: Theme;
userAgent?: string;
fullpage?: boolean;
locale?: string;
timezone?: Timezone;
latitude?: number;
longitude?: number;
accuracy?: number;
touch?: boolean;
permissions?: string[];
sleep?: number;
width?: number;
height?: number;
quality?: number;
output?: Output;
}): Promise<ArrayBuffer>;
/**
* Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.
*
* You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.
*
* When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.
*
* @param {string} url - Website URL which you want to capture.
* @param {object} headers - HTTP headers to send with the browser request. Defaults to empty.
* @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.
* @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.
* @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.
* @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light".
* @param {string} userAgent - Custom user agent string. Defaults to browser default.
* @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.
* @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default.
* @param {Timezone} timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default.
* @param {number} latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.
* @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.
* @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.
* @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.
* @param {string[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty.
* @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.
* @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).
* @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).
* @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {Output} output - Output format type (jpeg, jpg, png, gif and webp).
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: string[], sleep?: number, width?: number, height?: number, quality?: number, output?: Output): Promise<ArrayBuffer>;
}
export { Avatars };

View File

@@ -6,22 +6,21 @@ class Avatars {
constructor(client) {
this.client = client;
}
getBrowser(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get browser icon
*
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* @param {Browser} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getBrowser(code, width, height, quality) {
if (typeof code === "undefined") {
throw new client.AppwriteException('Missing required parameter: "code"');
}
@@ -37,8 +36,10 @@ class Avatars {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -46,22 +47,22 @@ class Avatars {
"arrayBuffer"
);
}
getCreditCard(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get credit card icon
*
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* @param {CreditCard} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getCreditCard(code, width, height, quality) {
if (typeof code === "undefined") {
throw new client.AppwriteException('Missing required parameter: "code"');
}
@@ -77,8 +78,10 @@ class Avatars {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -86,16 +89,18 @@ class Avatars {
"arrayBuffer"
);
}
getFavicon(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst
};
}
const url = params.url;
/**
* Get favicon
*
* 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}
* @returns {Promise<ArrayBuffer>}
*/
async getFavicon(url) {
if (typeof url === "undefined") {
throw new client.AppwriteException('Missing required parameter: "url"');
}
@@ -105,8 +110,10 @@ class Avatars {
payload["url"] = url;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -114,22 +121,22 @@ class Avatars {
"arrayBuffer"
);
}
getFlag(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get country flag
*
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
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 100x100px.
*
* @param {Flag} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFlag(code, width, height, quality) {
if (typeof code === "undefined") {
throw new client.AppwriteException('Missing required parameter: "code"');
}
@@ -145,8 +152,10 @@ class Avatars {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -154,20 +163,22 @@ class Avatars {
"arrayBuffer"
);
}
getImage(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst,
width: rest[0],
height: rest[1]
};
}
const url = params.url;
const width = params.width;
const height = params.height;
/**
* Get image from URL
*
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
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
* @param {number} height
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getImage(url, width, height) {
if (typeof url === "undefined") {
throw new client.AppwriteException('Missing required parameter: "url"');
}
@@ -183,8 +194,10 @@ class Avatars {
payload["height"] = height;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -192,22 +205,24 @@ class Avatars {
"arrayBuffer"
);
}
getInitials(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
width: rest[0],
height: rest[1],
background: rest[2]
};
}
const name = params.name;
const width = params.width;
const height = params.height;
const background = params.background;
/**
* Get user initials
*
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
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 100x100px.
*
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} background
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getInitials(name, width, height, background) {
const apiPath = "/avatars/initials";
const payload = {};
if (typeof name !== "undefined") {
@@ -223,8 +238,10 @@ class Avatars {
payload["background"] = background;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -232,22 +249,20 @@ class Avatars {
"arrayBuffer"
);
}
getQR(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
text: paramsOrFirst,
size: rest[0],
margin: rest[1],
download: rest[2]
};
}
const text = params.text;
const size = params.size;
const margin = params.margin;
const download = params.download;
/**
* Get QR code
*
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
* @param {string} text
* @param {number} size
* @param {number} margin
* @param {boolean} download
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getQR(text, size, margin, download) {
if (typeof text === "undefined") {
throw new client.AppwriteException('Missing required parameter: "text"');
}
@@ -266,131 +281,10 @@ class Avatars {
payload["download"] = download;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload,
"arrayBuffer"
);
}
getScreenshot(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst,
headers: rest[0],
viewportWidth: rest[1],
viewportHeight: rest[2],
scale: rest[3],
theme: rest[4],
userAgent: rest[5],
fullpage: rest[6],
locale: rest[7],
timezone: rest[8],
latitude: rest[9],
longitude: rest[10],
accuracy: rest[11],
touch: rest[12],
permissions: rest[13],
sleep: rest[14],
width: rest[15],
height: rest[16],
quality: rest[17],
output: rest[18]
};
}
const url = params.url;
const headers = params.headers;
const viewportWidth = params.viewportWidth;
const viewportHeight = params.viewportHeight;
const scale = params.scale;
const theme = params.theme;
const userAgent = params.userAgent;
const fullpage = params.fullpage;
const locale = params.locale;
const timezone = params.timezone;
const latitude = params.latitude;
const longitude = params.longitude;
const accuracy = params.accuracy;
const touch = params.touch;
const permissions = params.permissions;
const sleep = params.sleep;
const width = params.width;
const height = params.height;
const quality = params.quality;
const output = params.output;
if (typeof url === "undefined") {
throw new client.AppwriteException('Missing required parameter: "url"');
}
const apiPath = "/avatars/screenshots";
const payload = {};
if (typeof url !== "undefined") {
payload["url"] = url;
}
if (typeof headers !== "undefined") {
payload["headers"] = headers;
}
if (typeof viewportWidth !== "undefined") {
payload["viewportWidth"] = viewportWidth;
}
if (typeof viewportHeight !== "undefined") {
payload["viewportHeight"] = viewportHeight;
}
if (typeof scale !== "undefined") {
payload["scale"] = scale;
}
if (typeof theme !== "undefined") {
payload["theme"] = theme;
}
if (typeof userAgent !== "undefined") {
payload["userAgent"] = userAgent;
}
if (typeof fullpage !== "undefined") {
payload["fullpage"] = fullpage;
}
if (typeof locale !== "undefined") {
payload["locale"] = locale;
}
if (typeof timezone !== "undefined") {
payload["timezone"] = timezone;
}
if (typeof latitude !== "undefined") {
payload["latitude"] = latitude;
}
if (typeof longitude !== "undefined") {
payload["longitude"] = longitude;
}
if (typeof accuracy !== "undefined") {
payload["accuracy"] = accuracy;
}
if (typeof touch !== "undefined") {
payload["touch"] = touch;
}
if (typeof permissions !== "undefined") {
payload["permissions"] = permissions;
}
if (typeof sleep !== "undefined") {
payload["sleep"] = sleep;
}
if (typeof width !== "undefined") {
payload["width"] = width;
}
if (typeof height !== "undefined") {
payload["height"] = height;
}
if (typeof quality !== "undefined") {
payload["quality"] = quality;
}
if (typeof output !== "undefined") {
payload["output"] = output;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -5,22 +5,21 @@ var Avatars = class {
constructor(client) {
this.client = client;
}
getBrowser(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get browser icon
*
* You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* @param {Browser} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getBrowser(code, width, height, quality) {
if (typeof code === "undefined") {
throw new AppwriteException('Missing required parameter: "code"');
}
@@ -36,8 +35,10 @@ var Avatars = class {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -45,22 +46,22 @@ var Avatars = class {
"arrayBuffer"
);
}
getCreditCard(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get credit card icon
*
* The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.
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 100x100px.
*
* @param {CreditCard} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getCreditCard(code, width, height, quality) {
if (typeof code === "undefined") {
throw new AppwriteException('Missing required parameter: "code"');
}
@@ -76,8 +77,10 @@ var Avatars = class {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -85,16 +88,18 @@ var Avatars = class {
"arrayBuffer"
);
}
getFavicon(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst
};
}
const url = params.url;
/**
* Get favicon
*
* 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}
* @returns {Promise<ArrayBuffer>}
*/
async getFavicon(url) {
if (typeof url === "undefined") {
throw new AppwriteException('Missing required parameter: "url"');
}
@@ -104,8 +109,10 @@ var Avatars = class {
payload["url"] = url;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -113,22 +120,22 @@ var Avatars = class {
"arrayBuffer"
);
}
getFlag(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
code: paramsOrFirst,
width: rest[0],
height: rest[1],
quality: rest[2]
};
}
const code = params.code;
const width = params.width;
const height = params.height;
const quality = params.quality;
/**
* Get country flag
*
* You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
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 100x100px.
*
* @param {Flag} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFlag(code, width, height, quality) {
if (typeof code === "undefined") {
throw new AppwriteException('Missing required parameter: "code"');
}
@@ -144,8 +151,10 @@ var Avatars = class {
payload["quality"] = quality;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -153,20 +162,22 @@ var Avatars = class {
"arrayBuffer"
);
}
getImage(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst,
width: rest[0],
height: rest[1]
};
}
const url = params.url;
const width = params.width;
const height = params.height;
/**
* Get image from URL
*
* Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.
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
* @param {number} height
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getImage(url, width, height) {
if (typeof url === "undefined") {
throw new AppwriteException('Missing required parameter: "url"');
}
@@ -182,8 +193,10 @@ var Avatars = class {
payload["height"] = height;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -191,22 +204,24 @@ var Avatars = class {
"arrayBuffer"
);
}
getInitials(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
width: rest[0],
height: rest[1],
background: rest[2]
};
}
const name = params.name;
const width = params.width;
const height = params.height;
const background = params.background;
/**
* Get user initials
*
* Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the &#039;name&#039; parameter. If no name is given and no user is logged, an empty avatar will be returned.
You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user&#039;s initials when reloading the same theme will always return for the same initials.
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 100x100px.
*
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} background
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getInitials(name, width, height, background) {
const apiPath = "/avatars/initials";
const payload = {};
if (typeof name !== "undefined") {
@@ -222,8 +237,10 @@ var Avatars = class {
payload["background"] = background;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -231,22 +248,20 @@ var Avatars = class {
"arrayBuffer"
);
}
getQR(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
text: paramsOrFirst,
size: rest[0],
margin: rest[1],
download: rest[2]
};
}
const text = params.text;
const size = params.size;
const margin = params.margin;
const download = params.download;
/**
* Get QR code
*
* Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.
*
* @param {string} text
* @param {number} size
* @param {number} margin
* @param {boolean} download
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getQR(text, size, margin, download) {
if (typeof text === "undefined") {
throw new AppwriteException('Missing required parameter: "text"');
}
@@ -265,131 +280,10 @@ var Avatars = class {
payload["download"] = download;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload,
"arrayBuffer"
);
}
getScreenshot(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
url: paramsOrFirst,
headers: rest[0],
viewportWidth: rest[1],
viewportHeight: rest[2],
scale: rest[3],
theme: rest[4],
userAgent: rest[5],
fullpage: rest[6],
locale: rest[7],
timezone: rest[8],
latitude: rest[9],
longitude: rest[10],
accuracy: rest[11],
touch: rest[12],
permissions: rest[13],
sleep: rest[14],
width: rest[15],
height: rest[16],
quality: rest[17],
output: rest[18]
};
}
const url = params.url;
const headers = params.headers;
const viewportWidth = params.viewportWidth;
const viewportHeight = params.viewportHeight;
const scale = params.scale;
const theme = params.theme;
const userAgent = params.userAgent;
const fullpage = params.fullpage;
const locale = params.locale;
const timezone = params.timezone;
const latitude = params.latitude;
const longitude = params.longitude;
const accuracy = params.accuracy;
const touch = params.touch;
const permissions = params.permissions;
const sleep = params.sleep;
const width = params.width;
const height = params.height;
const quality = params.quality;
const output = params.output;
if (typeof url === "undefined") {
throw new AppwriteException('Missing required parameter: "url"');
}
const apiPath = "/avatars/screenshots";
const payload = {};
if (typeof url !== "undefined") {
payload["url"] = url;
}
if (typeof headers !== "undefined") {
payload["headers"] = headers;
}
if (typeof viewportWidth !== "undefined") {
payload["viewportWidth"] = viewportWidth;
}
if (typeof viewportHeight !== "undefined") {
payload["viewportHeight"] = viewportHeight;
}
if (typeof scale !== "undefined") {
payload["scale"] = scale;
}
if (typeof theme !== "undefined") {
payload["theme"] = theme;
}
if (typeof userAgent !== "undefined") {
payload["userAgent"] = userAgent;
}
if (typeof fullpage !== "undefined") {
payload["fullpage"] = fullpage;
}
if (typeof locale !== "undefined") {
payload["locale"] = locale;
}
if (typeof timezone !== "undefined") {
payload["timezone"] = timezone;
}
if (typeof latitude !== "undefined") {
payload["latitude"] = latitude;
}
if (typeof longitude !== "undefined") {
payload["longitude"] = longitude;
}
if (typeof accuracy !== "undefined") {
payload["accuracy"] = accuracy;
}
if (typeof touch !== "undefined") {
payload["touch"] = touch;
}
if (typeof permissions !== "undefined") {
payload["permissions"] = permissions;
}
if (typeof sleep !== "undefined") {
payload["sleep"] = sleep;
}
if (typeof width !== "undefined") {
payload["width"] = width;
}
if (typeof height !== "undefined") {
payload["height"] = height;
}
if (typeof quality !== "undefined") {
payload["quality"] = quality;
}
if (typeof output !== "undefined") {
payload["output"] = output;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,121 +1,57 @@
import { Client, UploadProgress } from '../client.mjs';
import { Models } from '../models.mjs';
import { Runtime } from '../enums/runtime.mjs';
import { TemplateReferenceType } from '../enums/template-reference-type.mjs';
import { VCSReferenceType } from '../enums/vcs-reference-type.mjs';
import { DeploymentDownloadType } from '../enums/deployment-download-type.mjs';
import { ExecutionMethod } from '../enums/execution-method.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Functions {
client: Client;
constructor(client: Client);
/**
* Get a list of all the project's functions. You can use the query params to filter your results.
* List functions
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* Get a list of all the project&#039;s functions. You can use the query params to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FunctionList>}
*/
list(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.FunctionList>;
list(queries?: string[], search?: string): Promise<Models.FunctionList>;
/**
* Get a list of all the project's functions. You can use the query params to filter your results.
* Create function
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.FunctionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>;
/**
* Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
*
* @param {string} params.functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Function name. Max length: 128 chars.
* @param {Runtime} params.runtime - Execution runtime.
* @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
* @param {string} params.schedule - Schedule CRON syntax.
* @param {number} params.timeout - Function maximum execution time in seconds.
* @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} params.commands - Build Commands.
* @param {string[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function.
* @param {string} params.providerBranch - Production branch for the repo linked to the function.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to function code in the linked repo.
* @param {string} params.specification - Runtime specification for the function and builds.
* @param {string} functionId
* @param {string} name
* @param {Runtime} runtime
* @param {string[]} execute
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @param {boolean} logging
* @param {string} entrypoint
* @param {string} commands
* @param {string[]} scopes
* @param {string} installationId
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} templateRepository
* @param {string} templateOwner
* @param {string} templateRootDirectory
* @param {string} templateVersion
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
create(params: {
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>;
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 a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
* List runtimes
*
* @param {string} functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Function name. Max length: 128 chars.
* @param {Runtime} runtime - Execution runtime.
* @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} events - Events list. Maximum of 100 events are allowed.
* @param {string} schedule - Schedule CRON syntax.
* @param {number} timeout - Function maximum execution time in seconds.
* @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} commands - Build Commands.
* @param {string[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the function.
* @param {string} providerBranch - Production branch for the repo linked to the function.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to function code in the linked repo.
* @param {string} specification - Runtime specification for the function and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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>;
/**
* Get a list of all runtimes that are currently active on your instance.
*
* @throws {AppwriteException}
@@ -123,626 +59,264 @@ declare class Functions {
*/
listRuntimes(): Promise<Models.RuntimeList>;
/**
* List available function runtime specifications
*
* List allowed function specifications for this instance.
*
* @throws {AppwriteException}
* @returns {Promise<Models.SpecificationList>}
*/
listSpecifications(): Promise<Models.SpecificationList>;
/**
* Get function
*
* Get a function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
get(params: {
functionId: string;
}): Promise<Models.Function>;
/**
* Get a function by its unique ID.
*
* @param {string} functionId - Function ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(functionId: string): Promise<Models.Function>;
/**
* Update function
*
* Update function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.name - Function name. Max length: 128 chars.
* @param {Runtime} params.runtime - Execution runtime.
* @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
* @param {string} params.schedule - Schedule CRON syntax.
* @param {number} params.timeout - Maximum execution time in seconds.
* @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} params.commands - Build Commands.
* @param {string[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function
* @param {string} params.providerBranch - Production branch for the repo linked to the function
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to function code in the linked repo.
* @param {string} params.specification - Runtime specification for the function and builds.
* @param {string} functionId
* @param {string} name
* @param {Runtime} runtime
* @param {string[]} execute
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @param {boolean} logging
* @param {string} entrypoint
* @param {string} commands
* @param {string[]} scopes
* @param {string} installationId
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
update(params: {
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>;
/**
* Update function by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} name - Function name. Max length: 128 chars.
* @param {Runtime} runtime - Execution runtime.
* @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} events - Events list. Maximum of 100 events are allowed.
* @param {string} schedule - Schedule CRON syntax.
* @param {number} timeout - Maximum execution time in seconds.
* @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} commands - Build Commands.
* @param {string[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the function
* @param {string} providerBranch - Production branch for the repo linked to the function
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to function code in the linked repo.
* @param {string} specification - Runtime specification for the function and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
update(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>;
/**
* Delete function
*
* Delete a function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
functionId: string;
}): Promise<{}>;
/**
* Delete a function by its unique ID.
*
* @param {string} functionId - Function ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(functionId: string): Promise<{}>;
/**
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
* List deployments
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
updateFunctionDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Function>;
/**
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
* Get a list of all the project&#039;s code deployments. You can use the query params to filter your results.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.functionId - Function ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} functionId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
*/
listDeployments(params: {
functionId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.DeploymentList>;
listDeployments(functionId: string, queries?: string[], search?: string): Promise<Models.DeploymentList>;
/**
* Get a list of all the function's code deployments. You can use the query params to filter your results.
* Create deployment
*
* @param {string} functionId - Function ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>;
/**
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment UID.
This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
Use the &quot;command&quot; param to set the entrypoint used to execute your code.
*
* This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
*
* Use the "command" param to set the entrypoint used to execute your code.
*
* @param {string} params.functionId - Function ID.
* @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @param {string} params.entrypoint - Entrypoint File.
* @param {string} params.commands - Build Commands.
* @param {string} functionId
* @param {File} code
* @param {boolean} activate
* @param {string} entrypoint
* @param {string} commands
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDeployment(params: {
functionId: string;
code: File;
activate: boolean;
entrypoint?: string;
commands?: string;
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.Deployment>;
/**
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.
*
* This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
*
* Use the "command" param to set the entrypoint used to execute your code.
*
* @param {string} functionId - Function ID.
* @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @param {string} entrypoint - Entrypoint File.
* @param {string} commands - Build Commands.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): 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.
* Get deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {string} params.buildId - Build unique ID.
* Get a code deployment by its unique ID.
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDuplicateDeployment(params: {
functionId: string;
deploymentId: string;
buildId?: 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.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {string} buildId - Build unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.repository - Repository name of the template.
* @param {string} params.owner - The name of the owner of the template.
* @param {string} params.rootDirectory - Path to function code in the template repo.
* @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createTemplateDeployment(params: {
functionId: string;
repository: string;
owner: string;
rootDirectory: string;
type: TemplateReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
*
* @param {string} functionId - Function ID.
* @param {string} repository - Repository name of the template.
* @param {string} owner - The name of the owner of the template.
* @param {string} rootDirectory - Path to function code in the template repo.
* @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* 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} params.functionId - Function ID.
* @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit
* @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createVcsDeployment(params: {
functionId: string;
type: VCSReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* 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 - Function ID.
* @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit
* @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Get a function deployment by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
getDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* Get a function deployment by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Delete a code deployment by its unique ID.
* Update deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* 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<{}>}
* @returns {Promise<Models.Function>}
*/
deleteDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<{}>;
updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>;
/**
* Delete deployment
*
* Delete a code deployment by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteDeployment(functionId: string, deploymentId: string): Promise<{}>;
/**
* 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.
* Rebuild deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output".
*
* @param {string} functionId
* @param {string} deploymentId
* @param {string} buildId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}>;
/**
* Cancel deployment
*
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Build>}
*/
updateDeploymentBuild(functionId: string, deploymentId: string): Promise<Models.Build>;
/**
* Download deployment
*
* Get a Deployment&#039;s contents by its unique ID. This endpoint supports range requests for partial or streaming file download.
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getDeploymentDownload(params: {
functionId: string;
deploymentId: string;
type?: DeploymentDownloadType;
}): Promise<ArrayBuffer>;
getDeploymentDownload(functionId: string, deploymentId: string): Promise<ArrayBuffer>;
/**
* 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.
* List executions
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>;
/**
* 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} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
updateDeploymentStatus(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* 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 - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
*
* @param {string} params.functionId - Function ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} functionId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
*/
listExecutions(params: {
functionId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ExecutionList>;
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>;
/**
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
* Create execution
*
* @param {string} functionId - Function ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>;
/**
* 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.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.body - HTTP body of execution. Default value is empty string.
* @param {boolean} params.async - Execute code in the background. Default value is false.
* @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
* @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST.
* @param {object} params.headers - HTTP headers of execution. Defaults to empty.
* @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
* @param {string} functionId
* @param {string} body
* @param {boolean} async
* @param {string} xpath
* @param {ExecutionMethod} method
* @param {object} headers
* @param {string} scheduledAt
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
createExecution(params: {
functionId: string;
body?: string;
async?: boolean;
xpath?: string;
method?: ExecutionMethod;
headers?: object;
scheduledAt?: string;
}): Promise<Models.Execution>;
/**
* 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.
*
* @param {string} functionId - Function ID.
* @param {string} body - HTTP body of execution. Default value is empty string.
* @param {boolean} async - Execute code in the background. Default value is false.
* @param {string} xpath - HTTP path of execution. Path can include query params. Default value is /
* @param {ExecutionMethod} method - HTTP method of execution. Default value is POST.
* @param {object} headers - HTTP headers of execution. Defaults to empty.
* @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>;
/**
* Get execution
*
* Get a function execution log by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.executionId - Execution ID.
* @param {string} functionId
* @param {string} executionId
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
getExecution(params: {
functionId: string;
executionId: string;
}): Promise<Models.Execution>;
/**
* Get a function execution log by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} executionId - Execution ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
/**
* Delete a function execution by its unique ID.
* Delete execution
*
* @param {string} params.functionId - Function ID.
* @param {string} params.executionId - Execution ID.
* Delete a function execution by its unique ID.
*
* @param {string} functionId
* @param {string} executionId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteExecution(params: {
functionId: string;
executionId: string;
}): Promise<{}>;
/**
* Delete a function execution by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} executionId - Execution ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteExecution(functionId: string, executionId: string): Promise<{}>;
/**
* List variables
*
* Get a list of all variables of a specific function.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
*/
listVariables(params: {
functionId: string;
}): Promise<Models.VariableList>;
/**
* Get a list of all variables of a specific function.
*
* @param {string} functionId - Function unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listVariables(functionId: string): Promise<Models.VariableList>;
/**
* Create variable
*
* Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @param {string} functionId
* @param {string} key
* @param {string} value
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
createVariable(params: {
functionId: string;
key: string;
value: string;
secret?: boolean;
}): Promise<Models.Variable>;
createVariable(functionId: string, key: string, value: string): Promise<Models.Variable>;
/**
* Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
* Get variable
*
* @param {string} functionId - Function unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVariable(functionId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} functionId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
getVariable(params: {
functionId: string;
variableId: string;
}): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getVariable(functionId: string, variableId: string): Promise<Models.Variable>;
/**
* Update variable
*
* Update variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @param {string} functionId
* @param {string} variableId
* @param {string} key
* @param {string} value
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
updateVariable(params: {
functionId: string;
variableId: string;
key: string;
value?: string;
secret?: boolean;
}): Promise<Models.Variable>;
updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
* Delete variable
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateVariable(functionId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
/**
* Delete a variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} functionId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteVariable(params: {
functionId: string;
variableId: string;
}): Promise<{}>;
/**
* Delete a variable by its unique ID.
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteVariable(functionId: string, variableId: string): Promise<{}>;
}

View File

@@ -1,121 +1,57 @@
import { Client, UploadProgress } from '../client.js';
import { Models } from '../models.js';
import { Runtime } from '../enums/runtime.js';
import { TemplateReferenceType } from '../enums/template-reference-type.js';
import { VCSReferenceType } from '../enums/vcs-reference-type.js';
import { DeploymentDownloadType } from '../enums/deployment-download-type.js';
import { ExecutionMethod } from '../enums/execution-method.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Functions {
client: Client;
constructor(client: Client);
/**
* Get a list of all the project's functions. You can use the query params to filter your results.
* List functions
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* Get a list of all the project&#039;s functions. You can use the query params to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FunctionList>}
*/
list(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.FunctionList>;
list(queries?: string[], search?: string): Promise<Models.FunctionList>;
/**
* Get a list of all the project's functions. You can use the query params to filter your results.
* Create function
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.FunctionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>;
/**
* Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
*
* @param {string} params.functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Function name. Max length: 128 chars.
* @param {Runtime} params.runtime - Execution runtime.
* @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
* @param {string} params.schedule - Schedule CRON syntax.
* @param {number} params.timeout - Function maximum execution time in seconds.
* @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} params.commands - Build Commands.
* @param {string[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function.
* @param {string} params.providerBranch - Production branch for the repo linked to the function.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to function code in the linked repo.
* @param {string} params.specification - Runtime specification for the function and builds.
* @param {string} functionId
* @param {string} name
* @param {Runtime} runtime
* @param {string[]} execute
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @param {boolean} logging
* @param {string} entrypoint
* @param {string} commands
* @param {string[]} scopes
* @param {string} installationId
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} templateRepository
* @param {string} templateOwner
* @param {string} templateRootDirectory
* @param {string} templateVersion
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
create(params: {
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>;
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 a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.
* List runtimes
*
* @param {string} functionId - Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Function name. Max length: 128 chars.
* @param {Runtime} runtime - Execution runtime.
* @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} events - Events list. Maximum of 100 events are allowed.
* @param {string} schedule - Schedule CRON syntax.
* @param {number} timeout - Function maximum execution time in seconds.
* @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} commands - Build Commands.
* @param {string[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the function.
* @param {string} providerBranch - Production branch for the repo linked to the function.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to function code in the linked repo.
* @param {string} specification - Runtime specification for the function and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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>;
/**
* Get a list of all runtimes that are currently active on your instance.
*
* @throws {AppwriteException}
@@ -123,626 +59,264 @@ declare class Functions {
*/
listRuntimes(): Promise<Models.RuntimeList>;
/**
* List available function runtime specifications
*
* List allowed function specifications for this instance.
*
* @throws {AppwriteException}
* @returns {Promise<Models.SpecificationList>}
*/
listSpecifications(): Promise<Models.SpecificationList>;
/**
* Get function
*
* Get a function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
get(params: {
functionId: string;
}): Promise<Models.Function>;
/**
* Get a function by its unique ID.
*
* @param {string} functionId - Function ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(functionId: string): Promise<Models.Function>;
/**
* Update function
*
* Update function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.name - Function name. Max length: 128 chars.
* @param {Runtime} params.runtime - Execution runtime.
* @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} params.events - Events list. Maximum of 100 events are allowed.
* @param {string} params.schedule - Schedule CRON syntax.
* @param {number} params.timeout - Maximum execution time in seconds.
* @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} params.commands - Build Commands.
* @param {string[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function
* @param {string} params.providerBranch - Production branch for the repo linked to the function
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to function code in the linked repo.
* @param {string} params.specification - Runtime specification for the function and builds.
* @param {string} functionId
* @param {string} name
* @param {Runtime} runtime
* @param {string[]} execute
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @param {boolean} enabled
* @param {boolean} logging
* @param {string} entrypoint
* @param {string} commands
* @param {string[]} scopes
* @param {string} installationId
* @param {string} providerRepositoryId
* @param {string} providerBranch
* @param {boolean} providerSilentMode
* @param {string} providerRootDirectory
* @param {string} specification
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
update(params: {
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>;
/**
* Update function by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} name - Function name. Max length: 128 chars.
* @param {Runtime} runtime - Execution runtime.
* @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
* @param {string[]} events - Events list. Maximum of 100 events are allowed.
* @param {string} schedule - Schedule CRON syntax.
* @param {number} timeout - Maximum execution time in seconds.
* @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster.
* @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory".
* @param {string} commands - Build Commands.
* @param {string[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the function
* @param {string} providerBranch - Production branch for the repo linked to the function
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to function code in the linked repo.
* @param {string} specification - Runtime specification for the function and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
update(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>;
/**
* Delete function
*
* Delete a function by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
functionId: string;
}): Promise<{}>;
/**
* Delete a function by its unique ID.
*
* @param {string} functionId - Function ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(functionId: string): Promise<{}>;
/**
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
* List deployments
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
*/
updateFunctionDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Function>;
/**
* Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.
* Get a list of all the project&#039;s code deployments. You can use the query params to filter your results.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Function>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.functionId - Function ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} functionId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
*/
listDeployments(params: {
functionId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.DeploymentList>;
listDeployments(functionId: string, queries?: string[], search?: string): Promise<Models.DeploymentList>;
/**
* Get a list of all the function's code deployments. You can use the query params to filter your results.
* Create deployment
*
* @param {string} functionId - Function ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>;
/**
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you&#039;ll need to update the function&#039;s deployment to use your new deployment UID.
This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
Use the &quot;command&quot; param to set the entrypoint used to execute your code.
*
* This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
*
* Use the "command" param to set the entrypoint used to execute your code.
*
* @param {string} params.functionId - Function ID.
* @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @param {string} params.entrypoint - Entrypoint File.
* @param {string} params.commands - Build Commands.
* @param {string} functionId
* @param {File} code
* @param {boolean} activate
* @param {string} entrypoint
* @param {string} commands
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDeployment(params: {
functionId: string;
code: File;
activate: boolean;
entrypoint?: string;
commands?: string;
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.Deployment>;
/**
* Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.
*
* This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions).
*
* Use the "command" param to set the entrypoint used to execute your code.
*
* @param {string} functionId - Function ID.
* @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @param {string} entrypoint - Entrypoint File.
* @param {string} commands - Build Commands.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): 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.
* Get deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {string} params.buildId - Build unique ID.
* Get a code deployment by its unique ID.
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDuplicateDeployment(params: {
functionId: string;
deploymentId: string;
buildId?: 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.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {string} buildId - Build unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.repository - Repository name of the template.
* @param {string} params.owner - The name of the owner of the template.
* @param {string} params.rootDirectory - Path to function code in the template repo.
* @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createTemplateDeployment(params: {
functionId: string;
repository: string;
owner: string;
rootDirectory: string;
type: TemplateReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.
*
* @param {string} functionId - Function ID.
* @param {string} repository - Repository name of the template.
* @param {string} owner - The name of the owner of the template.
* @param {string} rootDirectory - Path to function code in the template repo.
* @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* 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} params.functionId - Function ID.
* @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit
* @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createVcsDeployment(params: {
functionId: string;
type: VCSReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* 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 - Function ID.
* @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit
* @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Get a function deployment by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
getDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* Get a function deployment by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Delete a code deployment by its unique ID.
* Update deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* 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<{}>}
* @returns {Promise<Models.Function>}
*/
deleteDeployment(params: {
functionId: string;
deploymentId: string;
}): Promise<{}>;
updateDeployment(functionId: string, deploymentId: string): Promise<Models.Function>;
/**
* Delete deployment
*
* Delete a code deployment by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteDeployment(functionId: string, deploymentId: string): Promise<{}>;
/**
* 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.
* Rebuild deployment
*
* @param {string} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output".
*
* @param {string} functionId
* @param {string} deploymentId
* @param {string} buildId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}>;
/**
* Cancel deployment
*
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<Models.Build>}
*/
updateDeploymentBuild(functionId: string, deploymentId: string): Promise<Models.Build>;
/**
* Download deployment
*
* Get a Deployment&#039;s contents by its unique ID. This endpoint supports range requests for partial or streaming file download.
*
* @param {string} functionId
* @param {string} deploymentId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getDeploymentDownload(params: {
functionId: string;
deploymentId: string;
type?: DeploymentDownloadType;
}): Promise<ArrayBuffer>;
getDeploymentDownload(functionId: string, deploymentId: string): Promise<ArrayBuffer>;
/**
* 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.
* List executions
*
* @param {string} functionId - Function ID.
* @param {string} deploymentId - Deployment ID.
* @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>;
/**
* 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} params.functionId - Function ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
updateDeploymentStatus(params: {
functionId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* 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 - Function ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
*
* @param {string} params.functionId - Function ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} functionId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
*/
listExecutions(params: {
functionId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ExecutionList>;
listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>;
/**
* Get a list of all the current user function execution logs. You can use the query params to filter your results.
* Create execution
*
* @param {string} functionId - Function ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>;
/**
* 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.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.body - HTTP body of execution. Default value is empty string.
* @param {boolean} params.async - Execute code in the background. Default value is false.
* @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
* @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST.
* @param {object} params.headers - HTTP headers of execution. Defaults to empty.
* @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
* @param {string} functionId
* @param {string} body
* @param {boolean} async
* @param {string} xpath
* @param {ExecutionMethod} method
* @param {object} headers
* @param {string} scheduledAt
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
createExecution(params: {
functionId: string;
body?: string;
async?: boolean;
xpath?: string;
method?: ExecutionMethod;
headers?: object;
scheduledAt?: string;
}): Promise<Models.Execution>;
/**
* 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.
*
* @param {string} functionId - Function ID.
* @param {string} body - HTTP body of execution. Default value is empty string.
* @param {boolean} async - Execute code in the background. Default value is false.
* @param {string} xpath - HTTP path of execution. Path can include query params. Default value is /
* @param {ExecutionMethod} method - HTTP method of execution. Default value is POST.
* @param {object} headers - HTTP headers of execution. Defaults to empty.
* @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>;
/**
* Get execution
*
* Get a function execution log by its unique ID.
*
* @param {string} params.functionId - Function ID.
* @param {string} params.executionId - Execution ID.
* @param {string} functionId
* @param {string} executionId
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
getExecution(params: {
functionId: string;
executionId: string;
}): Promise<Models.Execution>;
/**
* Get a function execution log by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} executionId - Execution ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
/**
* Delete a function execution by its unique ID.
* Delete execution
*
* @param {string} params.functionId - Function ID.
* @param {string} params.executionId - Execution ID.
* Delete a function execution by its unique ID.
*
* @param {string} functionId
* @param {string} executionId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteExecution(params: {
functionId: string;
executionId: string;
}): Promise<{}>;
/**
* Delete a function execution by its unique ID.
*
* @param {string} functionId - Function ID.
* @param {string} executionId - Execution ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteExecution(functionId: string, executionId: string): Promise<{}>;
/**
* List variables
*
* Get a list of all variables of a specific function.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
*/
listVariables(params: {
functionId: string;
}): Promise<Models.VariableList>;
/**
* Get a list of all variables of a specific function.
*
* @param {string} functionId - Function unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listVariables(functionId: string): Promise<Models.VariableList>;
/**
* Create variable
*
* Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @param {string} functionId
* @param {string} key
* @param {string} value
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
createVariable(params: {
functionId: string;
key: string;
value: string;
secret?: boolean;
}): Promise<Models.Variable>;
createVariable(functionId: string, key: string, value: string): Promise<Models.Variable>;
/**
* Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.
* Get variable
*
* @param {string} functionId - Function unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVariable(functionId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} functionId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
getVariable(params: {
functionId: string;
variableId: string;
}): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getVariable(functionId: string, variableId: string): Promise<Models.Variable>;
/**
* Update variable
*
* Update variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @param {string} functionId
* @param {string} variableId
* @param {string} key
* @param {string} value
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
updateVariable(params: {
functionId: string;
variableId: string;
key: string;
value?: string;
secret?: boolean;
}): Promise<Models.Variable>;
updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
* Delete variable
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateVariable(functionId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
/**
* Delete a variable by its unique ID.
*
* @param {string} params.functionId - Function unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} functionId
* @param {string} variableId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteVariable(params: {
functionId: string;
variableId: string;
}): Promise<{}>;
/**
* Delete a variable by its unique ID.
*
* @param {string} functionId - Function unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteVariable(functionId: string, variableId: string): Promise<{}>;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,57 +1,29 @@
import { Client } from '../client.mjs';
import '../models.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
import '../query.mjs';
declare class Graphql {
client: Client;
constructor(client: Client);
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} params.query - The query or queries to execute.
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
query(params: {
query: object;
}): Promise<{}>;
/**
* Execute a GraphQL mutation.
*
* @param {object} query - The query or queries to execute.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
query(query: object): Promise<{}>;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} params.query - The query or queries to execute.
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
mutation(params: {
query: object;
}): Promise<{}>;
/**
* Execute a GraphQL mutation.
*
* @param {object} query - The query or queries to execute.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
mutation(query: object): Promise<{}>;
}

View File

@@ -1,57 +1,29 @@
import { Client } from '../client.js';
import '../models.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
import '../query.js';
declare class Graphql {
client: Client;
constructor(client: Client);
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} params.query - The query or queries to execute.
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
query(params: {
query: object;
}): Promise<{}>;
/**
* Execute a GraphQL mutation.
*
* @param {object} query - The query or queries to execute.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
query(query: object): Promise<{}>;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} params.query - The query or queries to execute.
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
mutation(params: {
query: object;
}): Promise<{}>;
/**
* Execute a GraphQL mutation.
*
* @param {object} query - The query or queries to execute.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
mutation(query: object): Promise<{}>;
}

View File

@@ -6,16 +6,16 @@ class Graphql {
constructor(client) {
this.client = client;
}
query(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "query" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
query: paramsOrFirst
};
}
const query = params.query;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async query(query) {
if (typeof query === "undefined") {
throw new client.AppwriteException('Missing required parameter: "query"');
}
@@ -29,23 +29,23 @@ class Graphql {
"x-sdk-graphql": "true",
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
mutation(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "query" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
query: paramsOrFirst
};
}
const query = params.query;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async mutation(query) {
if (typeof query === "undefined") {
throw new client.AppwriteException('Missing required parameter: "query"');
}
@@ -59,7 +59,7 @@ class Graphql {
"x-sdk-graphql": "true",
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -5,16 +5,16 @@ var Graphql = class {
constructor(client) {
this.client = client;
}
query(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "query" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
query: paramsOrFirst
};
}
const query = params.query;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async query(query) {
if (typeof query === "undefined") {
throw new AppwriteException('Missing required parameter: "query"');
}
@@ -28,23 +28,23 @@ var Graphql = class {
"x-sdk-graphql": "true",
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
mutation(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "query" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
query: paramsOrFirst
};
}
const query = params.query;
/**
* GraphQL endpoint
*
* Execute a GraphQL mutation.
*
* @param {object} query
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async mutation(query) {
if (typeof query === "undefined") {
throw new AppwriteException('Missing required parameter: "query"');
}
@@ -58,7 +58,7 @@ var Graphql = class {
"x-sdk-graphql": "true",
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -2,21 +2,13 @@ import { Client } from '../client.mjs';
import { Models } from '../models.mjs';
import { Name } from '../enums/name.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Health {
client: Client;
constructor(client: Client);
/**
* Get HTTP
*
* Check the Appwrite HTTP server is up and responsive.
*
* @throws {AppwriteException}
@@ -24,6 +16,8 @@ declare class Health {
*/
get(): Promise<Models.HealthStatus>;
/**
* Get antivirus
*
* Check the Appwrite Antivirus server is up and connection is successful.
*
* @throws {AppwriteException}
@@ -31,6 +25,8 @@ declare class Health {
*/
getAntivirus(): Promise<Models.HealthAntivirus>;
/**
* Get cache
*
* Check the Appwrite in-memory cache servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -40,23 +36,16 @@ declare class Health {
/**
* Get the SSL certificate for a domain
*
* @param {string} params.domain - string
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
*/
getCertificate(params?: {
domain?: string;
}): Promise<Models.HealthCertificate>;
/**
* Get the SSL certificate for a domain
*
* @param {string} domain - string
* @param {string} domain
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getCertificate(domain?: string): Promise<Models.HealthCertificate>;
/**
* Get DB
*
* Check the Appwrite database servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -64,6 +53,8 @@ declare class Health {
*/
getDB(): Promise<Models.HealthStatus>;
/**
* Get pubsub
*
* Check the Appwrite pub-sub servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -71,261 +62,150 @@ declare class Health {
*/
getPubSub(): Promise<Models.HealthStatus>;
/**
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
* Get queue
*
* Check the Appwrite queue messaging servers are up and connection is successful.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @returns {Promise<Models.HealthStatus>}
*/
getQueueBuilds(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
getQueue(): Promise<Models.HealthStatus>;
/**
* Get builds queue
*
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get certificates queue
*
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueCertificates(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get databases queue
*
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} params.name - Queue name for which to check the queue size
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {string} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueDatabases(params?: {
name?: string;
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} name - Queue name for which to check the queue size
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>;
/**
* Get deletes queue
*
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueDeletes(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get number of failed queue jobs
*
* Returns the amount of failed jobs in a given queue.
*
*
* @param {Name} params.name - The name of the queue
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {Name} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getFailedJobs(params: {
name: Name;
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Returns the amount of failed jobs in a given queue.
*
*
* @param {Name} name - The name of the queue
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>;
/**
* Get functions queue
*
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueFunctions(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get logs queue
*
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueLogs(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueLogs(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get mails queue
*
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMails(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMails(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get messaging queue
*
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMessaging(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get migrations queue
*
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMigrations(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
* Get usage queue
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueStatsResources(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueUsage(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueUsage(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
* Get usage dump queue
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueWebhooks(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
getQueueUsageDump(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get webhooks queue
*
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get storage
*
* Check the Appwrite storage device is up and connection is successful.
*
* @throws {AppwriteException}
@@ -333,6 +213,8 @@ declare class Health {
*/
getStorage(): Promise<Models.HealthStatus>;
/**
* Get local storage
*
* Check the Appwrite local storage device is up and connection is successful.
*
* @throws {AppwriteException}
@@ -340,6 +222,8 @@ declare class Health {
*/
getStorageLocal(): Promise<Models.HealthStatus>;
/**
* Get time
*
* Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.
*
* @throws {AppwriteException}

View File

@@ -2,21 +2,13 @@ import { Client } from '../client.js';
import { Models } from '../models.js';
import { Name } from '../enums/name.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Health {
client: Client;
constructor(client: Client);
/**
* Get HTTP
*
* Check the Appwrite HTTP server is up and responsive.
*
* @throws {AppwriteException}
@@ -24,6 +16,8 @@ declare class Health {
*/
get(): Promise<Models.HealthStatus>;
/**
* Get antivirus
*
* Check the Appwrite Antivirus server is up and connection is successful.
*
* @throws {AppwriteException}
@@ -31,6 +25,8 @@ declare class Health {
*/
getAntivirus(): Promise<Models.HealthAntivirus>;
/**
* Get cache
*
* Check the Appwrite in-memory cache servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -40,23 +36,16 @@ declare class Health {
/**
* Get the SSL certificate for a domain
*
* @param {string} params.domain - string
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
*/
getCertificate(params?: {
domain?: string;
}): Promise<Models.HealthCertificate>;
/**
* Get the SSL certificate for a domain
*
* @param {string} domain - string
* @param {string} domain
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getCertificate(domain?: string): Promise<Models.HealthCertificate>;
/**
* Get DB
*
* Check the Appwrite database servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -64,6 +53,8 @@ declare class Health {
*/
getDB(): Promise<Models.HealthStatus>;
/**
* Get pubsub
*
* Check the Appwrite pub-sub servers are up and connection is successful.
*
* @throws {AppwriteException}
@@ -71,261 +62,150 @@ declare class Health {
*/
getPubSub(): Promise<Models.HealthStatus>;
/**
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
* Get queue
*
* Check the Appwrite queue messaging servers are up and connection is successful.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @returns {Promise<Models.HealthStatus>}
*/
getQueueBuilds(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
getQueue(): Promise<Models.HealthStatus>;
/**
* Get builds queue
*
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get certificates queue
*
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueCertificates(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get databases queue
*
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} params.name - Queue name for which to check the queue size
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {string} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueDatabases(params?: {
name?: string;
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} name - Queue name for which to check the queue size
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>;
/**
* Get deletes queue
*
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueDeletes(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get number of failed queue jobs
*
* Returns the amount of failed jobs in a given queue.
*
*
* @param {Name} params.name - The name of the queue
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {Name} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getFailedJobs(params: {
name: Name;
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Returns the amount of failed jobs in a given queue.
*
*
* @param {Name} name - The name of the queue
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>;
/**
* Get functions queue
*
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueFunctions(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get logs queue
*
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueLogs(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueLogs(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get mails queue
*
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMails(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMails(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get messaging queue
*
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMessaging(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get migrations queue
*
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueMigrations(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
* Get usage queue
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueStatsResources(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueUsage(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
/**
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueUsage(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
* Get usage dump queue
*
* @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
getQueueWebhooks(params?: {
threshold?: number;
}): Promise<Models.HealthQueue>;
getQueueUsageDump(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get webhooks queue
*
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>;
/**
* Get storage
*
* Check the Appwrite storage device is up and connection is successful.
*
* @throws {AppwriteException}
@@ -333,6 +213,8 @@ declare class Health {
*/
getStorage(): Promise<Models.HealthStatus>;
/**
* Get local storage
*
* Check the Appwrite local storage device is up and connection is successful.
*
* @throws {AppwriteException}
@@ -340,6 +222,8 @@ declare class Health {
*/
getStorageLocal(): Promise<Models.HealthStatus>;
/**
* Get time
*
* Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.
*
* @throws {AppwriteException}

View File

@@ -7,17 +7,21 @@ class Health {
this.client = client;
}
/**
* Get HTTP
*
* Check the Appwrite HTTP server is up and responsive.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
get() {
async get() {
const apiPath = "/health";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -25,17 +29,21 @@ class Health {
);
}
/**
* Get antivirus
*
* Check the Appwrite Antivirus server is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthAntivirus>}
*/
getAntivirus() {
async getAntivirus() {
const apiPath = "/health/anti-virus";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -43,41 +51,47 @@ class Health {
);
}
/**
* Get cache
*
* Check the Appwrite in-memory cache servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getCache() {
async getCache() {
const apiPath = "/health/cache";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getCertificate(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
domain: paramsOrFirst
};
}
const domain = params.domain;
/**
* Get the SSL certificate for a domain
*
* Get the SSL certificate for a domain
*
* @param {string} domain
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
*/
async getCertificate(domain) {
const apiPath = "/health/certificate";
const payload = {};
if (typeof domain !== "undefined") {
payload["domain"] = domain;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -85,17 +99,21 @@ class Health {
);
}
/**
* Get DB
*
* Check the Appwrite database servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getDB() {
async getDB() {
const apiPath = "/health/db";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -103,83 +121,112 @@ class Health {
);
}
/**
* Get pubsub
*
* Check the Appwrite pub-sub servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getPubSub() {
async getPubSub() {
const apiPath = "/health/pubsub";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueBuilds(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get queue
*
* Check the Appwrite queue messaging servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
async getQueue() {
const apiPath = "/health/queue";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* Get builds queue
*
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueBuilds(threshold) {
const apiPath = "/health/queue/builds";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueCertificates(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get certificates queue
*
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueCertificates(threshold) {
const apiPath = "/health/queue/certificates";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueDatabases(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
threshold: rest[0]
};
}
const name = params.name;
const threshold = params.threshold;
/**
* Get databases queue
*
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueDatabases(name, threshold) {
const apiPath = "/health/queue/databases";
const payload = {};
if (typeof name !== "undefined") {
@@ -189,50 +236,54 @@ class Health {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueDeletes(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get deletes queue
*
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueDeletes(threshold) {
const apiPath = "/health/queue/deletes";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getFailedJobs(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "name" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
threshold: rest[0]
};
}
const name = params.name;
const threshold = params.threshold;
/**
* Get number of failed queue jobs
*
* Returns the amount of failed jobs in a given queue.
*
* @param {Name} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getFailedJobs(name, threshold) {
if (typeof name === "undefined") {
throw new client.AppwriteException('Missing required parameter: "name"');
}
@@ -242,200 +293,218 @@ class Health {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueFunctions(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get functions queue
*
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueFunctions(threshold) {
const apiPath = "/health/queue/functions";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueLogs(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get logs queue
*
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueLogs(threshold) {
const apiPath = "/health/queue/logs";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMails(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get mails queue
*
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMails(threshold) {
const apiPath = "/health/queue/mails";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMessaging(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get messaging queue
*
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMessaging(threshold) {
const apiPath = "/health/queue/messaging";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMigrations(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get migrations queue
*
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMigrations(threshold) {
const apiPath = "/health/queue/migrations";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueStatsResources(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
const apiPath = "/health/queue/stats-resources";
/**
* Get usage queue
*
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueUsage(threshold) {
const apiPath = "/health/queue/usage";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueUsage(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
const apiPath = "/health/queue/stats-usage";
/**
* Get usage dump queue
*
* Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueUsageDump(threshold) {
const apiPath = "/health/queue/usage-dump";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueWebhooks(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get webhooks queue
*
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueWebhooks(threshold) {
const apiPath = "/health/queue/webhooks";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -443,17 +512,21 @@ class Health {
);
}
/**
* Get storage
*
* Check the Appwrite storage device is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getStorage() {
async getStorage() {
const apiPath = "/health/storage";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -461,17 +534,21 @@ class Health {
);
}
/**
* Get local storage
*
* Check the Appwrite local storage device is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getStorageLocal() {
async getStorageLocal() {
const apiPath = "/health/storage/local";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -479,17 +556,21 @@ class Health {
);
}
/**
* Get time
*
* Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthTime>}
*/
getTime() {
async getTime() {
const apiPath = "/health/time";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -6,17 +6,21 @@ var Health = class {
this.client = client;
}
/**
* Get HTTP
*
* Check the Appwrite HTTP server is up and responsive.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
get() {
async get() {
const apiPath = "/health";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -24,17 +28,21 @@ var Health = class {
);
}
/**
* Get antivirus
*
* Check the Appwrite Antivirus server is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthAntivirus>}
*/
getAntivirus() {
async getAntivirus() {
const apiPath = "/health/anti-virus";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -42,41 +50,47 @@ var Health = class {
);
}
/**
* Get cache
*
* Check the Appwrite in-memory cache servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getCache() {
async getCache() {
const apiPath = "/health/cache";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getCertificate(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
domain: paramsOrFirst
};
}
const domain = params.domain;
/**
* Get the SSL certificate for a domain
*
* Get the SSL certificate for a domain
*
* @param {string} domain
* @throws {AppwriteException}
* @returns {Promise<Models.HealthCertificate>}
*/
async getCertificate(domain) {
const apiPath = "/health/certificate";
const payload = {};
if (typeof domain !== "undefined") {
payload["domain"] = domain;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -84,17 +98,21 @@ var Health = class {
);
}
/**
* Get DB
*
* Check the Appwrite database servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getDB() {
async getDB() {
const apiPath = "/health/db";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -102,83 +120,112 @@ var Health = class {
);
}
/**
* Get pubsub
*
* Check the Appwrite pub-sub servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getPubSub() {
async getPubSub() {
const apiPath = "/health/pubsub";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueBuilds(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get queue
*
* Check the Appwrite queue messaging servers are up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
async getQueue() {
const apiPath = "/health/queue";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* Get builds queue
*
* Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueBuilds(threshold) {
const apiPath = "/health/queue/builds";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueCertificates(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get certificates queue
*
* Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueCertificates(threshold) {
const apiPath = "/health/queue/certificates";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueDatabases(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
threshold: rest[0]
};
}
const name = params.name;
const threshold = params.threshold;
/**
* Get databases queue
*
* Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {string} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueDatabases(name, threshold) {
const apiPath = "/health/queue/databases";
const payload = {};
if (typeof name !== "undefined") {
@@ -188,50 +235,54 @@ var Health = class {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueDeletes(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get deletes queue
*
* Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueDeletes(threshold) {
const apiPath = "/health/queue/deletes";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getFailedJobs(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "name" in paramsOrFirst) {
params = paramsOrFirst || {};
} else {
params = {
name: paramsOrFirst,
threshold: rest[0]
};
}
const name = params.name;
const threshold = params.threshold;
/**
* Get number of failed queue jobs
*
* Returns the amount of failed jobs in a given queue.
*
* @param {Name} name
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getFailedJobs(name, threshold) {
if (typeof name === "undefined") {
throw new AppwriteException('Missing required parameter: "name"');
}
@@ -241,200 +292,218 @@ var Health = class {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueFunctions(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get functions queue
*
* Get the number of function executions that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueFunctions(threshold) {
const apiPath = "/health/queue/functions";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueLogs(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get logs queue
*
* Get the number of logs that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueLogs(threshold) {
const apiPath = "/health/queue/logs";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMails(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get mails queue
*
* Get the number of mails that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMails(threshold) {
const apiPath = "/health/queue/mails";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMessaging(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get messaging queue
*
* Get the number of messages that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMessaging(threshold) {
const apiPath = "/health/queue/messaging";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueMigrations(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get migrations queue
*
* Get the number of migrations that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueMigrations(threshold) {
const apiPath = "/health/queue/migrations";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueStatsResources(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
const apiPath = "/health/queue/stats-resources";
/**
* Get usage queue
*
* Get the number of metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueUsage(threshold) {
const apiPath = "/health/queue/usage";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueUsage(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
const apiPath = "/health/queue/stats-usage";
/**
* Get usage dump queue
*
* Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueUsageDump(threshold) {
const apiPath = "/health/queue/usage-dump";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
getQueueWebhooks(paramsOrFirst) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
threshold: paramsOrFirst
};
}
const threshold = params.threshold;
/**
* Get webhooks queue
*
* Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.
*
* @param {number} threshold
* @throws {AppwriteException}
* @returns {Promise<Models.HealthQueue>}
*/
async getQueueWebhooks(threshold) {
const apiPath = "/health/queue/webhooks";
const payload = {};
if (typeof threshold !== "undefined") {
payload["threshold"] = threshold;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -442,17 +511,21 @@ var Health = class {
);
}
/**
* Get storage
*
* Check the Appwrite storage device is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getStorage() {
async getStorage() {
const apiPath = "/health/storage";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -460,17 +533,21 @@ var Health = class {
);
}
/**
* Get local storage
*
* Check the Appwrite local storage device is up and connection is successful.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthStatus>}
*/
getStorageLocal() {
async getStorageLocal() {
const apiPath = "/health/storage/local";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -478,17 +555,21 @@ var Health = class {
);
}
/**
* Get time
*
* Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.
*
* @throws {AppwriteException}
* @returns {Promise<Models.HealthTime>}
*/
getTime() {
async getTime() {
const apiPath = "/health/time";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -1,30 +1,24 @@
import { Client } from '../client.mjs';
import { Models } from '../models.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Locale {
client: Client;
constructor(client: Client);
/**
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
* Get user locale
*
* ([IP Geolocation by DB-IP](https://db-ip.com))
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
get(): Promise<Models.Locale>;
/**
* List locale codes
*
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
* @throws {AppwriteException}
@@ -32,6 +26,8 @@ declare class Locale {
*/
listCodes(): Promise<Models.LocaleCodeList>;
/**
* List continents
*
* List of all continents. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -39,6 +35,8 @@ declare class Locale {
*/
listContinents(): Promise<Models.ContinentList>;
/**
* List countries
*
* List of all countries. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -46,6 +44,8 @@ declare class Locale {
*/
listCountries(): Promise<Models.CountryList>;
/**
* List EU countries
*
* List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -53,6 +53,8 @@ declare class Locale {
*/
listCountriesEU(): Promise<Models.CountryList>;
/**
* List countries phone codes
*
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -60,6 +62,8 @@ declare class Locale {
*/
listCountriesPhones(): Promise<Models.PhoneList>;
/**
* List currencies
*
* List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -67,6 +71,8 @@ declare class Locale {
*/
listCurrencies(): Promise<Models.CurrencyList>;
/**
* List languages
*
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
*
* @throws {AppwriteException}

View File

@@ -1,30 +1,24 @@
import { Client } from '../client.js';
import { Models } from '../models.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Locale {
client: Client;
constructor(client: Client);
/**
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
* Get user locale
*
* ([IP Geolocation by DB-IP](https://db-ip.com))
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
get(): Promise<Models.Locale>;
/**
* List locale codes
*
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
* @throws {AppwriteException}
@@ -32,6 +26,8 @@ declare class Locale {
*/
listCodes(): Promise<Models.LocaleCodeList>;
/**
* List continents
*
* List of all continents. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -39,6 +35,8 @@ declare class Locale {
*/
listContinents(): Promise<Models.ContinentList>;
/**
* List countries
*
* List of all countries. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -46,6 +44,8 @@ declare class Locale {
*/
listCountries(): Promise<Models.CountryList>;
/**
* List EU countries
*
* List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -53,6 +53,8 @@ declare class Locale {
*/
listCountriesEU(): Promise<Models.CountryList>;
/**
* List countries phone codes
*
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -60,6 +62,8 @@ declare class Locale {
*/
listCountriesPhones(): Promise<Models.PhoneList>;
/**
* List currencies
*
* List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
@@ -67,6 +71,8 @@ declare class Locale {
*/
listCurrencies(): Promise<Models.CurrencyList>;
/**
* List languages
*
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
*
* @throws {AppwriteException}

View File

@@ -5,19 +5,23 @@ class Locale {
this.client = client;
}
/**
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
*
* ([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
get() {
* Get user locale
*
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
async get() {
const apiPath = "/locale";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -25,17 +29,21 @@ class Locale {
);
}
/**
* List locale codes
*
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
* @throws {AppwriteException}
* @returns {Promise<Models.LocaleCodeList>}
*/
listCodes() {
async listCodes() {
const apiPath = "/locale/codes";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -43,17 +51,21 @@ class Locale {
);
}
/**
* List continents
*
* List of all continents. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.ContinentList>}
*/
listContinents() {
async listContinents() {
const apiPath = "/locale/continents";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -61,17 +73,21 @@ class Locale {
);
}
/**
* List countries
*
* List of all countries. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountries() {
async listCountries() {
const apiPath = "/locale/countries";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -79,17 +95,21 @@ class Locale {
);
}
/**
* List EU countries
*
* List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountriesEU() {
async listCountriesEU() {
const apiPath = "/locale/countries/eu";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -97,17 +117,21 @@ class Locale {
);
}
/**
* List countries phone codes
*
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.PhoneList>}
*/
listCountriesPhones() {
async listCountriesPhones() {
const apiPath = "/locale/countries/phones";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -115,17 +139,21 @@ class Locale {
);
}
/**
* List currencies
*
* List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CurrencyList>}
*/
listCurrencies() {
async listCurrencies() {
const apiPath = "/locale/currencies";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -133,17 +161,21 @@ class Locale {
);
}
/**
* List languages
*
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.LanguageList>}
*/
listLanguages() {
async listLanguages() {
const apiPath = "/locale/languages";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -4,19 +4,23 @@ var Locale = class {
this.client = client;
}
/**
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
*
* ([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
get() {
* Get user locale
*
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
([IP Geolocation by DB-IP](https://db-ip.com))
*
* @throws {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
async get() {
const apiPath = "/locale";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -24,17 +28,21 @@ var Locale = class {
);
}
/**
* List locale codes
*
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
* @throws {AppwriteException}
* @returns {Promise<Models.LocaleCodeList>}
*/
listCodes() {
async listCodes() {
const apiPath = "/locale/codes";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -42,17 +50,21 @@ var Locale = class {
);
}
/**
* List continents
*
* List of all continents. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.ContinentList>}
*/
listContinents() {
async listContinents() {
const apiPath = "/locale/continents";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -60,17 +72,21 @@ var Locale = class {
);
}
/**
* List countries
*
* List of all countries. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountries() {
async listCountries() {
const apiPath = "/locale/countries";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -78,17 +94,21 @@ var Locale = class {
);
}
/**
* List EU countries
*
* List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountriesEU() {
async listCountriesEU() {
const apiPath = "/locale/countries/eu";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -96,17 +116,21 @@ var Locale = class {
);
}
/**
* List countries phone codes
*
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.PhoneList>}
*/
listCountriesPhones() {
async listCountriesPhones() {
const apiPath = "/locale/countries/phones";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -114,17 +138,21 @@ var Locale = class {
);
}
/**
* List currencies
*
* List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CurrencyList>}
*/
listCurrencies() {
async listCurrencies() {
const apiPath = "/locale/currencies";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -132,17 +160,21 @@ var Locale = class {
);
}
/**
* List languages
*
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.LanguageList>}
*/
listLanguages() {
async listLanguages() {
const apiPath = "/locale/languages";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,705 +0,0 @@
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 { TemplateReferenceType } from '../enums/template-reference-type.mjs';
import { VCSReferenceType } from '../enums/vcs-reference-type.mjs';
import { DeploymentDownloadType } from '../enums/deployment-download-type.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.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[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.SiteList>}
*/
list(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.SiteList>;
/**
* Get a list of all the project's sites. You can use the query params to filter your results.
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.SiteList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>;
/**
* Create a new site.
*
* @param {string} params.siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Site name. Max length: 128 chars.
* @param {Framework} params.framework - Sites framework.
* @param {BuildRuntime} params.buildRuntime - Runtime to use during build step.
* @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} params.timeout - Maximum request time in seconds.
* @param {string} params.installCommand - Install Command.
* @param {string} params.buildCommand - Build Command.
* @param {string} params.outputDirectory - Output Directory for site.
* @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.fallbackFile - Fallback file for single page application sites.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} params.providerBranch - Production branch for the repo linked to the site.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to site code in the linked repo.
* @param {string} params.specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
create(params: {
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>;
/**
* Create a new site.
*
* @param {string} siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Site name. Max length: 128 chars.
* @param {Framework} framework - Sites framework.
* @param {BuildRuntime} buildRuntime - Runtime to use during build step.
* @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} timeout - Maximum request time in seconds.
* @param {string} installCommand - Install Command.
* @param {string} buildCommand - Build Command.
* @param {string} outputDirectory - Output Directory for site.
* @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} fallbackFile - Fallback file for single page application sites.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} providerBranch - Production branch for the repo linked to the site.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to site code in the linked repo.
* @param {string} specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
get(params: {
siteId: string;
}): Promise<Models.Site>;
/**
* Get a site by its unique ID.
*
* @param {string} siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(siteId: string): Promise<Models.Site>;
/**
* Update site by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.name - Site name. Max length: 128 chars.
* @param {Framework} params.framework - Sites framework.
* @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} params.timeout - Maximum request time in seconds.
* @param {string} params.installCommand - Install Command.
* @param {string} params.buildCommand - Build Command.
* @param {string} params.outputDirectory - Output Directory for site.
* @param {BuildRuntime} params.buildRuntime - Runtime to use during build step.
* @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} params.fallbackFile - Fallback file for single page application sites.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} params.providerBranch - Production branch for the repo linked to the site.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to site code in the linked repo.
* @param {string} params.specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
update(params: {
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>;
/**
* Update site by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} name - Site name. Max length: 128 chars.
* @param {Framework} framework - Sites framework.
* @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} timeout - Maximum request time in seconds.
* @param {string} installCommand - Install Command.
* @param {string} buildCommand - Build Command.
* @param {string} outputDirectory - Output Directory for site.
* @param {BuildRuntime} buildRuntime - Runtime to use during build step.
* @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} fallbackFile - Fallback file for single page application sites.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} providerBranch - Production branch for the repo linked to the site.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to site code in the linked repo.
* @param {string} specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
siteId: string;
}): Promise<{}>;
/**
* Delete a site by its unique ID.
*
* @param {string} siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
updateSiteDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Site>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
*/
listDeployments(params: {
siteId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.DeploymentList>;
/**
* Get a list of all the site's code deployments. You can use the query params to filter your results.
*
* @param {string} siteId - Site ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): 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 site's deployment to use your new deployment ID.
*
* @param {string} params.siteId - Site ID.
* @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @param {string} params.installCommand - Install Commands.
* @param {string} params.buildCommand - Build Commands.
* @param {string} params.outputDirectory - Output Directory.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDeployment(params: {
siteId: string;
code: File;
activate: boolean;
installCommand?: string;
buildCommand?: string;
outputDirectory?: string;
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.Deployment>;
/**
* 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 site's deployment to use your new deployment ID.
*
* @param {string} siteId - Site ID.
* @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @param {string} installCommand - Install Commands.
* @param {string} buildCommand - Build Commands.
* @param {string} outputDirectory - Output Directory.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDuplicateDeployment(params: {
siteId: string;
deploymentId: string;
}): 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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/products/sites/templates) to find the template details.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.repository - Repository name of the template.
* @param {string} params.owner - The name of the owner of the template.
* @param {string} params.rootDirectory - Path to site code in the template repo.
* @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createTemplateDeployment(params: {
siteId: string;
repository: string;
owner: string;
rootDirectory: string;
type: TemplateReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.
*
* @param {string} siteId - Site ID.
* @param {string} repository - Repository name of the template.
* @param {string} owner - The name of the owner of the template.
* @param {string} rootDirectory - Path to site code in the template repo.
* @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: 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} params.siteId - Site ID.
* @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit
* @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createVcsDeployment(params: {
siteId: string;
type: VCSReferenceType;
reference: 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 - Site ID.
* @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit
* @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Get a site deployment by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
getDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* Get a site deployment by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Delete a site deployment by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<{}>;
/**
* Delete a site deployment by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getDeploymentDownload(params: {
siteId: string;
deploymentId: string;
type?: DeploymentDownloadType;
}): Promise<ArrayBuffer>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
updateDeploymentStatus(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
*/
listLogs(params: {
siteId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ExecutionList>;
/**
* Get a list of all site logs. You can use the query params to filter your results.
*
* @param {string} siteId - Site ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>;
/**
* Get a site request log by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
getLog(params: {
siteId: string;
logId: string;
}): Promise<Models.Execution>;
/**
* Get a site request log by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getLog(siteId: string, logId: string): Promise<Models.Execution>;
/**
* Delete a site log by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteLog(params: {
siteId: string;
logId: string;
}): Promise<{}>;
/**
* Delete a site log by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteLog(siteId: string, logId: string): Promise<{}>;
/**
* Get a list of all variables of a specific site.
*
* @param {string} params.siteId - Site unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
*/
listVariables(params: {
siteId: string;
}): Promise<Models.VariableList>;
/**
* Get a list of all variables of a specific site.
*
* @param {string} siteId - Site unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
createVariable(params: {
siteId: string;
key: string;
value: string;
secret?: boolean;
}): Promise<Models.Variable>;
/**
* Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.
*
* @param {string} siteId - Site unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVariable(siteId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
getVariable(params: {
siteId: string;
variableId: string;
}): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getVariable(siteId: string, variableId: string): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
updateVariable(params: {
siteId: string;
variableId: string;
key: string;
value?: string;
secret?: boolean;
}): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateVariable(siteId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
/**
* Delete a variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteVariable(params: {
siteId: string;
variableId: string;
}): Promise<{}>;
/**
* Delete a variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteVariable(siteId: string, variableId: string): Promise<{}>;
}
export { Sites };

View File

@@ -1,705 +0,0 @@
import { Client, UploadProgress } from '../client.js';
import { Models } from '../models.js';
import { Framework } from '../enums/framework.js';
import { BuildRuntime } from '../enums/build-runtime.js';
import { Adapter } from '../enums/adapter.js';
import { TemplateReferenceType } from '../enums/template-reference-type.js';
import { VCSReferenceType } from '../enums/vcs-reference-type.js';
import { DeploymentDownloadType } from '../enums/deployment-download-type.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
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[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.SiteList>}
*/
list(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.SiteList>;
/**
* Get a list of all the project's sites. You can use the query params to filter your results.
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.SiteList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>;
/**
* Create a new site.
*
* @param {string} params.siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Site name. Max length: 128 chars.
* @param {Framework} params.framework - Sites framework.
* @param {BuildRuntime} params.buildRuntime - Runtime to use during build step.
* @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} params.timeout - Maximum request time in seconds.
* @param {string} params.installCommand - Install Command.
* @param {string} params.buildCommand - Build Command.
* @param {string} params.outputDirectory - Output Directory for site.
* @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.fallbackFile - Fallback file for single page application sites.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} params.providerBranch - Production branch for the repo linked to the site.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to site code in the linked repo.
* @param {string} params.specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
create(params: {
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>;
/**
* Create a new site.
*
* @param {string} siteId - Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Site name. Max length: 128 chars.
* @param {Framework} framework - Sites framework.
* @param {BuildRuntime} buildRuntime - Runtime to use during build step.
* @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} timeout - Maximum request time in seconds.
* @param {string} installCommand - Install Command.
* @param {string} buildCommand - Build Command.
* @param {string} outputDirectory - Output Directory for site.
* @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} fallbackFile - Fallback file for single page application sites.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} providerBranch - Production branch for the repo linked to the site.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to site code in the linked repo.
* @param {string} specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
get(params: {
siteId: string;
}): Promise<Models.Site>;
/**
* Get a site by its unique ID.
*
* @param {string} siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(siteId: string): Promise<Models.Site>;
/**
* Update site by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.name - Site name. Max length: 128 chars.
* @param {Framework} params.framework - Sites framework.
* @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} params.timeout - Maximum request time in seconds.
* @param {string} params.installCommand - Install Command.
* @param {string} params.buildCommand - Build Command.
* @param {string} params.outputDirectory - Output Directory for site.
* @param {BuildRuntime} params.buildRuntime - Runtime to use during build step.
* @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} params.fallbackFile - Fallback file for single page application sites.
* @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} params.providerBranch - Production branch for the repo linked to the site.
* @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} params.providerRootDirectory - Path to site code in the linked repo.
* @param {string} params.specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
update(params: {
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>;
/**
* Update site by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} name - Site name. Max length: 128 chars.
* @param {Framework} framework - Sites framework.
* @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
* @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
* @param {number} timeout - Maximum request time in seconds.
* @param {string} installCommand - Install Command.
* @param {string} buildCommand - Build Command.
* @param {string} outputDirectory - Output Directory for site.
* @param {BuildRuntime} buildRuntime - Runtime to use during build step.
* @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr
* @param {string} fallbackFile - Fallback file for single page application sites.
* @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment.
* @param {string} providerRepositoryId - Repository ID of the repo linked to the site.
* @param {string} providerBranch - Production branch for the repo linked to the site.
* @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
* @param {string} providerRootDirectory - Path to site code in the linked repo.
* @param {string} specification - Framework specification for the site and builds.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
siteId: string;
}): Promise<{}>;
/**
* Delete a site by its unique ID.
*
* @param {string} siteId - Site ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
*/
updateSiteDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Site>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Site>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
*/
listDeployments(params: {
siteId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.DeploymentList>;
/**
* Get a list of all the site's code deployments. You can use the query params to filter your results.
*
* @param {string} siteId - Site ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.DeploymentList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): 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 site's deployment to use your new deployment ID.
*
* @param {string} params.siteId - Site ID.
* @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @param {string} params.installCommand - Install Commands.
* @param {string} params.buildCommand - Build Commands.
* @param {string} params.outputDirectory - Output Directory.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDeployment(params: {
siteId: string;
code: File;
activate: boolean;
installCommand?: string;
buildCommand?: string;
outputDirectory?: string;
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.Deployment>;
/**
* 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 site's deployment to use your new deployment ID.
*
* @param {string} siteId - Site ID.
* @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @param {string} installCommand - Install Commands.
* @param {string} buildCommand - Build Commands.
* @param {string} outputDirectory - Output Directory.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createDuplicateDeployment(params: {
siteId: string;
deploymentId: string;
}): 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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/products/sites/templates) to find the template details.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.repository - Repository name of the template.
* @param {string} params.owner - The name of the owner of the template.
* @param {string} params.rootDirectory - Path to site code in the template repo.
* @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createTemplateDeployment(params: {
siteId: string;
repository: string;
owner: string;
rootDirectory: string;
type: TemplateReferenceType;
reference: string;
activate?: boolean;
}): Promise<Models.Deployment>;
/**
* Create a deployment based on a template.
*
* Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details.
*
* @param {string} siteId - Site ID.
* @param {string} repository - Repository name of the template.
* @param {string} owner - The name of the owner of the template.
* @param {string} rootDirectory - Path to site code in the template repo.
* @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag
* @param {string} reference - Reference value, can be a commit hash, branch name, or release tag
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: 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} params.siteId - Site ID.
* @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit
* @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} params.activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
createVcsDeployment(params: {
siteId: string;
type: VCSReferenceType;
reference: 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 - Site ID.
* @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit
* @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
* @param {boolean} activate - Automatically activate the deployment when it is finished building.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>;
/**
* Get a site deployment by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
getDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* Get a site deployment by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>;
/**
* Delete a site deployment by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteDeployment(params: {
siteId: string;
deploymentId: string;
}): Promise<{}>;
/**
* Delete a site deployment by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getDeploymentDownload(params: {
siteId: string;
deploymentId: string;
type?: DeploymentDownloadType;
}): Promise<ArrayBuffer>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output".
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string} params.deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
*/
updateDeploymentStatus(params: {
siteId: string;
deploymentId: string;
}): Promise<Models.Deployment>;
/**
* 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 - Site ID.
* @param {string} deploymentId - Deployment ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Deployment>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
*/
listLogs(params: {
siteId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ExecutionList>;
/**
* Get a list of all site logs. You can use the query params to filter your results.
*
* @param {string} siteId - Site ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ExecutionList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>;
/**
* Get a site request log by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
*/
getLog(params: {
siteId: string;
logId: string;
}): Promise<Models.Execution>;
/**
* Get a site request log by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Execution>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getLog(siteId: string, logId: string): Promise<Models.Execution>;
/**
* Delete a site log by its unique ID.
*
* @param {string} params.siteId - Site ID.
* @param {string} params.logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteLog(params: {
siteId: string;
logId: string;
}): Promise<{}>;
/**
* Delete a site log by its unique ID.
*
* @param {string} siteId - Site ID.
* @param {string} logId - Log ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteLog(siteId: string, logId: string): Promise<{}>;
/**
* Get a list of all variables of a specific site.
*
* @param {string} params.siteId - Site unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
*/
listVariables(params: {
siteId: string;
}): Promise<Models.VariableList>;
/**
* Get a list of all variables of a specific site.
*
* @param {string} siteId - Site unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.VariableList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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} params.siteId - Site unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
createVariable(params: {
siteId: string;
key: string;
value: string;
secret?: boolean;
}): Promise<Models.Variable>;
/**
* Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.
*
* @param {string} siteId - Site unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createVariable(siteId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
getVariable(params: {
siteId: string;
variableId: string;
}): Promise<Models.Variable>;
/**
* Get a variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getVariable(siteId: string, variableId: string): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @param {string} params.key - Variable key. Max length: 255 chars.
* @param {string} params.value - Variable value. Max length: 8192 chars.
* @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
*/
updateVariable(params: {
siteId: string;
variableId: string;
key: string;
value?: string;
secret?: boolean;
}): Promise<Models.Variable>;
/**
* Update variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @param {string} key - Variable key. Max length: 255 chars.
* @param {string} value - Variable value. Max length: 8192 chars.
* @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime.
* @throws {AppwriteException}
* @returns {Promise<Models.Variable>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateVariable(siteId: string, variableId: string, key: string, value?: string, secret?: boolean): Promise<Models.Variable>;
/**
* Delete a variable by its unique ID.
*
* @param {string} params.siteId - Site unique ID.
* @param {string} params.variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteVariable(params: {
siteId: string;
variableId: string;
}): Promise<{}>;
/**
* Delete a variable by its unique ID.
*
* @param {string} siteId - Site unique ID.
* @param {string} variableId - Variable unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteVariable(siteId: string, variableId: string): Promise<{}>;
}
export { Sites };

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -4,432 +4,190 @@ import { Compression } from '../enums/compression.mjs';
import { ImageGravity } from '../enums/image-gravity.mjs';
import { ImageFormat } from '../enums/image-format.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Storage {
client: Client;
constructor(client: Client);
/**
* List buckets
*
* Get a list of all the storage buckets. You can use the query params to filter your results.
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
*/
listBuckets(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.BucketList>;
listBuckets(queries?: string[], search?: string): Promise<Models.BucketList>;
/**
* Get a list of all the storage buckets. You can use the query params to filter your results.
* Create bucket
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>;
/**
* Create a new storage bucket.
*
* @param {string} params.bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Bucket name
* @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} params.transformations - Are image transformations enabled?
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
createBucket(params: {
bucketId: string;
name: string;
permissions?: string[];
fileSecurity?: boolean;
enabled?: boolean;
maximumFileSize?: number;
allowedFileExtensions?: string[];
compression?: Compression;
encryption?: boolean;
antivirus?: boolean;
transformations?: boolean;
}): Promise<Models.Bucket>;
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
/**
* Create a new storage bucket.
* Get bucket
*
* @param {string} bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Bucket name
* @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} transformations - Are image transformations enabled?
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
/**
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
getBucket(params: {
bucketId: string;
}): Promise<Models.Bucket>;
/**
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} bucketId - Bucket unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getBucket(bucketId: string): Promise<Models.Bucket>;
/**
* Update bucket
*
* Update a storage bucket by its unique ID.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} params.name - Bucket name
* @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} params.transformations - Are image transformations enabled?
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
updateBucket(params: {
bucketId: string;
name: string;
permissions?: string[];
fileSecurity?: boolean;
enabled?: boolean;
maximumFileSize?: number;
allowedFileExtensions?: string[];
compression?: Compression;
encryption?: boolean;
antivirus?: boolean;
transformations?: boolean;
}): Promise<Models.Bucket>;
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
/**
* Update a storage bucket by its unique ID.
* Delete bucket
*
* @param {string} bucketId - Bucket unique ID.
* @param {string} name - Bucket name
* @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} transformations - Are image transformations enabled?
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
/**
* Delete a storage bucket by its unique ID.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteBucket(params: {
bucketId: string;
}): Promise<{}>;
/**
* Delete a storage bucket by its unique ID.
*
* @param {string} bucketId - Bucket unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteBucket(bucketId: string): Promise<{}>;
/**
* List files
*
* Get a list of all the user files. You can use the query params to filter your results.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} bucketId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
*/
listFiles(params: {
bucketId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.FileList>;
listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
/**
* Get a list of all the user files. You can use the query params to filter your results.
* Create file
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>;
/**
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
*
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
*
* If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {File} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
* @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {string} bucketId
* @param {string} fileId
* @param {File} file
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
createFile(params: {
bucketId: string;
fileId: string;
file: File;
permissions?: string[];
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.File>;
/**
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
*
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
*
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
*
* If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {File} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
* @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
/**
* Get file
*
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
getFile(params: {
bucketId: string;
fileId: string;
}): Promise<Models.File>;
/**
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFile(bucketId: string, fileId: string): Promise<Models.File>;
/**
* Update file
*
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string} params.name - Name of the file
* @param {string[]} params.permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {string} bucketId
* @param {string} fileId
* @param {string} name
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
updateFile(params: {
bucketId: string;
fileId: string;
name?: string;
permissions?: string[];
}): Promise<Models.File>;
/**
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string} name - Name of the file
* @param {string[]} permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
/**
* Delete file
*
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteFile(params: {
bucketId: string;
fileId: string;
}): Promise<{}>;
/**
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteFile(bucketId: string, fileId: string): Promise<{}>;
/**
* Get a file 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.
* Get file for download
*
* @param {string} params.bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} params.token - File token for accessing this file.
* Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFileDownload(params: {
bucketId: string;
fileId: string;
token?: string;
}): Promise<ArrayBuffer>;
getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer>;
/**
* Get a file 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.
* Get file preview
*
* @param {string} bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFileDownload(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>;
/**
* 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 {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000.
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000.
* @param {ImageGravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
* @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
* @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
* @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
* @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
* @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
* @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
* @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp).
* @param {string} params.token - File token for accessing this file.
* @param {string} bucketId
* @param {string} fileId
* @param {number} width
* @param {number} height
* @param {ImageGravity} gravity
* @param {number} quality
* @param {number} borderWidth
* @param {string} borderColor
* @param {number} borderRadius
* @param {number} opacity
* @param {number} rotation
* @param {string} background
* @param {ImageFormat} output
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFilePreview(params: {
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>;
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>;
/**
* 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.
* Get file for view
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID
* @param {number} width - Resize preview image width, Pass an integer between 0 to 4000.
* @param {number} height - Resize preview image height, Pass an integer between 0 to 4000.
* @param {ImageGravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
* @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
* @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
* @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
* @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
* @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
* @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
* @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp).
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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>;
/**
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} params.token - File token for accessing this file.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFileView(params: {
bucketId: string;
fileId: string;
token?: string;
}): Promise<ArrayBuffer>;
/**
* 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} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFileView(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>;
getFileView(bucketId: string, fileId: string): Promise<ArrayBuffer>;
}
export { Storage };

View File

@@ -4,432 +4,190 @@ import { Compression } from '../enums/compression.js';
import { ImageGravity } from '../enums/image-gravity.js';
import { ImageFormat } from '../enums/image-format.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Storage {
client: Client;
constructor(client: Client);
/**
* List buckets
*
* Get a list of all the storage buckets. You can use the query params to filter your results.
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
*/
listBuckets(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.BucketList>;
listBuckets(queries?: string[], search?: string): Promise<Models.BucketList>;
/**
* Get a list of all the storage buckets. You can use the query params to filter your results.
* Create bucket
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>;
/**
* Create a new storage bucket.
*
* @param {string} params.bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Bucket name
* @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} params.transformations - Are image transformations enabled?
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
createBucket(params: {
bucketId: string;
name: string;
permissions?: string[];
fileSecurity?: boolean;
enabled?: boolean;
maximumFileSize?: number;
allowedFileExtensions?: string[];
compression?: Compression;
encryption?: boolean;
antivirus?: boolean;
transformations?: boolean;
}): Promise<Models.Bucket>;
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
/**
* Create a new storage bucket.
* Get bucket
*
* @param {string} bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Bucket name
* @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} transformations - Are image transformations enabled?
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
/**
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
getBucket(params: {
bucketId: string;
}): Promise<Models.Bucket>;
/**
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} bucketId - Bucket unique ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getBucket(bucketId: string): Promise<Models.Bucket>;
/**
* Update bucket
*
* Update a storage bucket by its unique ID.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} params.name - Bucket name
* @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} params.compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} params.transformations - Are image transformations enabled?
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
updateBucket(params: {
bucketId: string;
name: string;
permissions?: string[];
fileSecurity?: boolean;
enabled?: boolean;
maximumFileSize?: number;
allowedFileExtensions?: string[];
compression?: Compression;
encryption?: boolean;
antivirus?: boolean;
transformations?: boolean;
}): Promise<Models.Bucket>;
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise<Models.Bucket>;
/**
* Update a storage bucket by its unique ID.
* Delete bucket
*
* @param {string} bucketId - Bucket unique ID.
* @param {string} name - Bucket name
* @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
* @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
* @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
* @param {Compression} compression - Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
* @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
* @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
* @param {boolean} transformations - Are image transformations enabled?
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
/**
* Delete a storage bucket by its unique ID.
*
* @param {string} params.bucketId - Bucket unique ID.
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteBucket(params: {
bucketId: string;
}): Promise<{}>;
/**
* Delete a storage bucket by its unique ID.
*
* @param {string} bucketId - Bucket unique ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteBucket(bucketId: string): Promise<{}>;
/**
* List files
*
* Get a list of all the user files. You can use the query params to filter your results.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string} bucketId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
*/
listFiles(params: {
bucketId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.FileList>;
listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList>;
/**
* Get a list of all the user files. You can use the query params to filter your results.
* Create file
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>;
/**
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
*
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
*
* If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {File} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
* @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {string} bucketId
* @param {string} fileId
* @param {File} file
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
createFile(params: {
bucketId: string;
fileId: string;
file: File;
permissions?: string[];
onProgress?: (progress: UploadProgress) => void;
}): Promise<Models.File>;
/**
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
*
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
*
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
*
* If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {File} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
* @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
/**
* Get file
*
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
getFile(params: {
bucketId: string;
fileId: string;
}): Promise<Models.File>;
/**
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFile(bucketId: string, fileId: string): Promise<Models.File>;
/**
* Update file
*
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string} params.name - Name of the file
* @param {string[]} params.permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @param {string} bucketId
* @param {string} fileId
* @param {string} name
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
updateFile(params: {
bucketId: string;
fileId: string;
name?: string;
permissions?: string[];
}): Promise<Models.File>;
/**
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string} name - Name of the file
* @param {string[]} permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
/**
* Delete file
*
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteFile(params: {
bucketId: string;
fileId: string;
}): Promise<{}>;
/**
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteFile(bucketId: string, fileId: string): Promise<{}>;
/**
* Get a file 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.
* Get file for download
*
* @param {string} params.bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} params.token - File token for accessing this file.
* Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFileDownload(params: {
bucketId: string;
fileId: string;
token?: string;
}): Promise<ArrayBuffer>;
getFileDownload(bucketId: string, fileId: string): Promise<ArrayBuffer>;
/**
* Get a file 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.
* Get file preview
*
* @param {string} bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFileDownload(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>;
/**
* 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 {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000.
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000.
* @param {ImageGravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
* @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
* @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
* @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
* @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
* @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
* @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
* @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp).
* @param {string} params.token - File token for accessing this file.
* @param {string} bucketId
* @param {string} fileId
* @param {number} width
* @param {number} height
* @param {ImageGravity} gravity
* @param {number} quality
* @param {number} borderWidth
* @param {string} borderColor
* @param {number} borderRadius
* @param {number} opacity
* @param {number} rotation
* @param {string} background
* @param {ImageFormat} output
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFilePreview(params: {
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>;
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>;
/**
* 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.
* Get file for view
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID
* @param {number} width - Resize preview image width, Pass an integer between 0 to 4000.
* @param {number} height - Resize preview image height, Pass an integer between 0 to 4000.
* @param {ImageGravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
* @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
* @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
* @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
* @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
* @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
* @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
* @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
* @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp).
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
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>;
/**
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File ID.
* @param {string} params.token - File token for accessing this file.
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
getFileView(params: {
bucketId: string;
fileId: string;
token?: string;
}): Promise<ArrayBuffer>;
/**
* 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} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File ID.
* @param {string} token - File token for accessing this file.
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getFileView(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>;
getFileView(bucketId: string, fileId: string): Promise<ArrayBuffer>;
}
export { Storage };

View File

@@ -6,20 +6,17 @@ class Storage {
constructor(client) {
this.client = client;
}
listBuckets(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
queries: paramsOrFirst,
search: rest[0],
total: rest[1]
};
}
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List buckets
*
* Get a list of all the storage buckets. You can use the query params to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
*/
async listBuckets(queries, search) {
const apiPath = "/storage/buckets";
const payload = {};
if (typeof queries !== "undefined") {
@@ -28,48 +25,36 @@ class Storage {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createBucket(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
name: rest[0],
permissions: rest[1],
fileSecurity: rest[2],
enabled: rest[3],
maximumFileSize: rest[4],
allowedFileExtensions: rest[5],
compression: rest[6],
encryption: rest[7],
antivirus: rest[8],
transformations: rest[9]
};
}
const bucketId = params.bucketId;
const name = params.name;
const permissions = params.permissions;
const fileSecurity = params.fileSecurity;
const enabled = params.enabled;
const maximumFileSize = params.maximumFileSize;
const allowedFileExtensions = params.allowedFileExtensions;
const compression = params.compression;
const encryption = params.encryption;
const antivirus = params.antivirus;
const transformations = params.transformations;
/**
* Create bucket
*
* Create a new storage bucket.
*
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -108,74 +93,62 @@ class Storage {
if (typeof antivirus !== "undefined") {
payload["antivirus"] = antivirus;
}
if (typeof transformations !== "undefined") {
payload["transformations"] = transformations;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
getBucket(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst
};
}
const bucketId = params.bucketId;
/**
* Get bucket
*
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async getBucket(bucketId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
const apiPath = "/storage/buckets/{bucketId}".replace("{bucketId}", bucketId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateBucket(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
name: rest[0],
permissions: rest[1],
fileSecurity: rest[2],
enabled: rest[3],
maximumFileSize: rest[4],
allowedFileExtensions: rest[5],
compression: rest[6],
encryption: rest[7],
antivirus: rest[8],
transformations: rest[9]
};
}
const bucketId = params.bucketId;
const name = params.name;
const permissions = params.permissions;
const fileSecurity = params.fileSecurity;
const enabled = params.enabled;
const maximumFileSize = params.maximumFileSize;
const allowedFileExtensions = params.allowedFileExtensions;
const compression = params.compression;
const encryption = params.encryption;
const antivirus = params.antivirus;
const transformations = params.transformations;
/**
* Update bucket
*
* Update a storage bucket by its unique ID.
*
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -211,30 +184,27 @@ class Storage {
if (typeof antivirus !== "undefined") {
payload["antivirus"] = antivirus;
}
if (typeof transformations !== "undefined") {
payload["transformations"] = transformations;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
deleteBucket(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst
};
}
const bucketId = params.bucketId;
/**
* Delete bucket
*
* Delete a storage bucket by its unique ID.
*
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteBucket(bucketId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -244,29 +214,25 @@ class Storage {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
listFiles(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
queries: rest[0],
search: rest[1],
total: rest[2]
};
}
const bucketId = params.bucketId;
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List files
*
* Get a list of all the user files. You can use the query params to filter your results.
*
* @param {string} bucketId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
*/
async listFiles(bucketId, queries, search) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -278,37 +244,38 @@ class Storage {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createFile(paramsOrFirst, ...rest) {
let params;
let onProgress;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
onProgress = paramsOrFirst == null ? void 0 : paramsOrFirst.onProgress;
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
file: rest[1],
permissions: rest[2]
};
onProgress = rest[3];
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const file = params.file;
const permissions = params.permissions;
/**
* Create file
*
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
* @param {string} bucketId
* @param {string} fileId
* @param {File} file
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async createFile(bucketId, fileId, file, permissions, onProgress = (progress) => {
}) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -333,7 +300,7 @@ class Storage {
const apiHeaders = {
"content-type": "multipart/form-data"
};
return this.client.chunkedUpload(
return await this.client.chunkedUpload(
"post",
uri,
apiHeaders,
@@ -341,18 +308,17 @@ class Storage {
onProgress
);
}
getFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
/**
* Get file
*
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async getFile(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -362,30 +328,29 @@ class Storage {
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
name: rest[1],
permissions: rest[2]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const name = params.name;
const permissions = params.permissions;
/**
* Update file
*
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} bucketId
* @param {string} fileId
* @param {string} name
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async updateFile(bucketId, fileId, name, permissions) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -404,25 +369,24 @@ class Storage {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
deleteFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
/**
* Delete file
*
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteFile(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -435,27 +399,24 @@ class Storage {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
getFileDownload(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
token: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const token = params.token;
/**
* Get file for download
*
* Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFileDownload(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -464,12 +425,11 @@ class Storage {
}
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -477,42 +437,28 @@ class Storage {
"arrayBuffer"
);
}
getFilePreview(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
width: rest[1],
height: rest[2],
gravity: rest[3],
quality: rest[4],
borderWidth: rest[5],
borderColor: rest[6],
borderRadius: rest[7],
opacity: rest[8],
rotation: rest[9],
background: rest[10],
output: rest[11],
token: rest[12]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const width = params.width;
const height = params.height;
const gravity = params.gravity;
const quality = params.quality;
const borderWidth = params.borderWidth;
const borderColor = params.borderColor;
const borderRadius = params.borderRadius;
const opacity = params.opacity;
const rotation = params.rotation;
const background = params.background;
const output = params.output;
const token = params.token;
/**
* Get file preview
*
* 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 {string} bucketId
* @param {string} fileId
* @param {number} width
* @param {number} height
* @param {ImageGravity} gravity
* @param {number} quality
* @param {number} borderWidth
* @param {string} borderColor
* @param {number} borderRadius
* @param {number} opacity
* @param {number} rotation
* @param {string} background
* @param {ImageFormat} output
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -554,12 +500,11 @@ class Storage {
if (typeof output !== "undefined") {
payload["output"] = output;
}
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -567,20 +512,17 @@ class Storage {
"arrayBuffer"
);
}
getFileView(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
token: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const token = params.token;
/**
* Get file for view
*
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFileView(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
@@ -589,12 +531,11 @@ class Storage {
}
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -5,20 +5,17 @@ var Storage = class {
constructor(client) {
this.client = client;
}
listBuckets(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
queries: paramsOrFirst,
search: rest[0],
total: rest[1]
};
}
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List buckets
*
* Get a list of all the storage buckets. You can use the query params to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.BucketList>}
*/
async listBuckets(queries, search) {
const apiPath = "/storage/buckets";
const payload = {};
if (typeof queries !== "undefined") {
@@ -27,48 +24,36 @@ var Storage = class {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createBucket(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
name: rest[0],
permissions: rest[1],
fileSecurity: rest[2],
enabled: rest[3],
maximumFileSize: rest[4],
allowedFileExtensions: rest[5],
compression: rest[6],
encryption: rest[7],
antivirus: rest[8],
transformations: rest[9]
};
}
const bucketId = params.bucketId;
const name = params.name;
const permissions = params.permissions;
const fileSecurity = params.fileSecurity;
const enabled = params.enabled;
const maximumFileSize = params.maximumFileSize;
const allowedFileExtensions = params.allowedFileExtensions;
const compression = params.compression;
const encryption = params.encryption;
const antivirus = params.antivirus;
const transformations = params.transformations;
/**
* Create bucket
*
* Create a new storage bucket.
*
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -107,74 +92,62 @@ var Storage = class {
if (typeof antivirus !== "undefined") {
payload["antivirus"] = antivirus;
}
if (typeof transformations !== "undefined") {
payload["transformations"] = transformations;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
getBucket(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst
};
}
const bucketId = params.bucketId;
/**
* Get bucket
*
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
*
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async getBucket(bucketId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
const apiPath = "/storage/buckets/{bucketId}".replace("{bucketId}", bucketId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateBucket(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
name: rest[0],
permissions: rest[1],
fileSecurity: rest[2],
enabled: rest[3],
maximumFileSize: rest[4],
allowedFileExtensions: rest[5],
compression: rest[6],
encryption: rest[7],
antivirus: rest[8],
transformations: rest[9]
};
}
const bucketId = params.bucketId;
const name = params.name;
const permissions = params.permissions;
const fileSecurity = params.fileSecurity;
const enabled = params.enabled;
const maximumFileSize = params.maximumFileSize;
const allowedFileExtensions = params.allowedFileExtensions;
const compression = params.compression;
const encryption = params.encryption;
const antivirus = params.antivirus;
const transformations = params.transformations;
/**
* Update bucket
*
* Update a storage bucket by its unique ID.
*
* @param {string} bucketId
* @param {string} name
* @param {string[]} permissions
* @param {boolean} fileSecurity
* @param {boolean} enabled
* @param {number} maximumFileSize
* @param {string[]} allowedFileExtensions
* @param {Compression} compression
* @param {boolean} encryption
* @param {boolean} antivirus
* @throws {AppwriteException}
* @returns {Promise<Models.Bucket>}
*/
async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -210,30 +183,27 @@ var Storage = class {
if (typeof antivirus !== "undefined") {
payload["antivirus"] = antivirus;
}
if (typeof transformations !== "undefined") {
payload["transformations"] = transformations;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
deleteBucket(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst
};
}
const bucketId = params.bucketId;
/**
* Delete bucket
*
* Delete a storage bucket by its unique ID.
*
* @param {string} bucketId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteBucket(bucketId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -243,29 +213,25 @@ var Storage = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
listFiles(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
queries: rest[0],
search: rest[1],
total: rest[2]
};
}
const bucketId = params.bucketId;
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List files
*
* Get a list of all the user files. You can use the query params to filter your results.
*
* @param {string} bucketId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.FileList>}
*/
async listFiles(bucketId, queries, search) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -277,37 +243,38 @@ var Storage = class {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createFile(paramsOrFirst, ...rest) {
let params;
let onProgress;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
onProgress = paramsOrFirst == null ? void 0 : paramsOrFirst.onProgress;
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
file: rest[1],
permissions: rest[2]
};
onProgress = rest[3];
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const file = params.file;
const permissions = params.permissions;
/**
* Create file
*
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file&#039;s **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you&#039;re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
*
* @param {string} bucketId
* @param {string} fileId
* @param {File} file
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async createFile(bucketId, fileId, file, permissions, onProgress = (progress) => {
}) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -332,7 +299,7 @@ var Storage = class {
const apiHeaders = {
"content-type": "multipart/form-data"
};
return this.client.chunkedUpload(
return await this.client.chunkedUpload(
"post",
uri,
apiHeaders,
@@ -340,18 +307,17 @@ var Storage = class {
onProgress
);
}
getFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
/**
* Get file
*
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async getFile(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -361,30 +327,29 @@ var Storage = class {
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
name: rest[1],
permissions: rest[2]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const name = params.name;
const permissions = params.permissions;
/**
* Update file
*
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
*
* @param {string} bucketId
* @param {string} fileId
* @param {string} name
* @param {string[]} permissions
* @throws {AppwriteException}
* @returns {Promise<Models.File>}
*/
async updateFile(bucketId, fileId, name, permissions) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -403,25 +368,24 @@ var Storage = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
deleteFile(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
/**
* Delete file
*
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteFile(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -434,27 +398,24 @@ var Storage = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
getFileDownload(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
token: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const token = params.token;
/**
* Get file for download
*
* Get a file content by its unique ID. The endpoint response return with a &#039;Content-Disposition: attachment&#039; header that tells the browser to start downloading the file to user downloads directory.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFileDownload(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -463,12 +424,11 @@ var Storage = class {
}
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -476,42 +436,28 @@ var Storage = class {
"arrayBuffer"
);
}
getFilePreview(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
width: rest[1],
height: rest[2],
gravity: rest[3],
quality: rest[4],
borderWidth: rest[5],
borderColor: rest[6],
borderRadius: rest[7],
opacity: rest[8],
rotation: rest[9],
background: rest[10],
output: rest[11],
token: rest[12]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const width = params.width;
const height = params.height;
const gravity = params.gravity;
const quality = params.quality;
const borderWidth = params.borderWidth;
const borderColor = params.borderColor;
const borderRadius = params.borderRadius;
const opacity = params.opacity;
const rotation = params.rotation;
const background = params.background;
const output = params.output;
const token = params.token;
/**
* Get file preview
*
* 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 {string} bucketId
* @param {string} fileId
* @param {number} width
* @param {number} height
* @param {ImageGravity} gravity
* @param {number} quality
* @param {number} borderWidth
* @param {string} borderColor
* @param {number} borderRadius
* @param {number} opacity
* @param {number} rotation
* @param {string} background
* @param {ImageFormat} output
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -553,12 +499,11 @@ var Storage = class {
if (typeof output !== "undefined") {
payload["output"] = output;
}
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
@@ -566,20 +511,17 @@ var Storage = class {
"arrayBuffer"
);
}
getFileView(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
token: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const token = params.token;
/**
* Get file for view
*
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no &#039;Content-Disposition: attachment&#039; header.
*
* @param {string} bucketId
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise<ArrayBuffer>}
*/
async getFileView(bucketId, fileId) {
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
@@ -588,12 +530,11 @@ var Storage = class {
}
const apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof token !== "undefined") {
payload["token"] = token;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,355 +1,171 @@
import { Client } from '../client.mjs';
import { Models } from '../models.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Teams {
client: Client;
constructor(client: Client);
/**
* List teams
*
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
*/
list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.TeamList<Preferences>>;
list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>>;
/**
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
* Create team
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.TeamList<Preferences>>;
/**
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
*
* @param {string} params.teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Team name. Max length: 128 chars.
* @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} teamId
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
name: string;
roles?: string[];
}): Promise<Models.Team<Preferences>>;
create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
/**
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
* Get team
*
* @param {string} teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Team name. Max length: 128 chars.
* @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
/**
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} params.teamId - Team ID.
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
}): Promise<Models.Team<Preferences>>;
get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>>;
/**
* Get a team by its ID. All team members have read access for this resource.
* Update name
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>>;
/**
* Update the team's name by its unique ID.
* Update the team&#039;s name by its unique ID.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.name - New team name. Max length: 128 chars.
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
name: string;
}): Promise<Models.Team<Preferences>>;
updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
/**
* Update the team's name by its unique ID.
* Delete team
*
* @param {string} teamId - Team ID.
* @param {string} name - New team name. Max length: 128 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
/**
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} params.teamId - Team ID.
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
teamId: string;
}): Promise<{}>;
/**
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(teamId: string): Promise<{}>;
/**
* Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
* List team memberships
*
* @param {string} params.teamId - Team ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
*/
listMemberships(params: {
teamId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.MembershipList>;
listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
/**
* Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
* Create team membership
*
* @param {string} teamId - Team ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>;
/**
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn&#039;t exist. If initiated from a Server SDK, the new member will be added automatically to the team.
You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID &gt; email &gt; phone number if you provide more than one of these parameters.
Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
* You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
*
* Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
*
* Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
*
* @param {string} params.teamId - Team ID.
* @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} params.email - Email of the new team member.
* @param {string} params.userId - ID of the user to be added to a team.
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
* @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} params.name - Name of the new team member. Max length: 128 chars.
* @param {string} teamId
* @param {string[]} roles
* @param {string} email
* @param {string} userId
* @param {string} phone
* @param {string} url
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
createMembership(params: {
teamId: string;
roles: string[];
email?: string;
userId?: string;
phone?: string;
url?: string;
name?: string;
}): Promise<Models.Membership>;
/**
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
*
* You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
*
* Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
*
* Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
*
* @param {string} teamId - Team ID.
* @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} email - Email of the new team member.
* @param {string} userId - ID of the user to be added to a team.
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
* @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} name - Name of the new team member. Max length: 128 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
/**
* Get team membership
*
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
getMembership(params: {
teamId: string;
membershipId: string;
}): Promise<Models.Membership>;
/**
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
/**
* Update membership
*
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} teamId
* @param {string} membershipId
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
updateMembership(params: {
teamId: string;
membershipId: string;
roles: string[];
}): Promise<Models.Membership>;
/**
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
/**
* Delete team membership
*
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteMembership(params: {
teamId: string;
membershipId: string;
}): Promise<{}>;
/**
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteMembership(teamId: string, membershipId: string): Promise<{}>;
/**
* Update team membership status
*
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
If the request is successful, a session for the user is automatically created.
*
* If the request is successful, a session for the user is automatically created.
*
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} params.userId - User ID.
* @param {string} params.secret - Secret key.
* @param {string} teamId
* @param {string} membershipId
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
updateMembershipStatus(params: {
teamId: string;
membershipId: string;
userId: string;
secret: string;
}): Promise<Models.Membership>;
/**
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
*
* If the request is successful, a session for the user is automatically created.
*
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @param {string} userId - User ID.
* @param {string} secret - Secret key.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>;
/**
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
* Get team preferences
*
* @param {string} params.teamId - Team ID.
* Get the team&#039;s shared preferences by its unique ID. If a preference doesn&#039;t need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
}): Promise<Preferences>;
getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences>;
/**
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
* Update preferences
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences>;
/**
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
* Update the team&#039;s preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} params.teamId - Team ID.
* @param {object} params.prefs - Prefs key-value JSON object.
* @param {string} teamId
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
prefs: object;
}): Promise<Preferences>;
/**
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} teamId - Team ID.
* @param {object} prefs - Prefs key-value JSON object.
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences>;
updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences>;
}
export { Teams };

View File

@@ -1,355 +1,171 @@
import { Client } from '../client.js';
import { Models } from '../models.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Teams {
client: Client;
constructor(client: Client);
/**
* List teams
*
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
*
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
*/
list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: {
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.TeamList<Preferences>>;
list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>>;
/**
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
* Create team
*
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.TeamList<Preferences>>;
/**
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
*
* @param {string} params.teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} params.name - Team name. Max length: 128 chars.
* @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} teamId
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
name: string;
roles?: string[];
}): Promise<Models.Team<Preferences>>;
create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
/**
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
* Get team
*
* @param {string} teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
* @param {string} name - Team name. Max length: 128 chars.
* @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
/**
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} params.teamId - Team ID.
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
}): Promise<Models.Team<Preferences>>;
get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>>;
/**
* Get a team by its ID. All team members have read access for this resource.
* Update name
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>>;
/**
* Update the team's name by its unique ID.
* Update the team&#039;s name by its unique ID.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.name - New team name. Max length: 128 chars.
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
name: string;
}): Promise<Models.Team<Preferences>>;
updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
/**
* Update the team's name by its unique ID.
* Delete team
*
* @param {string} teamId - Team ID.
* @param {string} name - New team name. Max length: 128 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
/**
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} params.teamId - Team ID.
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
teamId: string;
}): Promise<{}>;
/**
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(teamId: string): Promise<{}>;
/**
* Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
* List team memberships
*
* @param {string} params.teamId - Team ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
*/
listMemberships(params: {
teamId: string;
queries?: string[];
search?: string;
total?: boolean;
}): Promise<Models.MembershipList>;
listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
/**
* Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
* Create team membership
*
* @param {string} teamId - Team ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>;
/**
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn&#039;t exist. If initiated from a Server SDK, the new member will be added automatically to the team.
You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID &gt; email &gt; phone number if you provide more than one of these parameters.
Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
* You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
*
* Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
*
* Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
*
* @param {string} params.teamId - Team ID.
* @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} params.email - Email of the new team member.
* @param {string} params.userId - ID of the user to be added to a team.
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
* @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} params.name - Name of the new team member. Max length: 128 chars.
* @param {string} teamId
* @param {string[]} roles
* @param {string} email
* @param {string} userId
* @param {string} phone
* @param {string} url
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
createMembership(params: {
teamId: string;
roles: string[];
email?: string;
userId?: string;
phone?: string;
url?: string;
name?: string;
}): Promise<Models.Membership>;
/**
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
*
* You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
*
* Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
*
* Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
*
* @param {string} teamId - Team ID.
* @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} email - Email of the new team member.
* @param {string} userId - ID of the user to be added to a team.
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
* @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param {string} name - Name of the new team member. Max length: 128 chars.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
/**
* Get team membership
*
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
getMembership(params: {
teamId: string;
membershipId: string;
}): Promise<Models.Membership>;
/**
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
/**
* Update membership
*
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @param {string} teamId
* @param {string} membershipId
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
updateMembership(params: {
teamId: string;
membershipId: string;
roles: string[];
}): Promise<Models.Membership>;
/**
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
/**
* Delete team membership
*
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
deleteMembership(params: {
teamId: string;
membershipId: string;
}): Promise<{}>;
/**
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
deleteMembership(teamId: string, membershipId: string): Promise<{}>;
/**
* Update team membership status
*
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
If the request is successful, a session for the user is automatically created.
*
* If the request is successful, a session for the user is automatically created.
*
*
* @param {string} params.teamId - Team ID.
* @param {string} params.membershipId - Membership ID.
* @param {string} params.userId - User ID.
* @param {string} params.secret - Secret key.
* @param {string} teamId
* @param {string} membershipId
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
updateMembershipStatus(params: {
teamId: string;
membershipId: string;
userId: string;
secret: string;
}): Promise<Models.Membership>;
/**
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
*
* If the request is successful, a session for the user is automatically created.
*
*
* @param {string} teamId - Team ID.
* @param {string} membershipId - Membership ID.
* @param {string} userId - User ID.
* @param {string} secret - Secret key.
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>;
/**
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
* Get team preferences
*
* @param {string} params.teamId - Team ID.
* Get the team&#039;s shared preferences by its unique ID. If a preference doesn&#039;t need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
}): Promise<Preferences>;
getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences>;
/**
* Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
* Update preferences
*
* @param {string} teamId - Team ID.
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences>;
/**
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
* Update the team&#039;s preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} params.teamId - Team ID.
* @param {object} params.prefs - Prefs key-value JSON object.
* @param {string} teamId
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
teamId: string;
prefs: object;
}): Promise<Preferences>;
/**
* Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} teamId - Team ID.
* @param {object} prefs - Prefs key-value JSON object.
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences>;
updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences>;
}
export { Teams };

View File

@@ -6,20 +6,17 @@ class Teams {
constructor(client) {
this.client = client;
}
list(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
queries: paramsOrFirst,
search: rest[0],
total: rest[1]
};
}
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List teams
*
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
*/
async list(queries, search) {
const apiPath = "/teams";
const payload = {};
if (typeof queries !== "undefined") {
@@ -28,32 +25,29 @@ class Teams {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
create(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
name: rest[0],
roles: rest[1]
};
}
const teamId = params.teamId;
const name = params.name;
const roles = params.roles;
/**
* Create team
*
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
*
* @param {string} teamId
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async create(teamId, name, roles) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -75,49 +69,50 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
get(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Get team
*
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async get(teamId) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
const apiPath = "/teams/{teamId}".replace("{teamId}", teamId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateName(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
name: rest[0]
};
}
const teamId = params.teamId;
const name = params.name;
/**
* Update name
*
* Update the team&#039;s name by its unique ID.
*
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async updateName(teamId, name) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -133,23 +128,23 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
delete(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Delete team
*
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async delete(teamId) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -159,29 +154,25 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
listMemberships(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
queries: rest[0],
search: rest[1],
total: rest[2]
};
}
const teamId = params.teamId;
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List team memberships
*
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
*/
async listMemberships(teamId, queries, search) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -193,40 +184,40 @@ class Teams {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
roles: rest[0],
email: rest[1],
userId: rest[2],
phone: rest[3],
url: rest[4],
name: rest[5]
};
}
const teamId = params.teamId;
const roles = params.roles;
const email = params.email;
const userId = params.userId;
const phone = params.phone;
const url = params.url;
const name = params.name;
/**
* Create team membership
*
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn&#039;t exist. If initiated from a Server SDK, the new member will be added automatically to the team.
You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID &gt; email &gt; phone number if you provide more than one of these parameters.
Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
* @param {string} teamId
* @param {string[]} roles
* @param {string} email
* @param {string} userId
* @param {string} phone
* @param {string} url
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async createMembership(teamId, roles, email, userId, phone, url, name) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -257,25 +248,24 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
getMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
/**
* Get team membership
*
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async getMembership(teamId, membershipId) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -285,28 +275,29 @@ class Teams {
const apiPath = "/teams/{teamId}/memberships/{membershipId}".replace("{teamId}", teamId).replace("{membershipId}", membershipId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0],
roles: rest[1]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
const roles = params.roles;
/**
* Update membership
*
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
* @param {string} teamId
* @param {string} membershipId
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async updateMembership(teamId, membershipId, roles) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -325,25 +316,24 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
deleteMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
/**
* Delete team membership
*
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteMembership(teamId, membershipId) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -356,29 +346,29 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
updateMembershipStatus(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0],
userId: rest[1],
secret: rest[2]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
const userId = params.userId;
const secret = params.secret;
/**
* Update team membership status
*
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
If the request is successful, a session for the user is automatically created.
*
* @param {string} teamId
* @param {string} membershipId
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async updateMembershipStatus(teamId, membershipId, userId, secret) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -403,49 +393,50 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
getPrefs(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Get team preferences
*
* Get the team&#039;s shared preferences by its unique ID. If a preference doesn&#039;t need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
async getPrefs(teamId) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
const apiPath = "/teams/{teamId}/prefs".replace("{teamId}", teamId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updatePrefs(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
prefs: rest[0]
};
}
const teamId = params.teamId;
const prefs = params.prefs;
/**
* Update preferences
*
* Update the team&#039;s preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} teamId
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
async updatePrefs(teamId, prefs) {
if (typeof teamId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "teamId"');
}
@@ -461,7 +452,7 @@ class Teams {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -5,20 +5,17 @@ var Teams = class {
constructor(client) {
this.client = client;
}
list(paramsOrFirst, ...rest) {
let params;
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
queries: paramsOrFirst,
search: rest[0],
total: rest[1]
};
}
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List teams
*
* Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
*
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.TeamList<Preferences>>}
*/
async list(queries, search) {
const apiPath = "/teams";
const payload = {};
if (typeof queries !== "undefined") {
@@ -27,32 +24,29 @@ var Teams = class {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
create(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
name: rest[0],
roles: rest[1]
};
}
const teamId = params.teamId;
const name = params.name;
const roles = params.roles;
/**
* Create team
*
* Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
*
* @param {string} teamId
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async create(teamId, name, roles) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -74,49 +68,50 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
get(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Get team
*
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async get(teamId) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
const apiPath = "/teams/{teamId}".replace("{teamId}", teamId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateName(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
name: rest[0]
};
}
const teamId = params.teamId;
const name = params.name;
/**
* Update name
*
* Update the team&#039;s name by its unique ID.
*
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Team<Preferences>>}
*/
async updateName(teamId, name) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -132,23 +127,23 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,
payload
);
}
delete(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Delete team
*
* Delete a team using its ID. Only team members with the owner role can delete the team.
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async delete(teamId) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -158,29 +153,25 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
listMemberships(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
queries: rest[0],
search: rest[1],
total: rest[2]
};
}
const teamId = params.teamId;
const queries = params.queries;
const search = params.search;
const total = params.total;
/**
* List team memberships
*
* Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string[]} queries
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise<Models.MembershipList>}
*/
async listMemberships(teamId, queries, search) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -192,40 +183,40 @@ var Teams = class {
if (typeof search !== "undefined") {
payload["search"] = search;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
roles: rest[0],
email: rest[1],
userId: rest[2],
phone: rest[3],
url: rest[4],
name: rest[5]
};
}
const teamId = params.teamId;
const roles = params.roles;
const email = params.email;
const userId = params.userId;
const phone = params.phone;
const url = params.url;
const name = params.name;
/**
* Create team membership
*
* Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn&#039;t exist. If initiated from a Server SDK, the new member will be added automatically to the team.
You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID &gt; email &gt; phone number if you provide more than one of these parameters.
Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
*
* @param {string} teamId
* @param {string[]} roles
* @param {string} email
* @param {string} userId
* @param {string} phone
* @param {string} url
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async createMembership(teamId, roles, email, userId, phone, url, name) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -256,25 +247,24 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
getMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
/**
* Get team membership
*
* Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
*
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async getMembership(teamId, membershipId) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -284,28 +274,29 @@ var Teams = class {
const apiPath = "/teams/{teamId}/memberships/{membershipId}".replace("{teamId}", teamId).replace("{membershipId}", membershipId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updateMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0],
roles: rest[1]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
const roles = params.roles;
/**
* Update membership
*
* Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
*
* @param {string} teamId
* @param {string} membershipId
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async updateMembership(teamId, membershipId, roles) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -324,25 +315,24 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
deleteMembership(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
/**
* Delete team membership
*
* This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
*
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
async deleteMembership(teamId, membershipId) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -355,29 +345,29 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
updateMembershipStatus(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
membershipId: rest[0],
userId: rest[1],
secret: rest[2]
};
}
const teamId = params.teamId;
const membershipId = params.membershipId;
const userId = params.userId;
const secret = params.secret;
/**
* Update team membership status
*
* Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
If the request is successful, a session for the user is automatically created.
*
* @param {string} teamId
* @param {string} membershipId
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise<Models.Membership>}
*/
async updateMembershipStatus(teamId, membershipId, userId, secret) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -402,49 +392,50 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
getPrefs(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst
};
}
const teamId = params.teamId;
/**
* Get team preferences
*
* Get the team&#039;s shared preferences by its unique ID. If a preference doesn&#039;t need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
*
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
async getPrefs(teamId) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
const apiPath = "/teams/{teamId}/prefs".replace("{teamId}", teamId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
const apiHeaders = {
"content-type": "application/json"
};
return await this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
updatePrefs(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
teamId: paramsOrFirst,
prefs: rest[0]
};
}
const teamId = params.teamId;
const prefs = params.prefs;
/**
* Update preferences
*
* Update the team&#039;s preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
*
* @param {string} teamId
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise<Preferences>}
*/
async updatePrefs(teamId, prefs) {
if (typeof teamId === "undefined") {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -460,7 +451,7 @@ var Teams = class {
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
return await this.client.call(
"put",
uri,
apiHeaders,

File diff suppressed because one or more lines are too long

View File

@@ -1,133 +0,0 @@
import { Client } from '../client.mjs';
import { Models } from '../models.mjs';
import '../query.mjs';
import '../enums/database-type.mjs';
import '../enums/attribute-status.mjs';
import '../enums/column-status.mjs';
import '../enums/index-status.mjs';
import '../enums/deployment-status.mjs';
import '../enums/execution-trigger.mjs';
import '../enums/execution-status.mjs';
import '../enums/health-antivirus-status.mjs';
import '../enums/health-check-status.mjs';
import '../enums/message-status.mjs';
declare class Tokens {
client: Client;
constructor(client: Client);
/**
* List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceTokenList>}
*/
list(params: {
bucketId: string;
fileId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ResourceTokenList>;
/**
* List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceTokenList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>;
/**
* Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string} params.expire - Token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
createFileToken(params: {
bucketId: string;
fileId: string;
expire?: string;
}): Promise<Models.ResourceToken>;
/**
* Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string} expire - Token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;
/**
* Get a token by its unique ID.
*
* @param {string} params.tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
get(params: {
tokenId: string;
}): Promise<Models.ResourceToken>;
/**
* Get a token by its unique ID.
*
* @param {string} tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(tokenId: string): Promise<Models.ResourceToken>;
/**
* Update a token by its unique ID. Use this endpoint to update a token's expiry date.
*
* @param {string} params.tokenId - Token unique ID.
* @param {string} params.expire - File token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
update(params: {
tokenId: string;
expire?: string;
}): Promise<Models.ResourceToken>;
/**
* Update a token by its unique ID. Use this endpoint to update a token's expiry date.
*
* @param {string} tokenId - Token unique ID.
* @param {string} expire - File token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;
/**
* Delete a token by its unique ID.
*
* @param {string} params.tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
tokenId: string;
}): Promise<{}>;
/**
* Delete a token by its unique ID.
*
* @param {string} tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(tokenId: string): Promise<{}>;
}
export { Tokens };

View File

@@ -1,133 +0,0 @@
import { Client } from '../client.js';
import { Models } from '../models.js';
import '../query.js';
import '../enums/database-type.js';
import '../enums/attribute-status.js';
import '../enums/column-status.js';
import '../enums/index-status.js';
import '../enums/deployment-status.js';
import '../enums/execution-trigger.js';
import '../enums/execution-status.js';
import '../enums/health-antivirus-status.js';
import '../enums/health-check-status.js';
import '../enums/message-status.js';
declare class Tokens {
client: Client;
constructor(client: Client);
/**
* List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceTokenList>}
*/
list(params: {
bucketId: string;
fileId: string;
queries?: string[];
total?: boolean;
}): Promise<Models.ResourceTokenList>;
/**
* List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceTokenList>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>;
/**
* Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
*
* @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} params.fileId - File unique ID.
* @param {string} params.expire - Token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
createFileToken(params: {
bucketId: string;
fileId: string;
expire?: string;
}): Promise<Models.ResourceToken>;
/**
* Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
*
* @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
* @param {string} fileId - File unique ID.
* @param {string} expire - Token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>;
/**
* Get a token by its unique ID.
*
* @param {string} params.tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
get(params: {
tokenId: string;
}): Promise<Models.ResourceToken>;
/**
* Get a token by its unique ID.
*
* @param {string} tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
get(tokenId: string): Promise<Models.ResourceToken>;
/**
* Update a token by its unique ID. Use this endpoint to update a token's expiry date.
*
* @param {string} params.tokenId - Token unique ID.
* @param {string} params.expire - File token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
*/
update(params: {
tokenId: string;
expire?: string;
}): Promise<Models.ResourceToken>;
/**
* Update a token by its unique ID. Use this endpoint to update a token's expiry date.
*
* @param {string} tokenId - Token unique ID.
* @param {string} expire - File token expiry date
* @throws {AppwriteException}
* @returns {Promise<Models.ResourceToken>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
update(tokenId: string, expire?: string): Promise<Models.ResourceToken>;
/**
* Delete a token by its unique ID.
*
* @param {string} params.tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
*/
delete(params: {
tokenId: string;
}): Promise<{}>;
/**
* Delete a token by its unique ID.
*
* @param {string} tokenId - Token ID.
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @deprecated Use the object parameter style method for a better developer experience.
*/
delete(tokenId: string): Promise<{}>;
}
export { Tokens };

View File

@@ -1,169 +0,0 @@
'use strict';
var client = require('../client');
class Tokens {
constructor(client) {
this.client = client;
}
list(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
queries: rest[1],
total: rest[2]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const queries = params.queries;
const total = params.total;
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
if (typeof fileId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "fileId"');
}
const apiPath = "/tokens/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof queries !== "undefined") {
payload["queries"] = queries;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createFileToken(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
expire: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const expire = params.expire;
if (typeof bucketId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "bucketId"');
}
if (typeof fileId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "fileId"');
}
const apiPath = "/tokens/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof expire !== "undefined") {
payload["expire"] = expire;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
get(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst
};
}
const tokenId = params.tokenId;
if (typeof tokenId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
update(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst,
expire: rest[0]
};
}
const tokenId = params.tokenId;
const expire = params.expire;
if (typeof tokenId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
if (typeof expire !== "undefined") {
payload["expire"] = expire;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
delete(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst
};
}
const tokenId = params.tokenId;
if (typeof tokenId === "undefined") {
throw new client.AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
}
exports.Tokens = Tokens;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=tokens.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,168 +0,0 @@
import { AppwriteException } from '../client.mjs';
// src/services/tokens.ts
var Tokens = class {
constructor(client) {
this.client = client;
}
list(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
queries: rest[1],
total: rest[2]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const queries = params.queries;
const total = params.total;
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
if (typeof fileId === "undefined") {
throw new AppwriteException('Missing required parameter: "fileId"');
}
const apiPath = "/tokens/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof queries !== "undefined") {
payload["queries"] = queries;
}
if (typeof total !== "undefined") {
payload["total"] = total;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
createFileToken(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
bucketId: paramsOrFirst,
fileId: rest[0],
expire: rest[1]
};
}
const bucketId = params.bucketId;
const fileId = params.fileId;
const expire = params.expire;
if (typeof bucketId === "undefined") {
throw new AppwriteException('Missing required parameter: "bucketId"');
}
if (typeof fileId === "undefined") {
throw new AppwriteException('Missing required parameter: "fileId"');
}
const apiPath = "/tokens/buckets/{bucketId}/files/{fileId}".replace("{bucketId}", bucketId).replace("{fileId}", fileId);
const payload = {};
if (typeof expire !== "undefined") {
payload["expire"] = expire;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"post",
uri,
apiHeaders,
payload
);
}
get(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst
};
}
const tokenId = params.tokenId;
if (typeof tokenId === "undefined") {
throw new AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
update(paramsOrFirst, ...rest) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst,
expire: rest[0]
};
}
const tokenId = params.tokenId;
const expire = params.expire;
if (typeof tokenId === "undefined") {
throw new AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
if (typeof expire !== "undefined") {
payload["expire"] = expire;
}
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"patch",
uri,
apiHeaders,
payload
);
}
delete(paramsOrFirst) {
let params;
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
params = paramsOrFirst || {};
} else {
params = {
tokenId: paramsOrFirst
};
}
const tokenId = params.tokenId;
if (typeof tokenId === "undefined") {
throw new AppwriteException('Missing required parameter: "tokenId"');
}
const apiPath = "/tokens/{tokenId}".replace("{tokenId}", tokenId);
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {
"content-type": "application/json"
};
return this.client.call(
"delete",
uri,
apiHeaders,
payload
);
}
};
export { Tokens };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=tokens.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long