import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; import { Region } from '../enums/region'; import { Api } from '../enums/api'; import { AuthMethod } from '../enums/auth-method'; import { OAuthProvider } from '../enums/o-auth-provider'; import { PlatformType } from '../enums/platform-type'; import { ApiService } from '../enums/api-service'; import { SMTPSecure } from '../enums/s-m-t-p-secure'; import { EmailTemplateType } from '../enums/email-template-type'; import { EmailTemplateLocale } from '../enums/email-template-locale'; import { SmsTemplateType } from '../enums/sms-template-type'; import { SmsTemplateLocale } from '../enums/sms-template-locale'; export class Projects { client: Client; constructor(client: Client) { this.client = client; } /** * List projects * * * @param {string[]} queries * @param {string} search * @throws {AppwriteException} * @returns {Promise} */ async list(queries?: string[], search?: string): Promise { const apiPath = '/projects'; const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; } if (typeof search !== 'undefined') { payload['search'] = search; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Create project * * * @param {string} projectId * @param {string} name * @param {string} teamId * @param {Region} region * @param {string} description * @param {string} logo * @param {string} url * @param {string} legalName * @param {string} legalCountry * @param {string} legalState * @param {string} legalCity * @param {string} legalAddress * @param {string} legalTaxId * @throws {AppwriteException} * @returns {Promise} */ async create(projectId: string, name: string, teamId: string, region?: Region, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } const apiPath = '/projects'; const payload: Payload = {}; if (typeof projectId !== 'undefined') { payload['projectId'] = projectId; } if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof teamId !== 'undefined') { payload['teamId'] = teamId; } if (typeof region !== 'undefined') { payload['region'] = region; } if (typeof description !== 'undefined') { payload['description'] = description; } if (typeof logo !== 'undefined') { payload['logo'] = logo; } if (typeof url !== 'undefined') { payload['url'] = url; } if (typeof legalName !== 'undefined') { payload['legalName'] = legalName; } if (typeof legalCountry !== 'undefined') { payload['legalCountry'] = legalCountry; } if (typeof legalState !== 'undefined') { payload['legalState'] = legalState; } if (typeof legalCity !== 'undefined') { payload['legalCity'] = legalCity; } if (typeof legalAddress !== 'undefined') { payload['legalAddress'] = legalAddress; } if (typeof legalTaxId !== 'undefined') { payload['legalTaxId'] = legalTaxId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * Get project * * * @param {string} projectId * @throws {AppwriteException} * @returns {Promise} */ async get(projectId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update project * * * @param {string} projectId * @param {string} name * @param {string} description * @param {string} logo * @param {string} url * @param {string} legalName * @param {string} legalCountry * @param {string} legalState * @param {string} legalCity * @param {string} legalAddress * @param {string} legalTaxId * @throws {AppwriteException} * @returns {Promise} */ async update(projectId: string, name: string, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof description !== 'undefined') { payload['description'] = description; } if (typeof logo !== 'undefined') { payload['logo'] = logo; } if (typeof url !== 'undefined') { payload['url'] = url; } if (typeof legalName !== 'undefined') { payload['legalName'] = legalName; } if (typeof legalCountry !== 'undefined') { payload['legalCountry'] = legalCountry; } if (typeof legalState !== 'undefined') { payload['legalState'] = legalState; } if (typeof legalCity !== 'undefined') { payload['legalCity'] = legalCity; } if (typeof legalAddress !== 'undefined') { payload['legalAddress'] = legalAddress; } if (typeof legalTaxId !== 'undefined') { payload['legalTaxId'] = legalTaxId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Delete project * * * @param {string} projectId * @throws {AppwriteException} * @returns {Promise<{}>} */ async delete(projectId: string): Promise<{}> { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } const apiPath = '/projects/{projectId}'.replace('{projectId}', projectId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * Update API status * * * @param {string} projectId * @param {Api} api * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ async updateApiStatus(projectId: string, api: Api, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof api === 'undefined') { throw new AppwriteException('Missing required parameter: "api"'); } if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = '/projects/{projectId}/api'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof api !== 'undefined') { payload['api'] = api; } if (typeof status !== 'undefined') { payload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update all API status * * * @param {string} projectId * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ async updateApiStatusAll(projectId: string, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = '/projects/{projectId}/api/all'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof status !== 'undefined') { payload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update project authentication duration * * * @param {string} projectId * @param {number} duration * @throws {AppwriteException} * @returns {Promise} */ async updateAuthDuration(projectId: string, duration: number): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof duration === 'undefined') { throw new AppwriteException('Missing required parameter: "duration"'); } const apiPath = '/projects/{projectId}/auth/duration'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof duration !== 'undefined') { payload['duration'] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update project users limit * * * @param {string} projectId * @param {number} limit * @throws {AppwriteException} * @returns {Promise} */ async updateAuthLimit(projectId: string, limit: number): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof limit === 'undefined') { throw new AppwriteException('Missing required parameter: "limit"'); } const apiPath = '/projects/{projectId}/auth/limit'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof limit !== 'undefined') { payload['limit'] = limit; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update project user sessions limit * * * @param {string} projectId * @param {number} limit * @throws {AppwriteException} * @returns {Promise} */ async updateAuthSessionsLimit(projectId: string, limit: number): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof limit === 'undefined') { throw new AppwriteException('Missing required parameter: "limit"'); } const apiPath = '/projects/{projectId}/auth/max-sessions'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof limit !== 'undefined') { payload['limit'] = limit; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update the mock numbers for the project * * * @param {string} projectId * @param {object[]} numbers * @throws {AppwriteException} * @returns {Promise} */ async updateMockNumbers(projectId: string, numbers: object[]): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof numbers === 'undefined') { throw new AppwriteException('Missing required parameter: "numbers"'); } const apiPath = '/projects/{projectId}/auth/mock-numbers'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof numbers !== 'undefined') { payload['numbers'] = numbers; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update authentication password dictionary status. Use this endpoint to enable or disable the dicitonary check for user password * * * @param {string} projectId * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ async updateAuthPasswordDictionary(projectId: string, enabled: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); } const apiPath = '/projects/{projectId}/auth/password-dictionary'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update authentication password history. Use this endpoint to set the number of password history to save and 0 to disable password history. * * * @param {string} projectId * @param {number} limit * @throws {AppwriteException} * @returns {Promise} */ async updateAuthPasswordHistory(projectId: string, limit: number): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof limit === 'undefined') { throw new AppwriteException('Missing required parameter: "limit"'); } const apiPath = '/projects/{projectId}/auth/password-history'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof limit !== 'undefined') { payload['limit'] = limit; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Enable or disable checking user passwords for similarity with their personal data. * * * @param {string} projectId * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ async updatePersonalDataCheck(projectId: string, enabled: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); } const apiPath = '/projects/{projectId}/auth/personal-data'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update project sessions emails * * * @param {string} projectId * @param {boolean} alerts * @throws {AppwriteException} * @returns {Promise} */ async updateSessionAlerts(projectId: string, alerts: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof alerts === 'undefined') { throw new AppwriteException('Missing required parameter: "alerts"'); } const apiPath = '/projects/{projectId}/auth/session-alerts'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof alerts !== 'undefined') { payload['alerts'] = alerts; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update project auth method status. Use this endpoint to enable or disable a given auth method for this project. * * * @param {string} projectId * @param {AuthMethod} method * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ async updateAuthStatus(projectId: string, method: AuthMethod, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof method === 'undefined') { throw new AppwriteException('Missing required parameter: "method"'); } if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method); const payload: Payload = {}; if (typeof status !== 'undefined') { payload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Create JWT * * * @param {string} projectId * @param {string[]} scopes * @param {number} duration * @throws {AppwriteException} * @returns {Promise} */ async createJWT(projectId: string, scopes: string[], duration?: number): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } const apiPath = '/projects/{projectId}/jwts'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof scopes !== 'undefined') { payload['scopes'] = scopes; } if (typeof duration !== 'undefined') { payload['duration'] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * List keys * * * @param {string} projectId * @throws {AppwriteException} * @returns {Promise} */ async listKeys(projectId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Create key * * * @param {string} projectId * @param {string} name * @param {string[]} scopes * @param {string} expire * @throws {AppwriteException} * @returns {Promise} */ async createKey(projectId: string, name: string, scopes: string[], expire?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof scopes !== 'undefined') { payload['scopes'] = scopes; } if (typeof expire !== 'undefined') { payload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * Get key * * * @param {string} projectId * @param {string} keyId * @throws {AppwriteException} * @returns {Promise} */ async getKey(projectId: string, keyId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update key * * * @param {string} projectId * @param {string} keyId * @param {string} name * @param {string[]} scopes * @param {string} expire * @throws {AppwriteException} * @returns {Promise} */ async updateKey(projectId: string, keyId: string, name: string, scopes: string[], expire?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof scopes !== 'undefined') { payload['scopes'] = scopes; } if (typeof expire !== 'undefined') { payload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'put', uri, apiHeaders, payload ); } /** * Delete key * * * @param {string} projectId * @param {string} keyId * @throws {AppwriteException} * @returns {Promise<{}>} */ async deleteKey(projectId: string, keyId: string): Promise<{}> { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } const apiPath = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * Update project OAuth2 * * * @param {string} projectId * @param {OAuthProvider} provider * @param {string} appId * @param {string} secret * @param {boolean} enabled * @throws {AppwriteException} * @returns {Promise} */ async updateOAuth2(projectId: string, provider: OAuthProvider, appId?: string, secret?: string, enabled?: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof provider === 'undefined') { throw new AppwriteException('Missing required parameter: "provider"'); } const apiPath = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof provider !== 'undefined') { payload['provider'] = provider; } if (typeof appId !== 'undefined') { payload['appId'] = appId; } if (typeof secret !== 'undefined') { payload['secret'] = secret; } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * List platforms * * * @param {string} projectId * @throws {AppwriteException} * @returns {Promise} */ async listPlatforms(projectId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Create platform * * * @param {string} projectId * @param {PlatformType} type * @param {string} name * @param {string} key * @param {string} store * @param {string} hostname * @throws {AppwriteException} * @returns {Promise} */ async createPlatform(projectId: string, type: PlatformType, name: string, key?: string, store?: string, hostname?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } const apiPath = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof type !== 'undefined') { payload['type'] = type; } if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof key !== 'undefined') { payload['key'] = key; } if (typeof store !== 'undefined') { payload['store'] = store; } if (typeof hostname !== 'undefined') { payload['hostname'] = hostname; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * Get platform * * * @param {string} projectId * @param {string} platformId * @throws {AppwriteException} * @returns {Promise} */ async getPlatform(projectId: string, platformId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof platformId === 'undefined') { throw new AppwriteException('Missing required parameter: "platformId"'); } const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update platform * * * @param {string} projectId * @param {string} platformId * @param {string} name * @param {string} key * @param {string} store * @param {string} hostname * @throws {AppwriteException} * @returns {Promise} */ async updatePlatform(projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof platformId === 'undefined') { throw new AppwriteException('Missing required parameter: "platformId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof key !== 'undefined') { payload['key'] = key; } if (typeof store !== 'undefined') { payload['store'] = store; } if (typeof hostname !== 'undefined') { payload['hostname'] = hostname; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'put', uri, apiHeaders, payload ); } /** * Delete platform * * * @param {string} projectId * @param {string} platformId * @throws {AppwriteException} * @returns {Promise<{}>} */ async deletePlatform(projectId: string, platformId: string): Promise<{}> { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof platformId === 'undefined') { throw new AppwriteException('Missing required parameter: "platformId"'); } const apiPath = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * Update service status * * * @param {string} projectId * @param {ApiService} service * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ async updateServiceStatus(projectId: string, service: ApiService, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof service === 'undefined') { throw new AppwriteException('Missing required parameter: "service"'); } if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = '/projects/{projectId}/service'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof service !== 'undefined') { payload['service'] = service; } if (typeof status !== 'undefined') { payload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update all service status * * * @param {string} projectId * @param {boolean} status * @throws {AppwriteException} * @returns {Promise} */ async updateServiceStatusAll(projectId: string, status: boolean): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } const apiPath = '/projects/{projectId}/service/all'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof status !== 'undefined') { payload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Update SMTP * * * @param {string} projectId * @param {boolean} enabled * @param {string} senderName * @param {string} senderEmail * @param {string} replyTo * @param {string} host * @param {number} port * @param {string} username * @param {string} password * @param {SMTPSecure} secure * @throws {AppwriteException} * @returns {Promise} */ async updateSmtp(projectId: string, enabled: boolean, senderName?: string, senderEmail?: string, replyTo?: string, host?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); } const apiPath = '/projects/{projectId}/smtp'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } if (typeof senderName !== 'undefined') { payload['senderName'] = senderName; } if (typeof senderEmail !== 'undefined') { payload['senderEmail'] = senderEmail; } if (typeof replyTo !== 'undefined') { payload['replyTo'] = replyTo; } if (typeof host !== 'undefined') { payload['host'] = host; } if (typeof port !== 'undefined') { payload['port'] = port; } if (typeof username !== 'undefined') { payload['username'] = username; } if (typeof password !== 'undefined') { payload['password'] = password; } if (typeof secure !== 'undefined') { payload['secure'] = secure; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Create SMTP test * * * @param {string} projectId * @param {string[]} emails * @param {string} senderName * @param {string} senderEmail * @param {string} host * @param {string} replyTo * @param {number} port * @param {string} username * @param {string} password * @param {SMTPSecure} secure * @throws {AppwriteException} * @returns {Promise<{}>} */ async createSmtpTest(projectId: string, emails: string[], senderName: string, senderEmail: string, host: string, replyTo?: string, port?: number, username?: string, password?: string, secure?: SMTPSecure): Promise<{}> { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof emails === 'undefined') { throw new AppwriteException('Missing required parameter: "emails"'); } if (typeof senderName === 'undefined') { throw new AppwriteException('Missing required parameter: "senderName"'); } if (typeof senderEmail === 'undefined') { throw new AppwriteException('Missing required parameter: "senderEmail"'); } if (typeof host === 'undefined') { throw new AppwriteException('Missing required parameter: "host"'); } const apiPath = '/projects/{projectId}/smtp/tests'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof emails !== 'undefined') { payload['emails'] = emails; } if (typeof senderName !== 'undefined') { payload['senderName'] = senderName; } if (typeof senderEmail !== 'undefined') { payload['senderEmail'] = senderEmail; } if (typeof replyTo !== 'undefined') { payload['replyTo'] = replyTo; } if (typeof host !== 'undefined') { payload['host'] = host; } if (typeof port !== 'undefined') { payload['port'] = port; } if (typeof username !== 'undefined') { payload['username'] = username; } if (typeof password !== 'undefined') { payload['password'] = password; } if (typeof secure !== 'undefined') { payload['secure'] = secure; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * Update project team * * * @param {string} projectId * @param {string} teamId * @throws {AppwriteException} * @returns {Promise} */ async updateTeam(projectId: string, teamId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } const apiPath = '/projects/{projectId}/team'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof teamId !== 'undefined') { payload['teamId'] = teamId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Get custom email template * * * @param {string} projectId * @param {EmailTemplateType} type * @param {EmailTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ async getEmailTemplate(projectId: string, type: EmailTemplateType, locale: EmailTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update custom email templates * * * @param {string} projectId * @param {EmailTemplateType} type * @param {EmailTemplateLocale} locale * @param {string} subject * @param {string} message * @param {string} senderName * @param {string} senderEmail * @param {string} replyTo * @throws {AppwriteException} * @returns {Promise} */ async updateEmailTemplate(projectId: string, type: EmailTemplateType, locale: EmailTemplateLocale, subject: string, message: string, senderName?: string, senderEmail?: string, replyTo?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } if (typeof subject === 'undefined') { throw new AppwriteException('Missing required parameter: "subject"'); } if (typeof message === 'undefined') { throw new AppwriteException('Missing required parameter: "message"'); } const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; if (typeof subject !== 'undefined') { payload['subject'] = subject; } if (typeof message !== 'undefined') { payload['message'] = message; } if (typeof senderName !== 'undefined') { payload['senderName'] = senderName; } if (typeof senderEmail !== 'undefined') { payload['senderEmail'] = senderEmail; } if (typeof replyTo !== 'undefined') { payload['replyTo'] = replyTo; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Reset custom email template * * * @param {string} projectId * @param {EmailTemplateType} type * @param {EmailTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ async deleteEmailTemplate(projectId: string, type: EmailTemplateType, locale: EmailTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } const apiPath = '/projects/{projectId}/templates/email/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * Get custom SMS template * * * @param {string} projectId * @param {SmsTemplateType} type * @param {SmsTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ async getSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update custom SMS template * * * @param {string} projectId * @param {SmsTemplateType} type * @param {SmsTemplateLocale} locale * @param {string} message * @throws {AppwriteException} * @returns {Promise} */ async updateSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale, message: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } if (typeof message === 'undefined') { throw new AppwriteException('Missing required parameter: "message"'); } const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; if (typeof message !== 'undefined') { payload['message'] = message; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } /** * Reset custom SMS template * * * @param {string} projectId * @param {SmsTemplateType} type * @param {SmsTemplateLocale} locale * @throws {AppwriteException} * @returns {Promise} */ async deleteSmsTemplate(projectId: string, type: SmsTemplateType, locale: SmsTemplateLocale): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof locale === 'undefined') { throw new AppwriteException('Missing required parameter: "locale"'); } const apiPath = '/projects/{projectId}/templates/sms/{type}/{locale}'.replace('{projectId}', projectId).replace('{type}', type).replace('{locale}', locale); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * List webhooks * * * @param {string} projectId * @throws {AppwriteException} * @returns {Promise} */ async listWebhooks(projectId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Create webhook * * * @param {string} projectId * @param {string} name * @param {string[]} events * @param {string} url * @param {boolean} security * @param {boolean} enabled * @param {string} httpUser * @param {string} httpPass * @throws {AppwriteException} * @returns {Promise} */ async createWebhook(projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof events === 'undefined') { throw new AppwriteException('Missing required parameter: "events"'); } if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } if (typeof security === 'undefined') { throw new AppwriteException('Missing required parameter: "security"'); } const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } if (typeof events !== 'undefined') { payload['events'] = events; } if (typeof url !== 'undefined') { payload['url'] = url; } if (typeof security !== 'undefined') { payload['security'] = security; } if (typeof httpUser !== 'undefined') { payload['httpUser'] = httpUser; } if (typeof httpPass !== 'undefined') { payload['httpPass'] = httpPass; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'post', uri, apiHeaders, payload ); } /** * Get webhook * * * @param {string} projectId * @param {string} webhookId * @throws {AppwriteException} * @returns {Promise} */ async getWebhook(projectId: string, webhookId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); } const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'get', uri, apiHeaders, payload ); } /** * Update webhook * * * @param {string} projectId * @param {string} webhookId * @param {string} name * @param {string[]} events * @param {string} url * @param {boolean} security * @param {boolean} enabled * @param {string} httpUser * @param {string} httpPass * @throws {AppwriteException} * @returns {Promise} */ async updateWebhook(projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof events === 'undefined') { throw new AppwriteException('Missing required parameter: "events"'); } if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } if (typeof security === 'undefined') { throw new AppwriteException('Missing required parameter: "security"'); } const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } if (typeof events !== 'undefined') { payload['events'] = events; } if (typeof url !== 'undefined') { payload['url'] = url; } if (typeof security !== 'undefined') { payload['security'] = security; } if (typeof httpUser !== 'undefined') { payload['httpUser'] = httpUser; } if (typeof httpPass !== 'undefined') { payload['httpPass'] = httpPass; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'put', uri, apiHeaders, payload ); } /** * Delete webhook * * * @param {string} projectId * @param {string} webhookId * @throws {AppwriteException} * @returns {Promise<{}>} */ async deleteWebhook(projectId: string, webhookId: string): Promise<{}> { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); } const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'delete', uri, apiHeaders, payload ); } /** * Update webhook signature key * * * @param {string} projectId * @param {string} webhookId * @throws {AppwriteException} * @returns {Promise} */ async updateWebhookSignature(projectId: string, webhookId: string): Promise { if (typeof projectId === 'undefined') { throw new AppwriteException('Missing required parameter: "projectId"'); } if (typeof webhookId === 'undefined') { throw new AppwriteException('Missing required parameter: "webhookId"'); } const apiPath = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', } return await this.client.call( 'patch', uri, apiHeaders, payload ); } }