From 28db040e57f8e8f1088cfdc4149f73409768d23b Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 2 Aug 2022 12:21:31 +0200 Subject: [PATCH] fix: console sdk --- composer.json | 2 +- composer.lock | 20 +- package-lock.json | 63 +- package.json | 4 +- public/dist/scripts/app-all.js | 761 +- public/dist/scripts/app-dep.js | 750 +- public/dist/scripts/app.js | 11 +- public/scripts/dependencies/appwrite.js | 12141 +++++++++++----------- public/scripts/init.js | 2 +- public/scripts/services/console.js | 18 +- public/scripts/services/sdk.js | 17 +- public/scripts/views/service.js | 8 +- 12 files changed, 7313 insertions(+), 6484 deletions(-) diff --git a/composer.json b/composer.json index c95dbab81..4f2634166 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,7 @@ } ], "require-dev": { - "appwrite/sdk-generator": "0.19.5", + "appwrite/sdk-generator": "0.20.0", "phpunit/phpunit": "9.5.20", "squizlabs/php_codesniffer": "^3.6", "swoole/ide-helper": "4.8.9", diff --git a/composer.lock b/composer.lock index 2b6c6e6e6..2e32ade98 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "677b1b47c8567f0b7b05645e2bbc7bc7", + "content-hash": "7f417dc4a1f0d5ed97b3d6a88aa72adf", "packages": [ { "name": "adhocore/jwt", @@ -2828,29 +2828,29 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.19.5", + "version": "0.20.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "04de540cf683e2b08b3192c137dde7f2c37003d9" + "reference": "af7dd08848a78a0d38befa3e63083eb0186806f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/04de540cf683e2b08b3192c137dde7f2c37003d9", - "reference": "04de540cf683e2b08b3192c137dde7f2c37003d9", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/af7dd08848a78a0d38befa3e63083eb0186806f7", + "reference": "af7dd08848a78a0d38befa3e63083eb0186806f7", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "matthiasmullie/minify": "^1.3", + "matthiasmullie/minify": "^1.3.68", "php": ">=7.0.0", - "twig/twig": "^3.3" + "twig/twig": "^3.4.1" }, "require-dev": { "brianium/paratest": "^6.4", - "phpunit/phpunit": "^9.5.13" + "phpunit/phpunit": "^9.5.21" }, "type": "library", "autoload": { @@ -2872,9 +2872,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.19.5" + "source": "https://github.com/appwrite/sdk-generator/tree/0.20.0" }, - "time": "2022-07-06T11:05:57+00:00" + "time": "2022-08-02T10:09:48+00:00" }, { "name": "doctrine/instantiator", diff --git a/package-lock.json b/package-lock.json index e6a0f6354..5128c39d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.1.0", "license": "BSD-3-Clause", "dependencies": { - "chart.js": "^3.8.0", - "markdown-it": "^12.3.2", + "chart.js": "^3.8.2", + "markdown-it": "^13.0.1", "pell": "^1.0.6", "prismjs": "^1.28.0", "turndown": "^7.1.1" @@ -549,9 +549,9 @@ } }, "node_modules/chart.js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.0.tgz", - "integrity": "sha512-cr8xhrXjLIXVLOBZPkBZVF6NDeiVIrPLHcMhnON7UufudL+CNeRrD+wpYanswlm8NpudMdrt3CHoLMQMxJhHRg==" + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.2.tgz", + "integrity": "sha512-7rqSlHWMUKFyBDOJvmFGW2lxULtcwaPLegDjX/Nu5j6QybY+GCiQkEY+6cqHw62S5tcwXMD8Y+H5OBGoR7d+ZQ==" }, "node_modules/chokidar": { "version": "2.1.8", @@ -1067,9 +1067,12 @@ } }, "node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "engines": { + "node": ">=0.12" + }, "funding": { "url": "https://github.com/fb55/entities?sponsor=1" } @@ -2606,9 +2609,9 @@ } }, "node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", + "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "dependencies": { "uc.micro": "^1.0.1" } @@ -2862,13 +2865,13 @@ } }, "node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", + "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", "dependencies": { "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", + "entities": "~3.0.1", + "linkify-it": "^4.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" }, @@ -5484,9 +5487,9 @@ "dev": true }, "chart.js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.0.tgz", - "integrity": "sha512-cr8xhrXjLIXVLOBZPkBZVF6NDeiVIrPLHcMhnON7UufudL+CNeRrD+wpYanswlm8NpudMdrt3CHoLMQMxJhHRg==" + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.8.2.tgz", + "integrity": "sha512-7rqSlHWMUKFyBDOJvmFGW2lxULtcwaPLegDjX/Nu5j6QybY+GCiQkEY+6cqHw62S5tcwXMD8Y+H5OBGoR7d+ZQ==" }, "chokidar": { "version": "2.1.8", @@ -5924,9 +5927,9 @@ } }, "entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==" }, "errno": { "version": "0.1.8", @@ -7178,9 +7181,9 @@ } }, "linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", + "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "requires": { "uc.micro": "^1.0.1" } @@ -7413,13 +7416,13 @@ } }, "markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.1.tgz", + "integrity": "sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==", "requires": { "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", + "entities": "~3.0.1", + "linkify-it": "^4.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" } diff --git a/package.json b/package.json index c7b3aebd0..4f553db0e 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "gulp-less": "^5.0.0" }, "dependencies": { - "chart.js": "^3.8.0", - "markdown-it": "^12.3.2", + "chart.js": "^3.8.2", + "markdown-it": "^13.0.1", "pell": "^1.0.6", "prismjs": "^1.28.0", "turndown": "^7.1.1" diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 3e8275db2..3163702c6 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -4,43 +4,83 @@ return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){tr function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}} function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);} step((generator=generator.apply(thisArg,_arguments||[])).next());});} -class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}} -class Appwrite{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:5.0.0','X-Appwrite-Response-Format':'0.15.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1) +class Service{constructor(client){this.client=client;} +static flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));} +else{output[finalKey]=value;}} +return output;}} +Service.CHUNK_SIZE=5*1024*1024;class Query{} +Query.equal=(attribute,value)=>Query.addQuery(attribute,'equal',value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,'notEqual',value);Query.lesser=(attribute,value)=>Query.addQuery(attribute,'lesser',value);Query.lesserEqual=(attribute,value)=>Query.addQuery(attribute,'lesserEqual',value);Query.greater=(attribute,value)=>Query.addQuery(attribute,'greater',value);Query.greaterEqual=(attribute,value)=>Query.addQuery(attribute,'greaterEqual',value);Query.search=(attribute,value)=>Query.addQuery(attribute,'search',value);Query.addQuery=(attribute,oper,value)=>value instanceof Array?`${attribute}.${oper}(${value + .map((v) => Query.parseValues(v)) + .join(',')})`:`${attribute}.${oper}(${Query.parseValues(value)})`;Query.parseValues=(value)=>typeof value==='string'||value instanceof String?`"${value}"`:`${value}`;class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}} +class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:6.0.0','X-Appwrite-Response-Format':'0.15.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1) return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState){this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;} const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));} break;case'event':let data=message.data;if(data===null||data===void 0?void 0:data.channels){const isSubscribed=data.channels.some(channel=>this.realtime.channels.has(channel));if(!isSubscribed) return;this.realtime.subscriptions.forEach(subscription=>{if(data.channels.some(channel=>subscription.channels.includes(channel))){setTimeout(()=>subscription.callback(data));}});} break;case'error':throw message.data;default:break;}} -catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};} +setEndpoint(endpoint){this.config.endpoint=endpoint;this.config.endpointRealtime=this.config.endpointRealtime||this.config.endpoint.replace('https://','wss://').replace('http://','ws://');return this;} +setEndpointRealtime(endpointRealtime){this.config.endpointRealtime=endpointRealtime;return this;} +setProject(value){this.headers['X-Appwrite-Project']=value;this.config.project=value;return this;} +setKey(value){this.headers['X-Appwrite-Key']=value;this.config.key=value;return this;} +setJWT(value){this.headers['X-Appwrite-JWT']=value;this.config.jwt=value;return this;} +setLocale(value){this.headers['X-Appwrite-Locale']=value;this.config.locale=value;return this;} +setMode(value){this.headers['X-Appwrite-Mode']=value;this.config.mode=value;return this;} +subscribe(channels,callback){let channelArray=typeof channels==='string'?[channels]:channels;channelArray.forEach(channel=>this.realtime.channels.add(channel));const counter=this.realtime.subscriptionsCounter++;this.realtime.subscriptions.set(counter,{channels:channelArray,callback});this.realtime.connect();return()=>{this.realtime.subscriptions.delete(counter);this.realtime.cleanUp(channelArray);this.realtime.connect();};} +call(method,url,headers={},params={}){var _a,_b;return __awaiter(this,void 0,void 0,function*(){method=method.toUpperCase();headers=Object.assign({},this.headers,headers);let options={method,headers,credentials:'include'};if(typeof window!=='undefined'&&window.localStorage){headers['X-Fallback-Cookies']=(_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'';} +if(method==='GET'){for(const[key,value]of Object.entries(Service.flatten(params))){url.searchParams.append(key,value);}} +else{switch(headers['content-type']){case'application/json':options.body=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();for(const key in params){if(Array.isArray(params[key])){params[key].forEach((value)=>{formData.append(key+'[]',value);});} +else{formData.append(key,params[key]);}} +options.body=formData;delete headers['content-type'];break;}} +try{let data=null;const response=yield crossFetch.fetch(url.toString(),options);if((_b=response.headers.get('content-type'))===null||_b===void 0?void 0:_b.includes('application/json')){data=yield response.json();} +else{data={message:yield response.text()};} +if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data===null||data===void 0?void 0:data.type,data);} +const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);} +return data;} +catch(e){if(e instanceof AppwriteException){throw e;} +throw new AppwriteException(e.message);}});}} +class Account extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(userId,email,password,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateEmail:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateEmail(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/email';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createJWT:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getLogs:(limit,offset)=>__awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createJWT(){return __awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getLogs(limit,offset){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateName:(name)=>__awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateName(name){return __awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/account/name';let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePassword:(password,oldPassword)=>__awaiter(this,void 0,void 0,function*(){if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePassword(password,oldPassword){return __awaiter(this,void 0,void 0,function*(){if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/password';let payload={};if(typeof password!=='undefined'){payload['password']=password;} if(typeof oldPassword!=='undefined'){payload['oldPassword']=oldPassword;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhone:(number,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhone(number,password){return __awaiter(this,void 0,void 0,function*(){if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/phone';let payload={};if(typeof number!=='undefined'){payload['number']=number;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getPrefs:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/prefs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(prefs)=>__awaiter(this,void 0,void 0,function*(){if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getPrefs(){return __awaiter(this,void 0,void 0,function*(){let path='/account/prefs';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePrefs(prefs){return __awaiter(this,void 0,void 0,function*(){if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} let path='/account/prefs';let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createRecovery:(email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createRecovery(email,url){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/account/recovery';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateRecovery:(userId,secret,password,passwordAgain)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateRecovery(userId,secret,password,passwordAgain){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} if(typeof passwordAgain==='undefined'){throw new AppwriteException('Missing required parameter: "passwordAgain"');} @@ -48,105 +88,139 @@ let path='/account/recovery';let payload={};if(typeof userId!=='undefined'){payl if(typeof secret!=='undefined'){payload['secret']=secret;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof passwordAgain!=='undefined'){payload['passwordAgain']=passwordAgain;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),getSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailSession:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +getSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +createAnonymousSession(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEmailSession(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/sessions/email';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(userId,email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createMagicURLSession(userId,email,url){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateMagicURLSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateMagicURLSession(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +createOAuth2Session(provider,success,failure,scopes){if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} let path='/account/sessions/oauth2/{provider}'.replace('{provider}',provider);let payload={};if(typeof success!=='undefined'){payload['success']=success;} if(typeof failure!=='undefined'){payload['failure']=failure;} if(typeof scopes!=='undefined'){payload['scopes']=scopes;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} if(typeof window!=='undefined'&&(window===null||window===void 0?void 0:window.location)){window.location.href=uri.toString();} -else{return uri;}},createPhoneSession:(userId,number)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +else{return uri;}} +createPhoneSession(userId,number){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} let path='/account/sessions/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof number!=='undefined'){payload['number']=number;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updatePhoneSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updatePhoneSession(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/sessions/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),getSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateStatus:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/status';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createVerification:(url)=>__awaiter(this,void 0,void 0,function*(){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +getSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateStatus(){return __awaiter(this,void 0,void 0,function*(){let path='/account/status';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createVerification(url){return __awaiter(this,void 0,void 0,function*(){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/account/verification';let payload={};if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateVerification:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateVerification(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/verification';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createPhoneVerification:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/verification/phone';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updatePhoneVerification:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +createPhoneVerification(){return __awaiter(this,void 0,void 0,function*(){let path='/account/verification/phone';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updatePhoneVerification(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/verification/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);})};this.avatars={getBrowser:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}} +class Avatars extends Service{constructor(client){super(client);} +getBrowser(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/browsers/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getCreditCard:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getCreditCard(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/credit-cards/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFavicon:(url)=>{if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFavicon(url){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/avatars/favicon';let payload={};if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFlag:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFlag(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/flags/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getImage:(url,width,height)=>{if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getImage(url,width,height){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/avatars/image';let payload={};if(typeof url!=='undefined'){payload['url']=url;} if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getInitials:(name,width,height,color,background)=>{let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getInitials(name,width,height,color,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;} if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof color!=='undefined'){payload['color']=color;} if(typeof background!=='undefined'){payload['background']=background;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getQR:(text,size,margin,download)=>{if(typeof text==='undefined'){throw new AppwriteException('Missing required parameter: "text"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getQR(text,size,margin,download){if(typeof text==='undefined'){throw new AppwriteException('Missing required parameter: "text"');} let path='/avatars/qr';let payload={};if(typeof text!=='undefined'){payload['text']=text;} if(typeof size!=='undefined'){payload['size']=size;} if(typeof margin!=='undefined'){payload['margin']=margin;} if(typeof download!=='undefined'){payload['download']=download;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;}};this.databases={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/databases';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;}} +class Databases extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/databases';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(databaseId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(databaseId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/databases';let payload={};if(typeof databaseId!=='undefined'){payload['databaseId']=databaseId;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getUsage:(range)=>__awaiter(this,void 0,void 0,function*(){let path='/databases/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(databaseId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} -let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(databaseId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/databases/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(databaseId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(databaseId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(databaseId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} -let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listCollections:(databaseId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(databaseId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listCollections(databaseId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/collections'.replace('{databaseId}',databaseId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createCollection:(databaseId,collectionId,name,permission,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createCollection(databaseId,collectionId,name,permission,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} @@ -157,9 +231,11 @@ if(typeof name!=='undefined'){payload['name']=name;} if(typeof permission!=='undefined'){payload['permission']=permission;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getCollection:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateCollection:(databaseId,collectionId,name,permission,read,write,enabled)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateCollection(databaseId,collectionId,name,permission,read,write,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} @@ -168,11 +244,14 @@ if(typeof permission!=='undefined'){payload['permission']=permission;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} if(typeof enabled!=='undefined'){payload['enabled']=enabled;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteCollection:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listAttributes:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listAttributes(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createBooleanAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createBooleanAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -180,7 +259,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/boolean' if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEmailAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -188,7 +268,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/email'.r if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEnumAttribute:(databaseId,collectionId,key,elements,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEnumAttribute(databaseId,collectionId,key,elements,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof elements==='undefined'){throw new AppwriteException('Missing required parameter: "elements"');} @@ -198,7 +279,8 @@ if(typeof elements!=='undefined'){payload['elements']=elements;} if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createFloatAttribute:(databaseId,collectionId,key,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createFloatAttribute(databaseId,collectionId,key,required,min,max,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -208,7 +290,8 @@ if(typeof min!=='undefined'){payload['min']=min;} if(typeof max!=='undefined'){payload['max']=max;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIntegerAttribute:(databaseId,collectionId,key,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createIntegerAttribute(databaseId,collectionId,key,required,min,max,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -218,7 +301,8 @@ if(typeof min!=='undefined'){payload['min']=min;} if(typeof max!=='undefined'){payload['max']=max;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIpAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createIpAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -226,7 +310,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/ip'.repl if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createStringAttribute:(databaseId,collectionId,key,size,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createStringAttribute(databaseId,collectionId,key,size,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof size==='undefined'){throw new AppwriteException('Missing required parameter: "size"');} @@ -236,7 +321,8 @@ if(typeof size!=='undefined'){payload['size']=size;} if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createUrlAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createUrlAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -244,13 +330,16 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/url'.rep if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getAttribute:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getAttribute(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteAttribute:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteAttribute(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDocuments:(databaseId,collectionId,queries,limit,offset,cursor,cursorDirection,orderAttributes,orderTypes)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDocuments(databaseId,collectionId,queries,limit,offset,cursor,cursorDirection,orderAttributes,orderTypes){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;} if(typeof limit!=='undefined'){payload['limit']=limit;} @@ -259,7 +348,8 @@ if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderAttributes!=='undefined'){payload['orderAttributes']=orderAttributes;} if(typeof orderTypes!=='undefined'){payload['orderTypes']=orderTypes;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDocument:(databaseId,collectionId,documentId,data,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDocument(databaseId,collectionId,documentId,data,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} if(typeof data==='undefined'){throw new AppwriteException('Missing required parameter: "data"');} @@ -267,27 +357,32 @@ let path='/databases/{databaseId}/collections/{collectionId}/documents'.replace( if(typeof data!=='undefined'){payload['data']=data;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDocument:(databaseId,collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getDocument(databaseId,collectionId,documentId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateDocument:(databaseId,collectionId,documentId,data,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateDocument(databaseId,collectionId,documentId,data,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -if(typeof data==='undefined'){throw new AppwriteException('Missing required parameter: "data"');} let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};if(typeof data!=='undefined'){payload['data']=data;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteDocument:(databaseId,collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteDocument(databaseId,collectionId,documentId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDocumentLogs:(databaseId,collectionId,documentId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDocumentLogs(databaseId,collectionId,documentId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listIndexes:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listIndexes(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createIndex:(databaseId,collectionId,key,type,attributes,orders)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createIndex(databaseId,collectionId,key,type,attributes,orders){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof type==='undefined'){throw new AppwriteException('Missing required parameter: "type"');} @@ -296,31 +391,40 @@ let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{ if(typeof type!=='undefined'){payload['type']=type;} if(typeof attributes!=='undefined'){payload['attributes']=attributes;} if(typeof orders!=='undefined'){payload['orders']=orders;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getIndex:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getIndex(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteIndex:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteIndex(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listCollectionLogs:(databaseId,collectionId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listCollectionLogs(databaseId,collectionId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCollectionUsage:(databaseId,collectionId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCollectionUsage(databaseId,collectionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listLogs:(databaseId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listLogs(databaseId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/logs'.replace('{databaseId}',databaseId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getDatabaseUsage:(databaseId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getDatabaseUsage(databaseId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/usage'.replace('{databaseId}',databaseId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.functions={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Functions extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(functionId,name,execute,runtime,vars,events,schedule,timeout)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(functionId,name,execute,runtime,vars,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');} if(typeof runtime==='undefined'){throw new AppwriteException('Missing required parameter: "runtime"');} @@ -332,8 +436,11 @@ if(typeof vars!=='undefined'){payload['vars']=vars;} if(typeof events!=='undefined'){payload['events']=events;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),listRuntimes:()=>__awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} -let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(functionId,name,execute,vars,events,schedule,timeout)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +listRuntimes(){return __awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(functionId,name,execute,vars,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');} let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} @@ -342,55 +449,88 @@ if(typeof vars!=='undefined'){payload['vars']=vars;} if(typeof events!=='undefined'){payload['events']=events;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} -let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDeployments:(functionId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDeployments(functionId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/deployments'.replace('{functionId}',functionId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDeployment:(functionId,entrypoint,code,activate,onProgress=(progress)=>{})=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDeployment(functionId,entrypoint,code,activate,onProgress=(progress)=>{}){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof entrypoint==='undefined'){throw new AppwriteException('Missing required parameter: "entrypoint"');} if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} if(typeof activate==='undefined'){throw new AppwriteException('Missing required parameter: "activate"');} let path='/functions/{functionId}/deployments'.replace('{functionId}',functionId);let payload={};if(typeof entrypoint!=='undefined'){payload['entrypoint']=entrypoint;} if(typeof code!=='undefined'){payload['code']=code;} if(typeof activate!=='undefined'){payload['activate']=activate;} -const uri=new URL(this.config.endpoint+path);if(!(code instanceof File)){throw new AppwriteException('Parameter "code" has to be a File.');} -const size=code.size;if(size<=Appwrite.CHUNK_SIZE){return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);} -let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Appwrite.CHUNK_SIZE);for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);if(!(code instanceof File)){throw new AppwriteException('Parameter "code" has to be a File.');} +const size=code.size;if(size<=Service.CHUNK_SIZE){return yield this.client.call('post',uri,{'content-type':'multipart/form-data',},payload);} +let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Service.CHUNK_SIZE);for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateDeployment(functionId,deploymentId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} -let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteDeployment:(functionId,deploymentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteDeployment(functionId,deploymentId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} -let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),retryBuild:(functionId,deploymentId,buildId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +retryBuild(functionId,deploymentId,buildId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} if(typeof buildId==='undefined'){throw new AppwriteException('Missing required parameter: "buildId"');} -let path='/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId).replace('{buildId}',buildId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,search,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId).replace('{buildId}',buildId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +listExecutions(functionId,limit,offset,search,cursor,cursorDirection){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof search!=='undefined'){payload['search']=search;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createExecution:(functionId,data,async)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createExecution(functionId,data,async){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof data!=='undefined'){payload['data']=data;} if(typeof async!=='undefined'){payload['async']=async;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getExecution:(functionId,executionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getExecution(functionId,executionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof executionId==='undefined'){throw new AppwriteException('Missing required parameter: "executionId"');} -let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId}',functionId).replace('{executionId}',executionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getUsage:(functionId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId}',functionId).replace('{executionId}',executionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getUsage(functionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/usage'.replace('{functionId}',functionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.health={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/health';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getAntivirus:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/anti-virus';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCache:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/cache';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getDB:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/db';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueCertificates:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/certificates';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueFunctions:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/functions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueLogs:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/logs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueWebhooks:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/webhooks';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getStorageLocal:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/storage/local';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getTime:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.locale={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getContinents:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountries:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesEU:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesPhones:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCurrencies:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getLanguages:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.projects={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Health extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/health';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getAntivirus(){return __awaiter(this,void 0,void 0,function*(){let path='/health/anti-virus';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCache(){return __awaiter(this,void 0,void 0,function*(){let path='/health/cache';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getDB(){return __awaiter(this,void 0,void 0,function*(){let path='/health/db';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueCertificates(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/certificates';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueFunctions(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/functions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueLogs(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/logs';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueWebhooks(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/webhooks';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getStorageLocal(){return __awaiter(this,void 0,void 0,function*(){let path='/health/storage/local';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getTime(){return __awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Locale extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Projects extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(projectId,name,teamId,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(projectId,name,teamId,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects';let payload={};if(typeof projectId!=='undefined'){payload['projectId']=projectId;} @@ -405,8 +545,10 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(projectId,name,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +get(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(projectId,name,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} if(typeof description!=='undefined'){payload['description']=description;} @@ -418,51 +560,67 @@ 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.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),delete:(projectId,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +delete(projectId,password){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateAuthLimit:(projectId,limit)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateAuthLimit(projectId,limit){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof limit==='undefined'){throw new AppwriteException('Missing required parameter: "limit"');} let path='/projects/{projectId}/auth/limit'.replace('{projectId}',projectId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updateAuthStatus:(projectId,method,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updateAuthStatus(projectId,method,status){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/auth/{method}'.replace('{projectId}',projectId).replace('{method}',method);let payload={};if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listDomains:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDomain:(projectId,domain)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listDomains(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDomain(projectId,domain){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domain==='undefined'){throw new AppwriteException('Missing required parameter: "domain"');} let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};if(typeof domain!=='undefined'){payload['domain']=domain;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getDomain(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteDomain(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateDomainVerification:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateDomainVerification(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listKeys:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createKey:(projectId,name,scopes,expire)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listKeys(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createKey(projectId,name,scopes,expire){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getKey(projectId,keyId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof keyId==='undefined'){throw new AppwriteException('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateKey:(projectId,keyId,name,scopes,expire)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateKey(projectId,keyId,name,scopes,expire){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteKey(projectId,keyId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof keyId==='undefined'){throw new AppwriteException('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateOAuth2:(projectId,provider,appId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateOAuth2(projectId,provider,appId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} let path='/projects/{projectId}/oauth2'.replace('{projectId}',projectId);let payload={};if(typeof provider!=='undefined'){payload['provider']=provider;} if(typeof appId!=='undefined'){payload['appId']=appId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listPlatforms:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createPlatform:(projectId,type,name,key,store,hostname)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listPlatforms(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createPlatform(projectId,type,name,key,store,hostname){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};if(typeof type!=='undefined'){payload['type']=type;} @@ -470,26 +628,33 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getPlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getPlatform(projectId,platformId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof platformId==='undefined'){throw new AppwriteException('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePlatform:(projectId,platformId,name,key,store,hostname)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePlatform(projectId,platformId,name,key,store,hostname){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deletePlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deletePlatform(projectId,platformId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof platformId==='undefined'){throw new AppwriteException('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateServiceStatus:(projectId,service,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateServiceStatus(projectId,service,status){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/service'.replace('{projectId}',projectId);let payload={};if(typeof service!=='undefined'){payload['service']=service;} if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getUsage:(projectId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getUsage(projectId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} let path='/projects/{projectId}/usage'.replace('{projectId}',projectId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listWebhooks:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createWebhook:(projectId,name,events,url,security,httpUser,httpPass)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listWebhooks(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createWebhook(projectId,name,events,url,security,httpUser,httpPass){return __awaiter(this,void 0,void 0,function*(){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"');} @@ -500,9 +665,11 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getWebhook(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateWebhook:(projectId,webhookId,name,events,url,security,httpUser,httpPass)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateWebhook(projectId,webhookId,name,events,url,security,httpUser,httpPass){return __awaiter(this,void 0,void 0,function*(){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"');} @@ -514,17 +681,22 @@ 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteWebhook(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateWebhookSignature:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateWebhookSignature(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};this.storage={listBuckets:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +let path='/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +class Storage extends Service{constructor(client){super(client);} +listBuckets(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createBucket:(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createBucket(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} let path='/storage/buckets';let payload={};if(typeof bucketId!=='undefined'){payload['bucketId']=bucketId;} @@ -537,8 +709,10 @@ if(typeof maximumFileSize!=='undefined'){payload['maximumFileSize']=maximumFileS if(typeof allowedFileExtensions!=='undefined'){payload['allowedFileExtensions']=allowedFileExtensions;} if(typeof encryption!=='undefined'){payload['encryption']=encryption;} if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getBucket:(bucketId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} -let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateBucket:(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateBucket(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} @@ -550,40 +724,48 @@ if(typeof maximumFileSize!=='undefined'){payload['maximumFileSize']=maximumFileS if(typeof allowedFileExtensions!=='undefined'){payload['allowedFileExtensions']=allowedFileExtensions;} if(typeof encryption!=='undefined'){payload['encryption']=encryption;} if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteBucket:(bucketId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} -let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listFiles:(bucketId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listFiles(bucketId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} let path='/storage/buckets/{bucketId}/files'.replace('{bucketId}',bucketId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createFile:(bucketId,fileId,file,read,write,onProgress=(progress)=>{})=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createFile(bucketId,fileId,file,read,write,onProgress=(progress)=>{}){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} if(typeof file==='undefined'){throw new AppwriteException('Missing required parameter: "file"');} let path='/storage/buckets/{bucketId}/files'.replace('{bucketId}',bucketId);let payload={};if(typeof fileId!=='undefined'){payload['fileId']=fileId;} if(typeof file!=='undefined'){payload['file']=file;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);if(!(file instanceof File)){throw new AppwriteException('Parameter "file" has to be a File.');} -const size=file.size;if(size<=Appwrite.CHUNK_SIZE){return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);} -let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Appwrite.CHUNK_SIZE);if(fileId!='unique()'){try{response=yield this.call('GET',new URL(this.config.endpoint+path+'/'+fileId),headers);counter=response.chunksUploaded;} +const uri=new URL(this.client.config.endpoint+path);if(!(file instanceof File)){throw new AppwriteException('Parameter "file" has to be a File.');} +const size=file.size;if(size<=Service.CHUNK_SIZE){return yield this.client.call('post',uri,{'content-type':'multipart/form-data',},payload);} +let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Service.CHUNK_SIZE);if(fileId!='unique()'){try{response=yield this.client.call('GET',new URL(this.client.config.endpoint+path+'/'+fileId),headers);counter=response.chunksUploaded;} catch(e){}} -for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateFile(bucketId,fileId,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteFile:(bucketId,fileId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteFile(bucketId,fileId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getFileDownload:(bucketId,fileId)=>{if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +getFileDownload(bucketId,fileId){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},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"');} +let path='/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +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"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} let path='/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} @@ -596,40 +778,52 @@ if(typeof opacity!=='undefined'){payload['opacity']=opacity;} if(typeof rotation!=='undefined'){payload['rotation']=rotation;} if(typeof background!=='undefined'){payload['background']=background;} if(typeof output!=='undefined'){payload['output']=output;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFileView:(bucketId,fileId)=>{if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFileView(bucketId,fileId){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getUsage:(range)=>__awaiter(this,void 0,void 0,function*(){let path='/storage/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getBucketUsage:(bucketId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/storage/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getBucketUsage(bucketId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} let path='/storage/{bucketId}/usage'.replace('{bucketId}',bucketId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.teams={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/teams';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Teams extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/teams';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(teamId,name,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(teamId,name,roles){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/teams';let payload={};if(typeof teamId!=='undefined'){payload['teamId']=teamId;} if(typeof name!=='undefined'){payload['name']=name;} if(typeof roles!=='undefined'){payload['roles']=roles;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(teamId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +get(teamId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(teamId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listLogs:(teamId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(teamId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listLogs(teamId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} let path='/teams/{teamId}/logs'.replace('{teamId}',teamId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getMemberships:(teamId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getMemberships(teamId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createMembership:(teamId,email,roles,url,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createMembership(teamId,email,roles,url,name){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');} if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} @@ -637,98 +831,96 @@ let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={} if(typeof roles!=='undefined'){payload['roles']=roles;} if(typeof url!=='undefined'){payload['url']=url;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getMembership(teamId,membershipId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} -let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateMembershipRoles:(teamId,membershipId,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateMembershipRoles(teamId,membershipId,roles){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');} let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof roles!=='undefined'){payload['roles']=roles;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteMembership(teamId,membershipId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} -let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateMembershipStatus:(teamId,membershipId,userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateMembershipStatus(teamId,membershipId,userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};this.users={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/users';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +class Users extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/users';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(userId,email,password,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/users';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getUsage:(range,provider)=>__awaiter(this,void 0,void 0,function*(){let path='/users/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getUsage(range,provider){return __awaiter(this,void 0,void 0,function*(){let path='/users/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} if(typeof provider!=='undefined'){payload['provider']=provider;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),delete:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateEmail:(userId,email)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +delete(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateEmail(userId,email){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} let path='/users/{userId}/email'.replace('{userId}',userId);let payload={};if(typeof email!=='undefined'){payload['email']=email;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getLogs:(userId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getLogs(userId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} let path='/users/{userId}/logs'.replace('{userId}',userId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getMemberships:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateName:(userId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateName(userId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/users/{userId}/name'.replace('{userId}',userId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePassword:(userId,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePassword(userId,password){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/users/{userId}/password'.replace('{userId}',userId);let payload={};if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhone:(userId,number)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhone(userId,number){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} let path='/users/{userId}/phone'.replace('{userId}',userId);let payload={};if(typeof number!=='undefined'){payload['number']=number;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getPrefs:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(userId,prefs)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getPrefs(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePrefs(userId,prefs){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),deleteSession:(userId,sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +deleteSession(userId,sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/users/{userId}/sessions/{sessionId}'.replace('{userId}',userId).replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateStatus:(userId,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions/{sessionId}'.replace('{userId}',userId).replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateStatus(userId,status){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof status==='undefined'){throw new AppwriteException('Missing required parameter: "status"');} let path='/users/{userId}/status'.replace('{userId}',userId);let payload={};if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updateEmailVerification:(userId,emailVerification)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updateEmailVerification(userId,emailVerification){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof emailVerification==='undefined'){throw new AppwriteException('Missing required parameter: "emailVerification"');} let path='/users/{userId}/verification'.replace('{userId}',userId);let payload={};if(typeof emailVerification!=='undefined'){payload['emailVerification']=emailVerification;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhoneVerification:(userId,phoneVerification)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhoneVerification(userId,phoneVerification){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof phoneVerification==='undefined'){throw new AppwriteException('Missing required parameter: "phoneVerification"');} let path='/users/{userId}/verification/phone'.replace('{userId}',userId);let payload={};if(typeof phoneVerification!=='undefined'){payload['phoneVerification']=phoneVerification;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};} -setEndpoint(endpoint){this.config.endpoint=endpoint;this.config.endpointRealtime=this.config.endpointRealtime||this.config.endpoint.replace('https://','wss://').replace('http://','ws://');return this;} -setEndpointRealtime(endpointRealtime){this.config.endpointRealtime=endpointRealtime;return this;} -setProject(value){this.headers['X-Appwrite-Project']=value;this.config.project=value;return this;} -setKey(value){this.headers['X-Appwrite-Key']=value;this.config.key=value;return this;} -setJWT(value){this.headers['X-Appwrite-JWT']=value;this.config.jwt=value;return this;} -setLocale(value){this.headers['X-Appwrite-Locale']=value;this.config.locale=value;return this;} -setMode(value){this.headers['X-Appwrite-Mode']=value;this.config.mode=value;return this;} -subscribe(channels,callback){let channelArray=typeof channels==='string'?[channels]:channels;channelArray.forEach(channel=>this.realtime.channels.add(channel));const counter=this.realtime.subscriptionsCounter++;this.realtime.subscriptions.set(counter,{channels:channelArray,callback});this.realtime.connect();return()=>{this.realtime.subscriptions.delete(counter);this.realtime.cleanUp(channelArray);this.realtime.connect();};} -call(method,url,headers={},params={}){var _a,_b;return __awaiter(this,void 0,void 0,function*(){method=method.toUpperCase();headers=Object.assign({},this.headers,headers);let options={method,headers,credentials:'include'};if(typeof window!=='undefined'&&window.localStorage){headers['X-Fallback-Cookies']=(_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'';} -if(method==='GET'){for(const[key,value]of Object.entries(this.flatten(params))){url.searchParams.append(key,value);}} -else{switch(headers['content-type']){case'application/json':options.body=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();for(const key in params){if(Array.isArray(params[key])){params[key].forEach((value)=>{formData.append(key+'[]',value);});} -else{formData.append(key,params[key]);}} -options.body=formData;delete headers['content-type'];break;}} -try{let data=null;const response=yield crossFetch.fetch(url.toString(),options);if((_b=response.headers.get('content-type'))===null||_b===void 0?void 0:_b.includes('application/json')){data=yield response.json();} -else{data={message:yield response.text()};} -if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data===null||data===void 0?void 0:data.type,data);} -const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);} -return data;} -catch(e){if(e instanceof AppwriteException){throw e;} -throw new AppwriteException(e.message);}});} -flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));} -else{output[finalKey]=value;}} -return output;}} -Appwrite.CHUNK_SIZE=5*1024*1024;class Query{} -Query.equal=(attribute,value)=>Query.addQuery(attribute,"equal",value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,"notEqual",value);Query.lesser=(attribute,value)=>Query.addQuery(attribute,"lesser",value);Query.lesserEqual=(attribute,value)=>Query.addQuery(attribute,"lesserEqual",value);Query.greater=(attribute,value)=>Query.addQuery(attribute,"greater",value);Query.greaterEqual=(attribute,value)=>Query.addQuery(attribute,"greaterEqual",value);Query.search=(attribute,value)=>Query.addQuery(attribute,"search",value);Query.addQuery=(attribute,oper,value)=>value instanceof Array?`${attribute}.${oper}(${value - .map((v) => Query.parseValues(v)) - .join(",")})`:`${attribute}.${oper}(${Query.parseValues(value)})`;Query.parseValues=(value)=>typeof value==="string"||value instanceof String?`"${value}"`:`${value}`;exports.Appwrite=Appwrite;exports.Query=Query;Object.defineProperty(exports,'__esModule',{value:true});}(this.window=this.window||{},null,window));(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.Chart=factory());})(this,(function(){'use strict';function fontString(pixelSize,fontStyle,fontFamily){return fontStyle+' '+pixelSize+'px '+fontFamily;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +exports.Account=Account;exports.AppwriteException=AppwriteException;exports.Avatars=Avatars;exports.Client=Client;exports.Databases=Databases;exports.Functions=Functions;exports.Health=Health;exports.Locale=Locale;exports.Projects=Projects;exports.Query=Query;exports.Storage=Storage;exports.Teams=Teams;exports.Users=Users;Object.defineProperty(exports,'__esModule',{value:true});})(this.Appwrite=this.Appwrite||{},null,window);(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.Chart=factory());})(this,(function(){'use strict';function fontString(pixelSize,fontStyle,fontFamily){return fontStyle+' '+pixelSize+'px '+fontFamily;} const requestAnimFrame=(function(){if(typeof window==='undefined'){return function(callback){return callback();};} return window.requestAnimationFrame;}());function throttled(fn,thisArg,updateFn){const updateArgs=updateFn||((args)=>Array.prototype.slice.call(args));let ticking=false;let args=[];return function(...rest){args=updateArgs(rest);if(!ticking){ticking=true;requestAnimFrame.call(window,()=>{ticking=false;fn.apply(thisArg,args);});}};} function debounce(fn,delay){let timeout;return function(...args){if(delay){clearTimeout(timeout);timeout=setTimeout(fn,delay,args);}else{fn.apply(this,args);} @@ -956,10 +1148,12 @@ gc.splice(0,gcLen);} return longest;} function _alignPixel(chart,pixel,width){const devicePixelRatio=chart.currentDevicePixelRatio;const halfWidth=width!==0?Math.max(width/2,0.5):0;return Math.round((pixel-halfWidth)*devicePixelRatio)/devicePixelRatio+halfWidth;} function clearCanvas(canvas,ctx){ctx=ctx||canvas.getContext('2d');ctx.save();ctx.resetTransform();ctx.clearRect(0,0,canvas.width,canvas.height);ctx.restore();} -function drawPoint(ctx,options,x,y){let type,xOffset,yOffset,size,cornerRadius;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}} +function drawPoint(ctx,options,x,y){drawPointLegend(ctx,options,x,y,null);} +function drawPointLegend(ctx,options,x,y,w){let type,xOffset,yOffset,size,cornerRadius,width;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}} if(isNaN(radius)||radius<=0){return;} -ctx.beginPath();switch(style){default:ctx.arc(x,y,radius,0,TAU);ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;ctx.rect(x-size,y-size,2*size,2*size);break;} -rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;} +ctx.beginPath();switch(style){default:if(w){ctx.ellipse(x,y,w/2,radius,0,0,TAU);}else{ctx.arc(x,y,radius,0,TAU);} +ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;width=w?w/2:size;ctx.rect(x-width,y-size,2*width,2*size);break;} +rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=w?w/2:Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;} ctx.fill();if(options.borderWidth>0){ctx.stroke();}} function _isPointInArea(point,area,margin){margin=margin||0.5;return!area||(point&&point.x>area.left-margin&&point.xarea.top-margin&&point.ya.filter(x=>!b.some(y=>x.plugin.id===y.plugin.id));this._notify(diff(previousDescriptors,descriptors),chart,'stop');this._notify(diff(descriptors,previousDescriptors),chart,'start');}} -function allPlugins(config){const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;iisObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}} return false;} -var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} +var version="3.8.2";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};} function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);} function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);} @@ -1643,7 +1839,7 @@ const instances={};const getChart=(key)=>{const canvas=getCanvas(key);return Obj function determineLastEvent(e,lastEvent,inChartArea,isClick){if(!inChartArea||e.type==='mouseout'){return null;} if(isClick){return lastEvent;} return e;} -class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas can be reused.');} +class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas with ID \''+existingChart.canvas.id+'\' can be reused.');} const options=config.createResolver(config.chartOptionScopes(),this.getContext());this.platform=new(config.platform||_detectPlatform(initialCanvas))();this.platform.updateConfig(config);const context=this.platform.acquireContext(initialCanvas,options.aspectRatio);const canvas=context&&context.canvas;const height=canvas&&canvas.height;const width=canvas&&canvas.width;this.id=uid();this.ctx=context;this.canvas=canvas;this.width=width;this.height=height;this._options=options;this._aspectRatio=this.aspectRatio;this._layers=[];this._metasets=[];this._stacks=undefined;this.boxes=[];this.currentDevicePixelRatio=undefined;this.chartArea=undefined;this._active=[];this._lastEvent=undefined;this._listeners={};this._responsiveListeners=undefined;this._sortedMetasets=[];this.scales={};this._plugins=new PluginService();this.$proxies={};this._hiddenIndices={};this.attached=false;this._animationsDisabled=undefined;this.$context=undefined;this._doResize=debounce(mode=>this.update(mode),options.resizeDelay||0);this._dataChanges=[];instances[this.id]=this;if(!context||!canvas){console.error("Failed to create chart: can't acquire context from the given item");return;} animator.listen(this,'complete',onAnimationsComplete);animator.listen(this,'progress',onAnimationProgress);this._initialize();if(this.attached){this.update();}} get aspectRatio(){const{options:{aspectRatio,maintainAspectRatio},width,height,_aspectRatio}=this;if(!isNullOrUndef(aspectRatio)){return aspectRatio;} @@ -1808,12 +2004,11 @@ getMaxOverflow(){return 0;} getLabelAndValue(index){const meta=this._cachedMeta;const{iScale,vScale}=meta;const parsed=this.getParsed(index);const custom=parsed._custom;const value=isFloatBar(custom)?'['+custom.start+', '+custom.end+']':''+vScale.getLabelForValue(parsed[vScale.axis]);return{label:''+iScale.getLabelForValue(parsed[iScale.axis]),value};} initialize(){this.enableOptionSharing=true;super.initialize();const meta=this._cachedMeta;meta.stack=this.getDataset().stack;} update(mode){const meta=this._cachedMeta;this.updateElements(meta.data,0,meta.data.length,mode);} -updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);for(let i=start;imeta.controller.options.grouped);const stacked=iScale.options.stacked;const stacks=[];const skipNull=(meta)=>{const parsed=meta.controller.getParsed(dataIndex);const val=parsed&&parsed[meta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){return true;}};for(const meta of metasets){if(dataIndex!==undefined&&skipNull(meta)){continue;} +if(stacked===false||stacks.indexOf(meta.stack)===-1||(stacked===undefined&&meta.stack===undefined)){stacks.push(meta.stack);} +if(meta.index===last){break;}} if(!stacks.length){stacks.push(undefined);} return stacks;} _getStackCount(index){return this._getStacks(undefined,index).length;} @@ -1842,9 +2037,8 @@ getMaxOverflow(){const data=this._cachedMeta.data;let max=0;for(let i=data.lengt return max>0&&max;} getLabelAndValue(index){const meta=this._cachedMeta;const{xScale,yScale}=meta;const parsed=this.getParsed(index);const x=xScale.getLabelForValue(parsed.x);const y=yScale.getLabelForValue(parsed.y);const r=parsed._custom;return{label:meta.label,value:'('+x+', '+y+(r?', '+r:'')+')'};} update(mode){const points=this._cachedMeta.data;this.updateElements(points,0,points.length,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i0&&!isNaN(value)){return TAU*(Math.abs(value)/total);} @@ -1886,11 +2079,10 @@ return dataLabel;}}}}};class LineController extends DatasetController{initialize update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;} line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} +updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);} if(!directUpdate){this.updateElement(point,i,properties,mode);} -prevParsed=parsed;} -this.updateSharedOptions(sharedOptions,mode,firstOpts);} +prevParsed=parsed;}} getMaxOverflow(){const meta=this._cachedMeta;const dataset=meta.dataset;const border=dataset.options&&dataset.options.borderWidth||0;const data=meta.data||[];if(!data.length){return border;} const firstPoint=data[0].size(this.resolveDataElementOptions(0));const lastPoint=data[data.length-1].size(this.resolveDataElementOptions(data.length-1));return Math.max(border,firstPoint,lastPoint)/2;} draw(){const meta=this._cachedMeta;meta.dataset.updateControlPoints(this.chart.chartArea,meta.iScale.axis);super.draw();}} @@ -2057,6 +2249,7 @@ function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);} return a?a[prop]:b?b[prop]:0;} function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);} return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;} +function _shouldApplyFill(source){return source&&source.fill!==false;} function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;} while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;} target=sources[fill];if(!target){return false;} @@ -2119,9 +2312,9 @@ var index={id:'filler',afterDatasetsUpdate(chart,_args,options){const count=(cha meta.$filler=source;sources.push(source);} for(i=0;i=0;--i){const source=metasets[i].$filler;if(!source){continue;} -source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} -const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} -_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} +source.line.updateControlPoints(area,source.axis);if(draw&&source.fill){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} +const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(_shouldApplyFill(source)){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!_shouldApplyFill(source)||options.drawTime!=='beforeDatasetDraw'){return;} +_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=labelOpts.pointStyleWidth||Math.min(boxWidth,fontSize);} return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();} setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}} @@ -2143,7 +2336,7 @@ hitbox.top=top;hitbox.left+=this.left+padding;hitbox.left=rtlHelper.leftForLtr(r isHorizontal(){return this.options.position==='top'||this.options.position==='bottom';} draw(){if(this.options.display){const ctx=this.ctx;clipArea(ctx,this);this._draw();unclipArea(ctx);}} _draw(){const{options:opts,columnSizes,lineWidths,ctx}=this;const{align,labels:labelOpts}=opts;const defaultColor=defaults.color;const rtlHelper=getRtlAdapter(opts.rtl,this.left,this.width);const labelFont=toFont(labelOpts.font);const{color:fontColor,padding}=labelOpts;const fontSize=labelFont.size;const halfFontSize=fontSize/2;let cursor;this.drawTitle();ctx.textAlign=rtlHelper.textAlign('left');ctx.textBaseline='middle';ctx.lineWidth=0.5;ctx.font=labelFont.string;const{boxWidth,boxHeight,itemHeight}=getBoxSize(labelOpts,fontSize);const drawLegendBox=function(x,y,legendItem){if(isNaN(boxWidth)||boxWidth<=0||isNaN(boxHeight)||boxHeight<0){return;} -ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxWidth*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPoint(ctx,drawOptions,centerX,centerY);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);} +ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxHeight*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPointLegend(ctx,drawOptions,centerX,centerY,boxWidth);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);} ctx.fill();if(lineWidth!==0){ctx.stroke();}} ctx.restore();};const fillText=function(x,y,legendItem){renderText(ctx,legendItem.text,x,y+(itemHeight/2),labelFont,{strikethrough:legendItem.hidden,textAlign:rtlHelper.textAlign(legendItem.textAlign)});};const isHorizontal=this.isHorizontal();const titleHeight=this._computeTitleHeight();if(isHorizontal){cursor={x:_alignStartEnd(align,this.left+padding,this.right-lineWidths[0]),y:this.top+padding+titleHeight,line:0};}else{cursor={x:this.left+padding,y:_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[0].height),line:0};} overrideTextDirection(this.ctx,opts.textDirection);const lineHeight=itemHeight+padding;this.legendItems.forEach((legendItem,i)=>{ctx.strokeStyle=legendItem.fontColor||fontColor;ctx.fillStyle=legendItem.fontColor||fontColor;const textWidth=ctx.measureText(legendItem.text).width;const textAlign=rtlHelper.textAlign(legendItem.textAlign||(legendItem.textAlign=labelOpts.textAlign));const width=boxWidth+halfFontSize+textWidth;let x=cursor.x;let y=cursor.y;rtlHelper.setWidth(this.width);if(isHorizontal){if(i>0&&x+width+padding>this.right){y=cursor.y+=lineHeight;cursor.line++;x=cursor.x=_alignStartEnd(align,this.left+padding,this.right-lineWidths[cursor.line]);}}else if(i>0&&y+lineHeight>this.bottom){x=cursor.x=x+columnSizes[cursor.line].width+padding;cursor.line++;y=cursor.y=_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[cursor.line].height);} @@ -2233,7 +2426,7 @@ if(yAlign==='top'){y1=ptY;y2=y1-caretSize;x1=x2-caretSize;x3=x2+caretSize;}else{ y3=y1;} return{x1,x2,x3,y1,y2,y3};} drawTitle(pt,ctx,options){const title=this.title;const length=title.length;let titleFont,titleSpacing,i;if(length){const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);pt.x=getAlignedX(this,options.titleAlign,options);ctx.textAlign=rtlHelper.textAlign(options.titleAlign);ctx.textBaseline='middle';titleFont=toFont(options.titleFont);titleSpacing=options.titleSpacing;ctx.fillStyle=options.titleColor;ctx.font=titleFont.string;for(i=0;iv!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}} +_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeightv!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}} ctx.fillStyle=this.labelTextColors[i];} drawBody(pt,ctx,options){const{body}=this;const{bodySpacing,bodyAlign,displayColors,boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);let bodyLineHeight=bodyFont.lineHeight;let xLinePadding=0;const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);const fillLineOfText=function(line){ctx.fillText(line,rtlHelper.x(pt.x+xLinePadding),pt.y+bodyLineHeight/2);pt.y+=bodyLineHeight+bodySpacing;};const bodyAlignForCalculation=rtlHelper.textAlign(bodyAlign);let bodyItem,textColor,lines,i,j,ilen,jlen;ctx.textAlign=bodyAlign;ctx.textBaseline='middle';ctx.font=bodyFont.string;pt.x=getAlignedX(this,bodyAlignForCalculation,options);ctx.fillStyle=options.bodyColor;each(this.beforeBody,fillLineOfText);xLinePadding=displayColors&&bodyAlignForCalculation!=='right'?bodyAlign==='center'?(boxWidth/2+boxPadding):(boxWidth+2+boxPadding):0;for(i=0,ilen=body.length;i\s]/i.test(str);} -function isLinkClose(str){return/^<\/a\s*>/i.test(str);} -var linkify=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;} +return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i\s]/i.test(str);} +function isLinkClose$1(str){return/^<\/a\s*>/i.test(str);} +var linkify$1=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;} for(j=0,l=blockTokens.length;j=0;i--){currentToken=tokens[i];if(currentToken.type==="link_close"){i--;while(tokens[i].level!==currentToken.level&&tokens[i].type!=="link_open"){i--;} continue;} -if(currentToken.type==="html_inline"){if(isLinkOpen(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;} -if(isLinkClose(currentToken.content)){htmlLinkLevel++;}} +if(currentToken.type==="html_inline"){if(isLinkOpen$1(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;} +if(isLinkClose$1(currentToken.content)){htmlLinkLevel++;}} if(htmlLinkLevel>0){continue;} -if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;for(ln=0;ln0&&links[0].index===0&&i>0&&tokens[i-1].type==="text_special"){links=links.slice(1);} +for(ln=0;lnlastPos){token=new state.Token("text","",0);token.content=text.slice(lastPos,pos);token.level=level;nodes.push(token);} token=new state.Token("link_open","a",1);token.attrs=[["href",fullUrl]];token.level=level++;token.markup="linkify";token.info="auto";nodes.push(token);token=new state.Token("text","",0);token.content=urlText;token.level=level;nodes.push(token);token=new state.Token("link_close","a",-1);token.level=--level;token.markup="linkify";token.info="auto";nodes.push(token);lastPos=links[ln].lastIndex;} if(lastPos=0;i--){token=inlineTokens[i];if(token.type==="text"&&!inside_autolink){token.content=token.content.replace(SCOPED_ABBR_RE,replaceFn);} if(token.type==="link_open"&&token.info==="auto"){inside_autolink--;} if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}} @@ -2644,7 +2838,7 @@ if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}} var replacements=function replace(state){var blkIdx;if(!state.md.options.typographer){return;} for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"){continue;} if(SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)){replace_scoped(state.tokens[blkIdx].children);} -if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.substr(0,index)+ch+str.substr(index+1);} +if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.slice(0,index)+ch+str.slice(index+1);} function process_inlines(tokens,state){var i,token,text,t,pos,max,thisLevel,item,lastChar,nextChar,isLastPunctChar,isNextPunctChar,isLastWhiteSpace,isNextWhiteSpace,canOpen,canClose,j,isSingle,stack,openQuote,closeQuote;stack=[];for(i=0;i=0;j--){if(stack[j].level<=thisLevel){break;}} stack.length=j+1;if(token.type!=="text"){continue;} text=token.content;pos=0;max=text.length;OUTER:while(pos=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"||!QUOTE_TEST_RE.test(state.tokens[blkIdx].content)){continue;} -process_inlines(state.tokens[blkIdx].children,state);}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;} +process_inlines(state.tokens[blkIdx].children,state);}};var text_join=function text_join(state){var j,l,tokens,curr,max,last,blockTokens=state.tokens;for(j=0,l=blockTokens.length;j=0){value=this.attrs[idx][1];} return value;};Token.prototype.attrJoin=function attrJoin(name,value){var idx=this.attrIndex(name);if(idx<0){this.attrPush([name,value]);}else{this.attrs[idx][1]=this.attrs[idx][1]+" "+value;}};var token=Token;function StateCore(src,md,env){this.src=src;this.env=env;this.tokens=[];this.inlineMode=false;this.md=md;} -StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify],["replacements",replacements],["smartquotes",smartquotes]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}} -Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i0)return false;pos=state.pos;max=state.posMax;if(pos+3>max)return false;if(state.src.charCodeAt(pos)!==58)return false;if(state.src.charCodeAt(pos+1)!==47)return false;if(state.src.charCodeAt(pos+2)!==47)return false;match=state.pending.match(SCHEME_RE);if(!match)return false;proto=match[1];link=state.md.linkify.matchAtStart(state.src.slice(pos-proto.length));if(!link)return false;url=link.url;url=url.replace(/\*+$/,"");fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl))return false;if(!silent){state.pending=state.pending.slice(0,-proto.length);token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="linkify";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="linkify";token.info="auto";} +state.pos+=url.length-proto.length;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;} pmax=state.pending.length-1;max=state.posMax;if(!silent){if(pmax>=0&&state.pending.charCodeAt(pmax)===32){if(pmax>=1&&state.pending.charCodeAt(pmax-1)===32){ws=pmax-1;while(ws>=1&&state.pending.charCodeAt(ws-1)===32)ws--;state.pending=state.pending.slice(0,ws);state.push("hardbreak","br",0);}else{state.pending=state.pending.slice(0,-1);state.push("softbreak","br",0);}}else{state.push("softbreak","br",0);}} pos++;while(pos?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92){return false;} -pos++;if(pos?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch1,ch2,origStr,escapedStr,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92)return false;pos++;if(pos>=max)return false;ch1=state.src.charCodeAt(pos);if(ch1===10){if(!silent){state.push("hardbreak","br",0);} +pos++;while(pos=55296&&ch1<=56319&&pos+1=56320&&ch2<=57343){escapedStr+=state.src[pos+1];pos++;}} +origStr="\\"+escapedStr;if(!silent){token=state.push("text_special","",0);if(ch1<256&&ESCAPED[ch1]!==0){token.content=escapedStr;}else{token.content=origStr;} +token.markup=origStr;token.info="escape";} +state.pos=pos+1;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;} start=pos;pos++;max=state.posMax;while(pos=97&&lc<=122;} +return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLinkOpen(str){return/^\s]/i.test(str);} +function isLinkClose(str){return/^<\/a\s*>/i.test(str);} +function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;} var html_inline=function html_inline(state,silent){var ch,match,max,token,pos=state.pos;if(!state.md.options.html){return false;} max=state.posMax;if(state.src.charCodeAt(pos)!==60||pos+2>=max){return false;} ch=state.src.charCodeAt(pos+1);if(ch!==33&&ch!==63&&ch!==47&&!isLetter(ch)){return false;} match=state.src.slice(pos).match(HTML_TAG_RE);if(!match){return false;} -if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);} -state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38){return false;} -if(pos+1=max)return false;ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);token=state.push("text_special","",0);token.content=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);token.markup=match[0];token.info="entity";} +state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){token=state.push("text_special","",0);token.content=entities[match[1]];token.markup=match[0];token.info="entity";} +state.pos+=match[0].length;return true;}}} +return false;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdxminOpenerIdx;openerIdx-=jumps[openerIdx]+1){opener=delimiters[openerIdx];if(opener.marker!==closer.marker)continue;if(opener.open&&opener.end<0){isOddMatch=false;if(opener.close||closer.open){if((opener.length+closer.length)%3===0){if(opener.length%3!==0||closer.length%3!==0){isOddMatch=true;}}} if(!isOddMatch){lastJump=openerIdx>0&&!delimiters[openerIdx-1].open?jumps[openerIdx-1]+1:0;jumps[closerIdx]=closerIdx-openerIdx+lastJump;jumps[openerIdx]=lastJump;closer.open=false;opener.end=closerIdx;opener.close=false;newMinOpenerIdx=-1;lastTokenIdx=-2;break;}}} if(newMinOpenerIdx!==-1){openersBottom[closer.marker][(closer.open?3:0)+(closer.length||0)%3]=newMinOpenerIdx;}}} -var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr0)level++;if(tokens[curr].type==="text"&&curr+10)level++;if(tokens[curr].type==="text"&&curr+10){this.level++;this._prev_delimiters.push(this.delimiters);this.delimiters=[];token_meta={delimiters:this.delimiters};} @@ -2957,7 +3153,7 @@ this.pendingLevel=this.level;this.tokens.push(token$1);this.tokens_meta.push(tok count=pos-start;nextChar=pos=end){break;} continue;} state.pending+=state.src[state.pos++];} -if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;} +if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;} Object.keys(source).forEach((function(key){obj[key]=source[key];}));}));return obj;} function _class(obj){return Object.prototype.toString.call(obj);} function isString(obj){return _class(obj)==="[object String]";} @@ -2996,7 +3192,7 @@ if(isFunction(val.normalize)){compiled.normalize=val.normalize;}else if(!val.nor return;} if(isString(val)){aliases.push(name);return;} schemaError(name,val);}));aliases.forEach((function(alias){if(!self.__compiled__[self.__schemas__[alias]]){return;} -self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);} +self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.schema_at_start=RegExp("^"+self.re.schema_search.source,"i");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);} function Match(self,shift){var start=self.__index__,end=self.__last_index__,text=self.__text_cache__.slice(start,end);this.schema=self.__schema__.toLowerCase();this.index=start+shift;this.lastIndex=end+shift;this.raw=text;this.text=text;this.url=text;} function createMatch(self,shift){var match=new Match(self,shift);self.__compiled__[match.schema].normalize(match,self);return match;} function LinkifyIt(schemas,options){if(!(this instanceof LinkifyIt)){return new LinkifyIt(schemas,options);} @@ -3010,7 +3206,7 @@ return this.__index__>=0;};LinkifyIt.prototype.pretest=function pretest(text){re return this.__compiled__[schema.toLowerCase()].validate(text,pos,this);};LinkifyIt.prototype.match=function match(text){var shift=0,result=[];if(this.__index__>=0&&this.__text_cache__===text){result.push(createMatch(this,shift));shift=this.__last_index__;} var tail=shift?text.slice(shift):text;while(this.test(tail)){result.push(createMatch(this,shift));tail=tail.slice(this.__last_index__);shift+=this.__last_index__;} if(result.length){return result;} -return null;};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;} +return null;};LinkifyIt.prototype.matchAtStart=function matchAtStart(text){this.__text_cache__=text;this.__index__=-1;if(!text.length)return null;var m=this.re.schema_at_start.exec(text);if(!m)return null;var len=this.testSchemaAt(text,m[2],m[0].length);if(!len)return null;this.__schema__=m[2];this.__index__=m.index+m[1].length;this.__last_index__=m.index+m[0].length+len;return createMatch(this,0);};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;} this.__tlds__=this.__tlds__.concat(list).sort().filter((function(el,idx,arr){return el!==arr[idx-1];})).reverse();compile(this);return this;};LinkifyIt.prototype.normalize=function normalize(match){if(!match.schema){match.url="http://"+match.url;} if(match.schema==="mailto:"&&!/^mailto:/i.test(match.url)){match.url="mailto:"+match.url;}};LinkifyIt.prototype.onCompile=function onCompile(){};var linkifyIt=LinkifyIt;var maxInt=2147483647;var base=36;var tMin=1;var tMax=26;var skew=38;var damp=700;var initialBias=72;var initialN=128;var delimiter="-";var regexPunycode=/^xn--/;var regexNonASCII=/[^\x20-\x7E]/;var regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g;var errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var baseMinusTMin=base-tMin;var floor=Math.floor;var stringFromCharCode=String.fromCharCode;function error(type){throw new RangeError(errors[type]);} function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);} @@ -3051,7 +3247,7 @@ output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCou return output.join("");} function toUnicode(input){return mapDomain(input,(function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;}));} function toASCII(input){return mapDomain(input,(function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string;}));} -var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;} +var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;} var RECODE_HOSTNAME_FOR=["http:","https:","mailto:"];function normalizeLink(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toASCII(parsed.hostname);}catch(er){}}} return mdurl.encode(mdurl.format(parsed));} function normalizeLinkText(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toUnicode(parsed.hostname);}catch(er){}}} @@ -3641,7 +3837,7 @@ function handler2(){} handler2.inline=(el,{expression},{cleanup:cleanup2})=>{let root=closestRoot(el);if(!root._x_refs) root._x_refs={};root._x_refs[expression]=el;cleanup2(()=>delete root._x_refs[expression]);};directive("ref",handler2);directive("if",(el,{expression},{effect:effect3,cleanup:cleanup2})=>{let evaluate2=evaluateLater(el,expression);let show=()=>{if(el._x_currentIfEl) return el._x_currentIfEl;let clone2=el.content.cloneNode(true).firstElementChild;addScopeToNode(clone2,{},el);mutateDom(()=>{el.after(clone2);initTree(clone2);});el._x_currentIfEl=clone2;el._x_undoIf=()=>{clone2.remove();delete el._x_currentIfEl;};return clone2;};let hide=()=>{if(!el._x_undoIf) -return;el._x_undoIf();delete el._x_undoIf;};effect3(()=>evaluate2((value)=>{value?show():hide();}));cleanup2(()=>el._x_undoIf&&el._x_undoIf());});mapAttributes(startingWith("@",into(prefix("on:"))));directive("on",skipDuringClone((el,{value,modifiers,expression},{cleanup:cleanup2})=>{let evaluate2=expression?evaluateLater(el,expression):()=>{};let removeListener=on(el,value,modifiers,(e)=>{evaluate2(()=>{},{scope:{$event:e},params:[e]});});cleanup2(()=>removeListener());}));alpine_default.setEvaluator(normalEvaluator);alpine_default.setReactivityEngine({reactive:reactive2,effect:effect2,release:stop,raw:toRaw});var src_default=alpine_default;window.Alpine=src_default;queueMicrotask(()=>{src_default.start();});})();window.ls.error=function(){return function(error){window.console.error(error);if(window.location.pathname!=='/console'){window.location='/console';}};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});document.addEventListener("account.create",function(){let container=window.ls.container;let form=container.get('serviceForm');let sdk=container.get('console');let promise=sdk.account.createEmailSession(form.email,form.password);container.set("serviceForm",{},true,true);promise.then(function(){var subscribe=document.getElementById('newsletter').checked;if(subscribe){let alerts=container.get('alerts');let loaderId=alerts.add({text:'Loading...',class:""},0);fetch('https://appwrite.io/v1/newsletter/subscribe',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:form.name,email:form.email,}),}).finally(function(){alerts.remove(loaderId);window.location='/console';});}else{window.location='/console';}},function(error){window.location='/auth/signup?failure=1';});});window.addEventListener("load",async()=>{const bars=12;const realtime=window.ls.container.get('realtime');const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));let current={};window.ls.container.get('console').subscribe(['project','console'],response=>{if(response.events.includes('stats.connections')){for(let project in response.payload){current[project]=response.payload[project]??0;} +return;el._x_undoIf();delete el._x_undoIf;};effect3(()=>evaluate2((value)=>{value?show():hide();}));cleanup2(()=>el._x_undoIf&&el._x_undoIf());});mapAttributes(startingWith("@",into(prefix("on:"))));directive("on",skipDuringClone((el,{value,modifiers,expression},{cleanup:cleanup2})=>{let evaluate2=expression?evaluateLater(el,expression):()=>{};let removeListener=on(el,value,modifiers,(e)=>{evaluate2(()=>{},{scope:{$event:e},params:[e]});});cleanup2(()=>removeListener());}));alpine_default.setEvaluator(normalEvaluator);alpine_default.setReactivityEngine({reactive:reactive2,effect:effect2,release:stop,raw:toRaw});var src_default=alpine_default;window.Alpine=src_default;queueMicrotask(()=>{src_default.start();});})();window.ls.error=function(){return function(error){window.console.error(error);if(window.location.pathname!=='/console'){window.location='/console';}};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});document.addEventListener("account.create",function(){let container=window.ls.container;let form=container.get('serviceForm');let sdk=container.get('console');let promise=sdk.account.createEmailSession(form.email,form.password);container.set("serviceForm",{},true,true);promise.then(function(){var subscribe=document.getElementById('newsletter').checked;if(subscribe){let alerts=container.get('alerts');let loaderId=alerts.add({text:'Loading...',class:""},0);fetch('https://appwrite.io/v1/newsletter/subscribe',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:form.name,email:form.email,}),}).finally(function(){alerts.remove(loaderId);window.location='/console';});}else{window.location='/console';}},function(error){window.location='/auth/signup?failure=1';});});window.addEventListener("load",async()=>{const bars=12;const realtime=window.ls.container.get('realtime');const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));let current={};window.ls.container.get('console').client.subscribe(['project','console'],response=>{if(response.events.includes('stats.connections')){for(let project in response.payload){current[project]=response.payload[project]??0;} return;} if(response.events.includes('databases.*.collections.*.attributes.*')){document.dispatchEvent(new CustomEvent('databases.createAttribute'));return;} if(response.events.includes('databases.*.collections.*.indexes.*')){document.dispatchEvent(new CustomEvent('databases.createIndex'));return;} @@ -3669,7 +3865,7 @@ params=formData;break;} return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){request.setRequestHeader(key,headers[key]);}} request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type');contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;} resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);} -request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f +request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var client=new Appwrite.Client();var endpoint=window.location.origin+'/v1';client.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return{client:client,account:new Appwrite.Account(client),avatars:new Appwrite.Avatars(client),databases:new Appwrite.Databases(client),functions:new Appwrite.Functions(client),health:new Appwrite.Health(client),locale:new Appwrite.Locale(client),projects:new Appwrite.Projects(client),storage:new Appwrite.Storage(client),teams:new Appwrite.Teams(client),users:new Appwrite.Users(client)}},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f var txtWords=['Sun','Mon','Tues','Wednes','Thurs','Fri','Satur','January','February','March','April','May','June','July','August','September','October','November','December'] var formatChr=/\\?(.?)/gi var formatChrCb=function(t,s){return f[t]?f[t]():s} @@ -3799,7 +3995,7 @@ return slf.renderToken(tokens,idx,opts);} md.renderer.rules.strong_open=renderEm;md.renderer.rules.strong_close=renderEm;return md;},true);})(window);(function(window){"use strict";window.ls.container.set('rtl',function(){var rtlStock="^ا^ب^ت^ث^ج^ح^خ^د^ذ^ر^ز^س^ش^ص^ض^ط^ظ^ع^غ^ف^ق^ك^ل^م^ن^ه^و^ي^א^ב^ג^ד^ה^ו^ז^ח^ט^י^כ^ך^ל^מ^ם^נ^ן^ס^ע^פ^ף^צ^ץ^ק^ר^ש^ת^";var special=["\n"," "," ","״",'"',"_","'","!","@","#","$","^","&","%","*","(",")","+","=","-","[","]","\\","/","{","}","|",":","<",">","?",",",".","0","1","2","3","4","5","6","7","8","9"];var isRTL=function(value){for(var i=0;i{return{current:null,history:null,setCurrent:function(currentConnections){var scope=this;scope.current=currentConnections;return scope.current;},setHistory:function(history){var scope=this;scope.history=history;return scope.history;}};},true,true);})(window);window.ls.router.add("/auth/signin",{template:"/auth/signin?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/signup",{template:"/auth/signup?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery",{template:"/auth/recovery?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery/reset",{template:"/auth/recovery/reset?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/confirm",{template:"/auth/confirm?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/join",{template:"/auth/join?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/magic-url",{template:"/auth/magic-url?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/success",{template:"/auth/oauth2/success?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/failure",{template:"/auth/oauth2/failure?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/console",{template:"/console?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account/:tab",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/home",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/home/:tab",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/platforms/:platform",{template:function(window){return window.location.pathname+"?version="+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/notifications",{template:"/console/notifications?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/settings",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/settings/:tab",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks",{template:"/console/webhooks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks/webhook",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/webhooks/webhook/new",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/keys",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/keys/:tab",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks/:tab",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases",{template:"/console/databases?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases/database",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/database/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage",{template:"/console/storage?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/storage/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/users",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user/:tab",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team/:tab",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/:tab",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function/:tab",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/:tab",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true});window.ls.filter.add("avatar",function($value,element){if(!$value){return"";} +return false;};return{isRTL:isRTL,};},true);})(window);(function(window){"use strict";window.ls.container.set('sdk',function(window,router){var client=new Appwrite.Client();var endpoint=window.location.origin+'/v1';client.setEndpoint(endpoint).setProject(router.params.project||'').setLocale(APP_ENV.LOCALE).setMode('admin');return{client:client,account:new Appwrite.Account(client),avatars:new Appwrite.Avatars(client),databases:new Appwrite.Databases(client),functions:new Appwrite.Functions(client),health:new Appwrite.Health(client),locale:new Appwrite.Locale(client),storage:new Appwrite.Storage(client),teams:new Appwrite.Teams(client),users:new Appwrite.Users(client)}},false);})(window);(function(window){"use strict";window.ls.container.set('search',function(window){return{params:{},path:'',pointer:'',selected:'',};},true,true);})(window);(function(window){"use strict";window.ls.container.set('timezone',function(){return{convert:function(unixTime){var timezoneMinutes=new Date().getTimezoneOffset();timezoneMinutes=(timezoneMinutes===0)?0:-timezoneMinutes;return parseInt(unixTime)+(timezoneMinutes*60);}};},true);})(window);(function(window){"use strict";window.ls.container.set('realtime',()=>{return{current:null,history:null,setCurrent:function(currentConnections){var scope=this;scope.current=currentConnections;return scope.current;},setHistory:function(history){var scope=this;scope.history=history;return scope.history;}};},true,true);})(window);window.ls.router.add("/auth/signin",{template:"/auth/signin?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/signup",{template:"/auth/signup?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery",{template:"/auth/recovery?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery/reset",{template:"/auth/recovery/reset?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/confirm",{template:"/auth/confirm?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/join",{template:"/auth/join?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/magic-url",{template:"/auth/magic-url?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/success",{template:"/auth/oauth2/success?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/failure",{template:"/auth/oauth2/failure?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/console",{template:"/console?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account/:tab",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/home",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/home/:tab",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/platforms/:platform",{template:function(window){return window.location.pathname+"?version="+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/notifications",{template:"/console/notifications?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/settings",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/settings/:tab",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks",{template:"/console/webhooks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks/webhook",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/webhooks/webhook/new",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/keys",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/keys/:tab",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks/:tab",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases",{template:"/console/databases?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases/database",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/database/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage",{template:"/console/storage?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/storage/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/users",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user/:tab",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team/:tab",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/:tab",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function/:tab",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/:tab",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true});window.ls.filter.add("avatar",function($value,element){if(!$value){return"";} let size=element.dataset["size"]||80;let name=$value.name||$value||"";name=(typeof name!=='string')?'--':name;return def="/v1/avatars/initials?project=console"+"&name="+ encodeURIComponent(name)+"&width="+ size+"&height="+ @@ -3862,14 +4058,15 @@ return url;}}else{if(typeof value!=="undefined"&&value!==null){var separator=url return url;}else{return url;}}};keys=keys.split(",").map(element=>element.trim());return function(serviceForm,router,window){let url=window.location.href;keys.map(node=>{node=node.split("=");let key=node[0]||"";let name=node[1]||key;let value=getValue(key,"param",serviceForm);url=updateQueryString(name,value?value:null,url);});if(url!==window.location.href){window.history.pushState({},"",url);router.reset();}};},trigger:function(events){return function(document){events=events.trim().split(",");for(let i=0;i)|{)/m;const REGEX_PARAMETERS_VALUES=/\s*([\w\\$]+)\s*(?:=\s*((?:(?:(['"])(?:\3|(?:.*?[^\\]\3)))((\s*\+\s*)(?:(?:(['"])(?:\6|(?:.*?[^\\]\6)))|(?:[\w$]*)))*)|.*?))?\s*(?:,|$)/gm;let functionAsString=func.toString();let params=[];let match;functionAsString=functionAsString.replaceAll('={}',"");functionAsString=functionAsString.replaceAll('=[]',"");functionAsString=functionAsString.replace(REGEX_COMMENTS,"");functionAsString=functionAsString.match(REGEX_FUNCTION_PARAMS)[1];if(functionAsString.charAt(0)==="("){functionAsString=functionAsString.slice(1,-1);} +if(element.array){document[element.key]=[];}}}}}};let getParams=function getParams(func){const REGEX_COMMENTS=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;const REGEX_FUNCTION_PARAMS=/(?:\s*(?:function\s*[^(]*)?\s*)((?:[^'"]|(?:(?:(['"])(?:(?:.*?[^\\]\2)|\2))))*?)\s*(?=(?:=>)|{)/m;const REGEX_PARAMETERS_VALUES=/\s*([\w\\$]+)\s*(?:=\s*((?:(?:(['"])(?:\3|(?:.*?[^\\]\3)))((\s*\+\s*)(?:(?:(['"])(?:\6|(?:.*?[^\\]\6)))|(?:[\w$]*)))*)|.*?))?\s*(?:,|$)/gm;let functionAsString=func.toString();let params=[];let match;let indexOfArguments=functionAsString.indexOf('(');if(indexOfArguments!==-1){functionAsString=functionAsString.slice(indexOfArguments,-1);} +functionAsString=functionAsString.replaceAll('={}',"");functionAsString=functionAsString.replaceAll('=[]',"");functionAsString=functionAsString.replace(REGEX_COMMENTS,"");functionAsString=functionAsString.match(REGEX_FUNCTION_PARAMS)[1];if(functionAsString.charAt(0)==="("){functionAsString=functionAsString.slice(1,-1);} while((match=REGEX_PARAMETERS_VALUES.exec(functionAsString))){params.push(match[1]);} return params;};let getValue=function(key,prefix,data){let result=null;if(!key){return null;} let attrKey=prefix+key.charAt(0).toUpperCase()+key.slice(1);if(element.dataset[attrKey]){result=expression.parse(element.dataset[attrKey]);if(element.dataset[attrKey+"CastTo"]==="array"){result=result.split(",");}} if(typeof data[key]!=='undefined'){result=data[key];} if(typeof result==='undefined'){result="";} return result;};let resolve=function(target,prefix="param",data={}){if(!target){return function(){};} -let args=getParams(target);return target.apply(target,args.map(function(value){let result=getValue(value,prefix,data);return result??undefined;}));};let exec=function(event){let parsedSuccess=expression.parse(success);let parsedFailure=expression.parse(failure);let parsedAction=expression.parse(action);parsedSuccess=parsedSuccess&&parsedSuccess!=""?parsedSuccess.split(",").map(element=>element.trim()):[];parsedFailure=parsedFailure&&parsedFailure!=""?parsedFailure.split(",").map(element=>element.trim()):[];element.$lsSkip=true;element.classList.add("load-service-start");if(!document.body.contains(element)){element=undefined;return false;} +let args=getParams(target);return target.apply(container.get(scope),args.map(function(value){let result=getValue(value,prefix,data);return result??undefined;}));};let exec=function(event){let parsedSuccess=expression.parse(success);let parsedFailure=expression.parse(failure);let parsedAction=expression.parse(action);parsedSuccess=parsedSuccess&&parsedSuccess!=""?parsedSuccess.split(",").map(element=>element.trim()):[];parsedFailure=parsedFailure&&parsedFailure!=""?parsedFailure.split(",").map(element=>element.trim()):[];element.$lsSkip=true;element.classList.add("load-service-start");if(!document.body.contains(element)){element=undefined;return false;} if(event){event.preventDefault();} if(running){return false;} running=true;element.style.backgroud='red';if(confirm){if(window.confirm(confirm)!==true){element.classList.add("load-service-end");element.$lsSkip=false;running=false;return false;}} diff --git a/public/dist/scripts/app-dep.js b/public/dist/scripts/app-dep.js index 760c41b37..843664e35 100644 --- a/public/dist/scripts/app-dep.js +++ b/public/dist/scripts/app-dep.js @@ -4,43 +4,83 @@ return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){tr function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}} function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);} step((generator=generator.apply(thisArg,_arguments||[])).next());});} -class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}} -class Appwrite{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:5.0.0','X-Appwrite-Response-Format':'0.15.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1) +class Service{constructor(client){this.client=client;} +static flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));} +else{output[finalKey]=value;}} +return output;}} +Service.CHUNK_SIZE=5*1024*1024;class Query{} +Query.equal=(attribute,value)=>Query.addQuery(attribute,'equal',value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,'notEqual',value);Query.lesser=(attribute,value)=>Query.addQuery(attribute,'lesser',value);Query.lesserEqual=(attribute,value)=>Query.addQuery(attribute,'lesserEqual',value);Query.greater=(attribute,value)=>Query.addQuery(attribute,'greater',value);Query.greaterEqual=(attribute,value)=>Query.addQuery(attribute,'greaterEqual',value);Query.search=(attribute,value)=>Query.addQuery(attribute,'search',value);Query.addQuery=(attribute,oper,value)=>value instanceof Array?`${attribute}.${oper}(${value + .map((v) => Query.parseValues(v)) + .join(',')})`:`${attribute}.${oper}(${Query.parseValues(value)})`;Query.parseValues=(value)=>typeof value==='string'||value instanceof String?`"${value}"`:`${value}`;class AppwriteException extends Error{constructor(message,code=0,type='',response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.type=type;this.response=response;}} +class Client{constructor(){this.config={endpoint:'https://HOSTNAME/v1',endpointRealtime:'',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:6.0.0','X-Appwrite-Response-Format':'0.15.0',};this.realtime={socket:undefined,timeout:undefined,url:'',channels:new Set(),subscriptions:new Map(),subscriptionsCounter:0,reconnect:true,reconnectAttempts:0,lastMessage:undefined,connect:()=>{clearTimeout(this.realtime.timeout);this.realtime.timeout=window===null||window===void 0?void 0:window.setTimeout(()=>{this.realtime.createSocket();},50);},getTimeout:()=>{switch(true){case this.realtime.reconnectAttempts<5:return 1000;case this.realtime.reconnectAttempts<15:return 5000;case this.realtime.reconnectAttempts<100:return 10000;default:return 60000;}},createSocket:()=>{var _a,_b;if(this.realtime.channels.size<1) return;const channels=new URLSearchParams();channels.set('project',this.config.project);this.realtime.channels.forEach(channel=>{channels.append('channels[]',channel);});const url=this.config.endpointRealtime+'/realtime?'+channels.toString();if(url!==this.realtime.url||!this.realtime.socket||((_a=this.realtime.socket)===null||_a===void 0?void 0:_a.readyState)>WebSocket.OPEN){if(this.realtime.socket&&((_b=this.realtime.socket)===null||_b===void 0?void 0:_b.readyState){this.realtime.reconnectAttempts=0;});this.realtime.socket.addEventListener('close',event=>{var _a,_b,_c;if(!this.realtime.reconnect||(((_b=(_a=this.realtime)===null||_a===void 0?void 0:_a.lastMessage)===null||_b===void 0?void 0:_b.type)==='error'&&((_c=this.realtime)===null||_c===void 0?void 0:_c.lastMessage.data).code===1008)){this.realtime.reconnect=true;return;} const timeout=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`,event.reason);setTimeout(()=>{this.realtime.reconnectAttempts++;this.realtime.createSocket();},timeout);});}},onMessage:(event)=>{var _a,_b;try{const message=JSON.parse(event.data);this.realtime.lastMessage=message;switch(message.type){case'connected':const cookie=JSON.parse((_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'{}');const session=cookie===null||cookie===void 0?void 0:cookie[`a_session_${this.config.project}`];const messageData=message.data;if(session&&!messageData.user){(_b=this.realtime.socket)===null||_b===void 0?void 0:_b.send(JSON.stringify({type:'authentication',data:{session}}));} break;case'event':let data=message.data;if(data===null||data===void 0?void 0:data.channels){const isSubscribed=data.channels.some(channel=>this.realtime.channels.has(channel));if(!isSubscribed) return;this.realtime.subscriptions.forEach(subscription=>{if(data.channels.some(channel=>subscription.channels.includes(channel))){setTimeout(()=>subscription.callback(data));}});} break;case'error':throw message.data;default:break;}} -catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +catch(e){console.error(e);}},cleanUp:channels=>{this.realtime.channels.forEach(channel=>{if(channels.includes(channel)){let found=Array.from(this.realtime.subscriptions).some(([_key,subscription])=>{return subscription.channels.includes(channel);});if(!found){this.realtime.channels.delete(channel);}}});}};} +setEndpoint(endpoint){this.config.endpoint=endpoint;this.config.endpointRealtime=this.config.endpointRealtime||this.config.endpoint.replace('https://','wss://').replace('http://','ws://');return this;} +setEndpointRealtime(endpointRealtime){this.config.endpointRealtime=endpointRealtime;return this;} +setProject(value){this.headers['X-Appwrite-Project']=value;this.config.project=value;return this;} +setKey(value){this.headers['X-Appwrite-Key']=value;this.config.key=value;return this;} +setJWT(value){this.headers['X-Appwrite-JWT']=value;this.config.jwt=value;return this;} +setLocale(value){this.headers['X-Appwrite-Locale']=value;this.config.locale=value;return this;} +setMode(value){this.headers['X-Appwrite-Mode']=value;this.config.mode=value;return this;} +subscribe(channels,callback){let channelArray=typeof channels==='string'?[channels]:channels;channelArray.forEach(channel=>this.realtime.channels.add(channel));const counter=this.realtime.subscriptionsCounter++;this.realtime.subscriptions.set(counter,{channels:channelArray,callback});this.realtime.connect();return()=>{this.realtime.subscriptions.delete(counter);this.realtime.cleanUp(channelArray);this.realtime.connect();};} +call(method,url,headers={},params={}){var _a,_b;return __awaiter(this,void 0,void 0,function*(){method=method.toUpperCase();headers=Object.assign({},this.headers,headers);let options={method,headers,credentials:'include'};if(typeof window!=='undefined'&&window.localStorage){headers['X-Fallback-Cookies']=(_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'';} +if(method==='GET'){for(const[key,value]of Object.entries(Service.flatten(params))){url.searchParams.append(key,value);}} +else{switch(headers['content-type']){case'application/json':options.body=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();for(const key in params){if(Array.isArray(params[key])){params[key].forEach((value)=>{formData.append(key+'[]',value);});} +else{formData.append(key,params[key]);}} +options.body=formData;delete headers['content-type'];break;}} +try{let data=null;const response=yield crossFetch.fetch(url.toString(),options);if((_b=response.headers.get('content-type'))===null||_b===void 0?void 0:_b.includes('application/json')){data=yield response.json();} +else{data={message:yield response.text()};} +if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data===null||data===void 0?void 0:data.type,data);} +const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);} +return data;} +catch(e){if(e instanceof AppwriteException){throw e;} +throw new AppwriteException(e.message);}});}} +class Account extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(userId,email,password,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateEmail:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateEmail(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/email';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createJWT:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getLogs:(limit,offset)=>__awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createJWT(){return __awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getLogs(limit,offset){return __awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateName:(name)=>__awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateName(name){return __awaiter(this,void 0,void 0,function*(){if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/account/name';let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePassword:(password,oldPassword)=>__awaiter(this,void 0,void 0,function*(){if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePassword(password,oldPassword){return __awaiter(this,void 0,void 0,function*(){if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/password';let payload={};if(typeof password!=='undefined'){payload['password']=password;} if(typeof oldPassword!=='undefined'){payload['oldPassword']=oldPassword;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhone:(number,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhone(number,password){return __awaiter(this,void 0,void 0,function*(){if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/phone';let payload={};if(typeof number!=='undefined'){payload['number']=number;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getPrefs:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/prefs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(prefs)=>__awaiter(this,void 0,void 0,function*(){if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getPrefs(){return __awaiter(this,void 0,void 0,function*(){let path='/account/prefs';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePrefs(prefs){return __awaiter(this,void 0,void 0,function*(){if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} let path='/account/prefs';let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createRecovery:(email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createRecovery(email,url){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/account/recovery';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateRecovery:(userId,secret,password,passwordAgain)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateRecovery(userId,secret,password,passwordAgain){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} if(typeof passwordAgain==='undefined'){throw new AppwriteException('Missing required parameter: "passwordAgain"');} @@ -48,105 +88,139 @@ let path='/account/recovery';let payload={};if(typeof userId!=='undefined'){payl if(typeof secret!=='undefined'){payload['secret']=secret;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof passwordAgain!=='undefined'){payload['passwordAgain']=passwordAgain;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),getSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailSession:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +getSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteSessions(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +createAnonymousSession(){return __awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEmailSession(email,password){return __awaiter(this,void 0,void 0,function*(){if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/account/sessions/email';let payload={};if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createMagicURLSession:(userId,email,url)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createMagicURLSession(userId,email,url){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateMagicURLSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateMagicURLSession(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/sessions/magic-url';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createOAuth2Session:(provider,success,failure,scopes)=>{if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +createOAuth2Session(provider,success,failure,scopes){if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} let path='/account/sessions/oauth2/{provider}'.replace('{provider}',provider);let payload={};if(typeof success!=='undefined'){payload['success']=success;} if(typeof failure!=='undefined'){payload['failure']=failure;} if(typeof scopes!=='undefined'){payload['scopes']=scopes;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} if(typeof window!=='undefined'&&(window===null||window===void 0?void 0:window.location)){window.location.href=uri.toString();} -else{return uri;}},createPhoneSession:(userId,number)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +else{return uri;}} +createPhoneSession(userId,number){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} let path='/account/sessions/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof number!=='undefined'){payload['number']=number;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updatePhoneSession:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updatePhoneSession(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/sessions/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),getSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateStatus:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/status';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createVerification:(url)=>__awaiter(this,void 0,void 0,function*(){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +getSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteSession(sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} +let path='/account/sessions/{sessionId}'.replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateStatus(){return __awaiter(this,void 0,void 0,function*(){let path='/account/status';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +createVerification(url){return __awaiter(this,void 0,void 0,function*(){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/account/verification';let payload={};if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateVerification:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updateVerification(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/verification';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),createPhoneVerification:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/verification/phone';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updatePhoneVerification:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +createPhoneVerification(){return __awaiter(this,void 0,void 0,function*(){let path='/account/verification/phone';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +updatePhoneVerification(userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/account/verification/phone';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);})};this.avatars={getBrowser:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});}} +class Avatars extends Service{constructor(client){super(client);} +getBrowser(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/browsers/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getCreditCard:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getCreditCard(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/credit-cards/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFavicon:(url)=>{if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFavicon(url){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/avatars/favicon';let payload={};if(typeof url!=='undefined'){payload['url']=url;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFlag:(code,width,height,quality)=>{if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFlag(code,width,height,quality){if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} let path='/avatars/flags/{code}'.replace('{code}',code);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof quality!=='undefined'){payload['quality']=quality;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getImage:(url,width,height)=>{if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getImage(url,width,height){if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} let path='/avatars/image';let payload={};if(typeof url!=='undefined'){payload['url']=url;} if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getInitials:(name,width,height,color,background)=>{let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getInitials(name,width,height,color,background){let path='/avatars/initials';let payload={};if(typeof name!=='undefined'){payload['name']=name;} if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} if(typeof color!=='undefined'){payload['color']=color;} if(typeof background!=='undefined'){payload['background']=background;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getQR:(text,size,margin,download)=>{if(typeof text==='undefined'){throw new AppwriteException('Missing required parameter: "text"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getQR(text,size,margin,download){if(typeof text==='undefined'){throw new AppwriteException('Missing required parameter: "text"');} let path='/avatars/qr';let payload={};if(typeof text!=='undefined'){payload['text']=text;} if(typeof size!=='undefined'){payload['size']=size;} if(typeof margin!=='undefined'){payload['margin']=margin;} if(typeof download!=='undefined'){payload['download']=download;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;}};this.databases={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/databases';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;}} +class Databases extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/databases';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(databaseId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(databaseId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/databases';let payload={};if(typeof databaseId!=='undefined'){payload['databaseId']=databaseId;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getUsage:(range)=>__awaiter(this,void 0,void 0,function*(){let path='/databases/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(databaseId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} -let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(databaseId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/databases/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(databaseId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(databaseId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(databaseId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} -let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listCollections:(databaseId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(databaseId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}'.replace('{databaseId}',databaseId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listCollections(databaseId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/collections'.replace('{databaseId}',databaseId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createCollection:(databaseId,collectionId,name,permission,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createCollection(databaseId,collectionId,name,permission,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} @@ -157,9 +231,11 @@ if(typeof name!=='undefined'){payload['name']=name;} if(typeof permission!=='undefined'){payload['permission']=permission;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getCollection:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateCollection:(databaseId,collectionId,name,permission,read,write,enabled)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateCollection(databaseId,collectionId,name,permission,read,write,enabled){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} @@ -168,11 +244,14 @@ if(typeof permission!=='undefined'){payload['permission']=permission;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} if(typeof enabled!=='undefined'){payload['enabled']=enabled;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteCollection:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteCollection(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listAttributes:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listAttributes(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createBooleanAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createBooleanAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -180,7 +259,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/boolean' if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEmailAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEmailAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -188,7 +268,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/email'.r if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createEnumAttribute:(databaseId,collectionId,key,elements,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createEnumAttribute(databaseId,collectionId,key,elements,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof elements==='undefined'){throw new AppwriteException('Missing required parameter: "elements"');} @@ -198,7 +279,8 @@ if(typeof elements!=='undefined'){payload['elements']=elements;} if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createFloatAttribute:(databaseId,collectionId,key,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createFloatAttribute(databaseId,collectionId,key,required,min,max,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -208,7 +290,8 @@ if(typeof min!=='undefined'){payload['min']=min;} if(typeof max!=='undefined'){payload['max']=max;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIntegerAttribute:(databaseId,collectionId,key,required,min,max,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createIntegerAttribute(databaseId,collectionId,key,required,min,max,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -218,7 +301,8 @@ if(typeof min!=='undefined'){payload['min']=min;} if(typeof max!=='undefined'){payload['max']=max;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createIpAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createIpAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -226,7 +310,8 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/ip'.repl if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createStringAttribute:(databaseId,collectionId,key,size,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createStringAttribute(databaseId,collectionId,key,size,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof size==='undefined'){throw new AppwriteException('Missing required parameter: "size"');} @@ -236,7 +321,8 @@ if(typeof size!=='undefined'){payload['size']=size;} if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createUrlAttribute:(databaseId,collectionId,key,required,xdefault,array)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +createUrlAttribute(databaseId,collectionId,key,required,xdefault,array){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof required==='undefined'){throw new AppwriteException('Missing required parameter: "required"');} @@ -244,13 +330,16 @@ let path='/databases/{databaseId}/collections/{collectionId}/attributes/url'.rep if(typeof required!=='undefined'){payload['required']=required;} if(typeof xdefault!=='undefined'){payload['default']=xdefault;} if(typeof array!=='undefined'){payload['array']=array;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getAttribute:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getAttribute(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteAttribute:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteAttribute(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDocuments:(databaseId,collectionId,queries,limit,offset,cursor,cursorDirection,orderAttributes,orderTypes)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDocuments(databaseId,collectionId,queries,limit,offset,cursor,cursorDirection,orderAttributes,orderTypes){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof queries!=='undefined'){payload['queries']=queries;} if(typeof limit!=='undefined'){payload['limit']=limit;} @@ -259,7 +348,8 @@ if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderAttributes!=='undefined'){payload['orderAttributes']=orderAttributes;} if(typeof orderTypes!=='undefined'){payload['orderTypes']=orderTypes;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDocument:(databaseId,collectionId,documentId,data,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDocument(databaseId,collectionId,documentId,data,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} if(typeof data==='undefined'){throw new AppwriteException('Missing required parameter: "data"');} @@ -267,27 +357,32 @@ let path='/databases/{databaseId}/collections/{collectionId}/documents'.replace( if(typeof data!=='undefined'){payload['data']=data;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDocument:(databaseId,collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getDocument(databaseId,collectionId,documentId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateDocument:(databaseId,collectionId,documentId,data,read,write)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateDocument(databaseId,collectionId,documentId,data,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -if(typeof data==='undefined'){throw new AppwriteException('Missing required parameter: "data"');} let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};if(typeof data!=='undefined'){payload['data']=data;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteDocument:(databaseId,collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteDocument(databaseId,collectionId,documentId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} -let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDocumentLogs:(databaseId,collectionId,documentId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDocumentLogs(databaseId,collectionId,documentId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof documentId==='undefined'){throw new AppwriteException('Missing required parameter: "documentId"');} let path='/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listIndexes:(databaseId,collectionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listIndexes(databaseId,collectionId){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createIndex:(databaseId,collectionId,key,type,attributes,orders)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createIndex(databaseId,collectionId,key,type,attributes,orders){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} if(typeof type==='undefined'){throw new AppwriteException('Missing required parameter: "type"');} @@ -296,31 +391,40 @@ let path='/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{ if(typeof type!=='undefined'){payload['type']=type;} if(typeof attributes!=='undefined'){payload['attributes']=attributes;} if(typeof orders!=='undefined'){payload['orders']=orders;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getIndex:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getIndex(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteIndex:(databaseId,collectionId,key)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteIndex(databaseId,collectionId,key){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} if(typeof key==='undefined'){throw new AppwriteException('Missing required parameter: "key"');} -let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listCollectionLogs:(databaseId,collectionId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +let path='/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId).replace('{key}',key);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listCollectionLogs(databaseId,collectionId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCollectionUsage:(databaseId,collectionId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCollectionUsage(databaseId,collectionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} if(typeof collectionId==='undefined'){throw new AppwriteException('Missing required parameter: "collectionId"');} let path='/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}',databaseId).replace('{collectionId}',collectionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listLogs:(databaseId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listLogs(databaseId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/logs'.replace('{databaseId}',databaseId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getDatabaseUsage:(databaseId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getDatabaseUsage(databaseId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof databaseId==='undefined'){throw new AppwriteException('Missing required parameter: "databaseId"');} let path='/databases/{databaseId}/usage'.replace('{databaseId}',databaseId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.functions={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Functions extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(functionId,name,execute,runtime,vars,events,schedule,timeout)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(functionId,name,execute,runtime,vars,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');} if(typeof runtime==='undefined'){throw new AppwriteException('Missing required parameter: "runtime"');} @@ -332,8 +436,11 @@ if(typeof vars!=='undefined'){payload['vars']=vars;} if(typeof events!=='undefined'){payload['events']=events;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),listRuntimes:()=>__awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} -let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(functionId,name,execute,vars,events,schedule,timeout)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +listRuntimes(){return __awaiter(this,void 0,void 0,function*(){let path='/functions/runtimes';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(functionId,name,execute,vars,events,schedule,timeout){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof execute==='undefined'){throw new AppwriteException('Missing required parameter: "execute"');} let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} @@ -342,55 +449,88 @@ if(typeof vars!=='undefined'){payload['vars']=vars;} if(typeof events!=='undefined'){payload['events']=events;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} -let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDeployments:(functionId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(functionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listDeployments(functionId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/deployments'.replace('{functionId}',functionId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDeployment:(functionId,entrypoint,code,activate,onProgress=(progress)=>{})=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDeployment(functionId,entrypoint,code,activate,onProgress=(progress)=>{}){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof entrypoint==='undefined'){throw new AppwriteException('Missing required parameter: "entrypoint"');} if(typeof code==='undefined'){throw new AppwriteException('Missing required parameter: "code"');} if(typeof activate==='undefined'){throw new AppwriteException('Missing required parameter: "activate"');} let path='/functions/{functionId}/deployments'.replace('{functionId}',functionId);let payload={};if(typeof entrypoint!=='undefined'){payload['entrypoint']=entrypoint;} if(typeof code!=='undefined'){payload['code']=code;} if(typeof activate!=='undefined'){payload['activate']=activate;} -const uri=new URL(this.config.endpoint+path);if(!(code instanceof File)){throw new AppwriteException('Parameter "code" has to be a File.');} -const size=code.size;if(size<=Appwrite.CHUNK_SIZE){return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);} -let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Appwrite.CHUNK_SIZE);for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);if(!(code instanceof File)){throw new AppwriteException('Parameter "code" has to be a File.');} +const size=code.size;if(size<=Service.CHUNK_SIZE){return yield this.client.call('post',uri,{'content-type':'multipart/form-data',},payload);} +let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Service.CHUNK_SIZE);for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateDeployment(functionId,deploymentId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} -let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteDeployment:(functionId,deploymentId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteDeployment(functionId,deploymentId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} -let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),retryBuild:(functionId,deploymentId,buildId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +retryBuild(functionId,deploymentId,buildId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof deploymentId==='undefined'){throw new AppwriteException('Missing required parameter: "deploymentId"');} if(typeof buildId==='undefined'){throw new AppwriteException('Missing required parameter: "buildId"');} -let path='/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId).replace('{buildId}',buildId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,limit,offset,search,cursor,cursorDirection)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}',functionId).replace('{deploymentId}',deploymentId).replace('{buildId}',buildId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +listExecutions(functionId,limit,offset,search,cursor,cursorDirection){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof search!=='undefined'){payload['search']=search;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createExecution:(functionId,data,async)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createExecution(functionId,data,async){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof data!=='undefined'){payload['data']=data;} if(typeof async!=='undefined'){payload['async']=async;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getExecution:(functionId,executionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getExecution(functionId,executionId){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} if(typeof executionId==='undefined'){throw new AppwriteException('Missing required parameter: "executionId"');} -let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId}',functionId).replace('{executionId}',executionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getUsage:(functionId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} +let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId}',functionId).replace('{executionId}',executionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getUsage(functionId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof functionId==='undefined'){throw new AppwriteException('Missing required parameter: "functionId"');} let path='/functions/{functionId}/usage'.replace('{functionId}',functionId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.health={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/health';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getAntivirus:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/anti-virus';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCache:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/cache';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getDB:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/db';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueCertificates:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/certificates';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueFunctions:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/functions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueLogs:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/logs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueWebhooks:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/webhooks';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getStorageLocal:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/storage/local';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getTime:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.locale={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getContinents:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountries:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesEU:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesPhones:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCurrencies:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getLanguages:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.projects={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Health extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/health';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getAntivirus(){return __awaiter(this,void 0,void 0,function*(){let path='/health/anti-virus';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCache(){return __awaiter(this,void 0,void 0,function*(){let path='/health/cache';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getDB(){return __awaiter(this,void 0,void 0,function*(){let path='/health/db';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueCertificates(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/certificates';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueFunctions(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/functions';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueLogs(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/logs';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getQueueWebhooks(){return __awaiter(this,void 0,void 0,function*(){let path='/health/queue/webhooks';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getStorageLocal(){return __awaiter(this,void 0,void 0,function*(){let path='/health/storage/local';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getTime(){return __awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Locale extends Service{constructor(client){super(client);} +get(){return __awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getContinents(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountries(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountriesEU(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCountriesPhones(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getCurrencies(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getLanguages(){return __awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Projects extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/projects';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(projectId,name,teamId,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(projectId,name,teamId,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects';let payload={};if(typeof projectId!=='undefined'){payload['projectId']=projectId;} @@ -405,8 +545,10 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(projectId,name,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +get(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(projectId,name,description,logo,url,legalName,legalCountry,legalState,legalCity,legalAddress,legalTaxId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} if(typeof description!=='undefined'){payload['description']=description;} @@ -418,51 +560,67 @@ 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.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),delete:(projectId,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +delete(projectId,password){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateAuthLimit:(projectId,limit)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateAuthLimit(projectId,limit){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof limit==='undefined'){throw new AppwriteException('Missing required parameter: "limit"');} let path='/projects/{projectId}/auth/limit'.replace('{projectId}',projectId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updateAuthStatus:(projectId,method,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updateAuthStatus(projectId,method,status){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/auth/{method}'.replace('{projectId}',projectId).replace('{method}',method);let payload={};if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listDomains:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDomain:(projectId,domain)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listDomains(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createDomain(projectId,domain){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domain==='undefined'){throw new AppwriteException('Missing required parameter: "domain"');} let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};if(typeof domain!=='undefined'){payload['domain']=domain;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getDomain(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteDomain(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateDomainVerification:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateDomainVerification(projectId,domainId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof domainId==='undefined'){throw new AppwriteException('Missing required parameter: "domainId"');} -let path='/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listKeys:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createKey:(projectId,name,scopes,expire)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listKeys(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createKey(projectId,name,scopes,expire){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getKey(projectId,keyId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof keyId==='undefined'){throw new AppwriteException('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateKey:(projectId,keyId,name,scopes,expire)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateKey(projectId,keyId,name,scopes,expire){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteKey(projectId,keyId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof keyId==='undefined'){throw new AppwriteException('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateOAuth2:(projectId,provider,appId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateOAuth2(projectId,provider,appId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof provider==='undefined'){throw new AppwriteException('Missing required parameter: "provider"');} let path='/projects/{projectId}/oauth2'.replace('{projectId}',projectId);let payload={};if(typeof provider!=='undefined'){payload['provider']=provider;} if(typeof appId!=='undefined'){payload['appId']=appId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listPlatforms:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createPlatform:(projectId,type,name,key,store,hostname)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +listPlatforms(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createPlatform(projectId,type,name,key,store,hostname){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};if(typeof type!=='undefined'){payload['type']=type;} @@ -470,26 +628,33 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getPlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getPlatform(projectId,platformId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof platformId==='undefined'){throw new AppwriteException('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePlatform:(projectId,platformId,name,key,store,hostname)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePlatform(projectId,platformId,name,key,store,hostname){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deletePlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deletePlatform(projectId,platformId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof platformId==='undefined'){throw new AppwriteException('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateServiceStatus:(projectId,service,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateServiceStatus(projectId,service,status){return __awaiter(this,void 0,void 0,function*(){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"');} let path='/projects/{projectId}/service'.replace('{projectId}',projectId);let payload={};if(typeof service!=='undefined'){payload['service']=service;} if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getUsage:(projectId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getUsage(projectId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} let path='/projects/{projectId}/usage'.replace('{projectId}',projectId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listWebhooks:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createWebhook:(projectId,name,events,url,security,httpUser,httpPass)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +listWebhooks(projectId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createWebhook(projectId,name,events,url,security,httpUser,httpPass){return __awaiter(this,void 0,void 0,function*(){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"');} @@ -500,9 +665,11 @@ 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.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getWebhook(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateWebhook:(projectId,webhookId,name,events,url,security,httpUser,httpPass)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateWebhook(projectId,webhookId,name,events,url,security,httpUser,httpPass){return __awaiter(this,void 0,void 0,function*(){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"');} @@ -514,17 +681,22 @@ 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.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteWebhook(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateWebhookSignature:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateWebhookSignature(projectId,webhookId){return __awaiter(this,void 0,void 0,function*(){if(typeof projectId==='undefined'){throw new AppwriteException('Missing required parameter: "projectId"');} if(typeof webhookId==='undefined'){throw new AppwriteException('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};this.storage={listBuckets:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +let path='/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +class Storage extends Service{constructor(client){super(client);} +listBuckets(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/storage/buckets';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createBucket:(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createBucket(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} let path='/storage/buckets';let payload={};if(typeof bucketId!=='undefined'){payload['bucketId']=bucketId;} @@ -537,8 +709,10 @@ if(typeof maximumFileSize!=='undefined'){payload['maximumFileSize']=maximumFileS if(typeof allowedFileExtensions!=='undefined'){payload['allowedFileExtensions']=allowedFileExtensions;} if(typeof encryption!=='undefined'){payload['encryption']=encryption;} if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getBucket:(bucketId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} -let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateBucket:(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateBucket(bucketId,name,permission,read,write,enabled,maximumFileSize,allowedFileExtensions,encryption,antivirus){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} if(typeof permission==='undefined'){throw new AppwriteException('Missing required parameter: "permission"');} let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} @@ -550,40 +724,48 @@ if(typeof maximumFileSize!=='undefined'){payload['maximumFileSize']=maximumFileS if(typeof allowedFileExtensions!=='undefined'){payload['allowedFileExtensions']=allowedFileExtensions;} if(typeof encryption!=='undefined'){payload['encryption']=encryption;} if(typeof antivirus!=='undefined'){payload['antivirus']=antivirus;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteBucket:(bucketId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} -let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listFiles:(bucketId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteBucket(bucketId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}'.replace('{bucketId}',bucketId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listFiles(bucketId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} let path='/storage/buckets/{bucketId}/files'.replace('{bucketId}',bucketId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createFile:(bucketId,fileId,file,read,write,onProgress=(progress)=>{})=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createFile(bucketId,fileId,file,read,write,onProgress=(progress)=>{}){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} if(typeof file==='undefined'){throw new AppwriteException('Missing required parameter: "file"');} let path='/storage/buckets/{bucketId}/files'.replace('{bucketId}',bucketId);let payload={};if(typeof fileId!=='undefined'){payload['fileId']=fileId;} if(typeof file!=='undefined'){payload['file']=file;} if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);if(!(file instanceof File)){throw new AppwriteException('Parameter "file" has to be a File.');} -const size=file.size;if(size<=Appwrite.CHUNK_SIZE){return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);} -let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Appwrite.CHUNK_SIZE);if(fileId!='unique()'){try{response=yield this.call('GET',new URL(this.config.endpoint+path+'/'+fileId),headers);counter=response.chunksUploaded;} +const uri=new URL(this.client.config.endpoint+path);if(!(file instanceof File)){throw new AppwriteException('Parameter "file" has to be a File.');} +const size=file.size;if(size<=Service.CHUNK_SIZE){return yield this.client.call('post',uri,{'content-type':'multipart/form-data',},payload);} +let id=undefined;let response=undefined;const headers={'content-type':'multipart/form-data',};let counter=0;const totalCounters=Math.ceil(size/Service.CHUNK_SIZE);if(fileId!='unique()'){try{response=yield this.client.call('GET',new URL(this.client.config.endpoint+path+'/'+fileId),headers);counter=response.chunksUploaded;} catch(e){}} -for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +for(counter;counter__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateFile(bucketId,fileId,read,write){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};if(typeof read!=='undefined'){payload['read']=read;} if(typeof write!=='undefined'){payload['write']=write;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteFile:(bucketId,fileId)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +deleteFile(bucketId,fileId){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getFileDownload:(bucketId,fileId)=>{if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +getFileDownload(bucketId,fileId){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},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"');} +let path='/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +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"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} let path='/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};if(typeof width!=='undefined'){payload['width']=width;} if(typeof height!=='undefined'){payload['height']=height;} @@ -596,40 +778,52 @@ if(typeof opacity!=='undefined'){payload['opacity']=opacity;} if(typeof rotation!=='undefined'){payload['rotation']=rotation;} if(typeof background!=='undefined'){payload['background']=background;} if(typeof output!=='undefined'){payload['output']=output;} -const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getFileView:(bucketId,fileId)=>{if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getFileView(bucketId,fileId){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} if(typeof fileId==='undefined'){throw new AppwriteException('Missing required parameter: "fileId"');} -let path='/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);} -return uri;},getUsage:(range)=>__awaiter(this,void 0,void 0,function*(){let path='/storage/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getBucketUsage:(bucketId,range)=>__awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} +let path='/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}',bucketId).replace('{fileId}',fileId);let payload={};const uri=new URL(this.client.config.endpoint+path);payload['project']=this.client.config.project;for(const[key,value]of Object.entries(Service.flatten(payload))){uri.searchParams.append(key,value);} +return uri;} +getUsage(range){return __awaiter(this,void 0,void 0,function*(){let path='/storage/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getBucketUsage(bucketId,range){return __awaiter(this,void 0,void 0,function*(){if(typeof bucketId==='undefined'){throw new AppwriteException('Missing required parameter: "bucketId"');} let path='/storage/{bucketId}/usage'.replace('{bucketId}',bucketId);let payload={};if(typeof range!=='undefined'){payload['range']=range;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.teams={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/teams';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});}} +class Teams extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/teams';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(teamId,name,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(teamId,name,roles){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/teams';let payload={};if(typeof teamId!=='undefined'){payload['teamId']=teamId;} if(typeof name!=='undefined'){payload['name']=name;} if(typeof roles!=='undefined'){payload['roles']=roles;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(teamId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +get(teamId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +update(teamId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listLogs:(teamId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('put',uri,{'content-type':'application/json',},payload);});} +delete(teamId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +listLogs(teamId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} let path='/teams/{teamId}/logs'.replace('{teamId}',teamId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getMemberships:(teamId,search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getMemberships(teamId,search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createMembership:(teamId,email,roles,url,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +createMembership(teamId,email,roles,url,name){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');} if(typeof url==='undefined'){throw new AppwriteException('Missing required parameter: "url"');} @@ -637,98 +831,96 @@ let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={} if(typeof roles!=='undefined'){payload['roles']=roles;} if(typeof url!=='undefined'){payload['url']=url;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getMembership(teamId,membershipId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} -let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateMembershipRoles:(teamId,membershipId,roles)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateMembershipRoles(teamId,membershipId,roles){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} if(typeof roles==='undefined'){throw new AppwriteException('Missing required parameter: "roles"');} let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof roles!=='undefined'){payload['roles']=roles;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +deleteMembership(teamId,membershipId){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} -let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateMembershipStatus:(teamId,membershipId,userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateMembershipStatus(teamId,membershipId,userId,secret){return __awaiter(this,void 0,void 0,function*(){if(typeof teamId==='undefined'){throw new AppwriteException('Missing required parameter: "teamId"');} if(typeof membershipId==='undefined'){throw new AppwriteException('Missing required parameter: "membershipId"');} if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof secret==='undefined'){throw new AppwriteException('Missing required parameter: "secret"');} let path='/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof secret!=='undefined'){payload['secret']=secret;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};this.users={list:(search,limit,offset,cursor,cursorDirection,orderType)=>__awaiter(this,void 0,void 0,function*(){let path='/users';let payload={};if(typeof search!=='undefined'){payload['search']=search;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +class Users extends Service{constructor(client){super(client);} +list(search,limit,offset,cursor,cursorDirection,orderType){return __awaiter(this,void 0,void 0,function*(){let path='/users';let payload={};if(typeof search!=='undefined'){payload['search']=search;} if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} if(typeof cursor!=='undefined'){payload['cursor']=cursor;} if(typeof cursorDirection!=='undefined'){payload['cursorDirection']=cursorDirection;} if(typeof orderType!=='undefined'){payload['orderType']=orderType;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(userId,email,password,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +create(userId,email,password,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/users';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;} if(typeof email!=='undefined'){payload['email']=email;} if(typeof password!=='undefined'){payload['password']=password;} if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getUsage:(range,provider)=>__awaiter(this,void 0,void 0,function*(){let path='/users/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('post',uri,{'content-type':'application/json',},payload);});} +getUsage(range,provider){return __awaiter(this,void 0,void 0,function*(){let path='/users/usage';let payload={};if(typeof range!=='undefined'){payload['range']=range;} if(typeof provider!=='undefined'){payload['provider']=provider;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),get:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),delete:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateEmail:(userId,email)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +get(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +delete(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateEmail(userId,email){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof email==='undefined'){throw new AppwriteException('Missing required parameter: "email"');} let path='/users/{userId}/email'.replace('{userId}',userId);let payload={};if(typeof email!=='undefined'){payload['email']=email;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getLogs:(userId,limit,offset)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getLogs(userId,limit,offset){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} let path='/users/{userId}/logs'.replace('{userId}',userId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} if(typeof offset!=='undefined'){payload['offset']=offset;} -const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getMemberships:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateName:(userId,name)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +getMemberships(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/memberships'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updateName(userId,name){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof name==='undefined'){throw new AppwriteException('Missing required parameter: "name"');} let path='/users/{userId}/name'.replace('{userId}',userId);let payload={};if(typeof name!=='undefined'){payload['name']=name;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePassword:(userId,password)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePassword(userId,password){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof password==='undefined'){throw new AppwriteException('Missing required parameter: "password"');} let path='/users/{userId}/password'.replace('{userId}',userId);let payload={};if(typeof password!=='undefined'){payload['password']=password;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhone:(userId,number)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhone(userId,number){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof number==='undefined'){throw new AppwriteException('Missing required parameter: "number"');} let path='/users/{userId}/phone'.replace('{userId}',userId);let payload={};if(typeof number!=='undefined'){payload['number']=number;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getPrefs:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(userId,prefs)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getPrefs(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +updatePrefs(userId,prefs){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof prefs==='undefined'){throw new AppwriteException('Missing required parameter: "prefs"');} let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),deleteSession:(userId,sessionId)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +getSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('get',uri,{'content-type':'application/json',},payload);});} +deleteSessions(userId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +deleteSession(userId,sessionId){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof sessionId==='undefined'){throw new AppwriteException('Missing required parameter: "sessionId"');} -let path='/users/{userId}/sessions/{sessionId}'.replace('{userId}',userId).replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateStatus:(userId,status)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions/{sessionId}'.replace('{userId}',userId).replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('delete',uri,{'content-type':'application/json',},payload);});} +updateStatus(userId,status){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof status==='undefined'){throw new AppwriteException('Missing required parameter: "status"');} let path='/users/{userId}/status'.replace('{userId}',userId);let payload={};if(typeof status!=='undefined'){payload['status']=status;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updateEmailVerification:(userId,emailVerification)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updateEmailVerification(userId,emailVerification){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof emailVerification==='undefined'){throw new AppwriteException('Missing required parameter: "emailVerification"');} let path='/users/{userId}/verification'.replace('{userId}',userId);let payload={};if(typeof emailVerification!=='undefined'){payload['emailVerification']=emailVerification;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePhoneVerification:(userId,phoneVerification)=>__awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});} +updatePhoneVerification(userId,phoneVerification){return __awaiter(this,void 0,void 0,function*(){if(typeof userId==='undefined'){throw new AppwriteException('Missing required parameter: "userId"');} if(typeof phoneVerification==='undefined'){throw new AppwriteException('Missing required parameter: "phoneVerification"');} let path='/users/{userId}/verification/phone'.replace('{userId}',userId);let payload={};if(typeof phoneVerification!=='undefined'){payload['phoneVerification']=phoneVerification;} -const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};} -setEndpoint(endpoint){this.config.endpoint=endpoint;this.config.endpointRealtime=this.config.endpointRealtime||this.config.endpoint.replace('https://','wss://').replace('http://','ws://');return this;} -setEndpointRealtime(endpointRealtime){this.config.endpointRealtime=endpointRealtime;return this;} -setProject(value){this.headers['X-Appwrite-Project']=value;this.config.project=value;return this;} -setKey(value){this.headers['X-Appwrite-Key']=value;this.config.key=value;return this;} -setJWT(value){this.headers['X-Appwrite-JWT']=value;this.config.jwt=value;return this;} -setLocale(value){this.headers['X-Appwrite-Locale']=value;this.config.locale=value;return this;} -setMode(value){this.headers['X-Appwrite-Mode']=value;this.config.mode=value;return this;} -subscribe(channels,callback){let channelArray=typeof channels==='string'?[channels]:channels;channelArray.forEach(channel=>this.realtime.channels.add(channel));const counter=this.realtime.subscriptionsCounter++;this.realtime.subscriptions.set(counter,{channels:channelArray,callback});this.realtime.connect();return()=>{this.realtime.subscriptions.delete(counter);this.realtime.cleanUp(channelArray);this.realtime.connect();};} -call(method,url,headers={},params={}){var _a,_b;return __awaiter(this,void 0,void 0,function*(){method=method.toUpperCase();headers=Object.assign({},this.headers,headers);let options={method,headers,credentials:'include'};if(typeof window!=='undefined'&&window.localStorage){headers['X-Fallback-Cookies']=(_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:'';} -if(method==='GET'){for(const[key,value]of Object.entries(this.flatten(params))){url.searchParams.append(key,value);}} -else{switch(headers['content-type']){case'application/json':options.body=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();for(const key in params){if(Array.isArray(params[key])){params[key].forEach((value)=>{formData.append(key+'[]',value);});} -else{formData.append(key,params[key]);}} -options.body=formData;delete headers['content-type'];break;}} -try{let data=null;const response=yield crossFetch.fetch(url.toString(),options);if((_b=response.headers.get('content-type'))===null||_b===void 0?void 0:_b.includes('application/json')){data=yield response.json();} -else{data={message:yield response.text()};} -if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data===null||data===void 0?void 0:data.type,data);} -const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);} -return data;} -catch(e){if(e instanceof AppwriteException){throw e;} -throw new AppwriteException(e.message);}});} -flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));} -else{output[finalKey]=value;}} -return output;}} -Appwrite.CHUNK_SIZE=5*1024*1024;class Query{} -Query.equal=(attribute,value)=>Query.addQuery(attribute,"equal",value);Query.notEqual=(attribute,value)=>Query.addQuery(attribute,"notEqual",value);Query.lesser=(attribute,value)=>Query.addQuery(attribute,"lesser",value);Query.lesserEqual=(attribute,value)=>Query.addQuery(attribute,"lesserEqual",value);Query.greater=(attribute,value)=>Query.addQuery(attribute,"greater",value);Query.greaterEqual=(attribute,value)=>Query.addQuery(attribute,"greaterEqual",value);Query.search=(attribute,value)=>Query.addQuery(attribute,"search",value);Query.addQuery=(attribute,oper,value)=>value instanceof Array?`${attribute}.${oper}(${value - .map((v) => Query.parseValues(v)) - .join(",")})`:`${attribute}.${oper}(${Query.parseValues(value)})`;Query.parseValues=(value)=>typeof value==="string"||value instanceof String?`"${value}"`:`${value}`;exports.Appwrite=Appwrite;exports.Query=Query;Object.defineProperty(exports,'__esModule',{value:true});}(this.window=this.window||{},null,window));(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.Chart=factory());})(this,(function(){'use strict';function fontString(pixelSize,fontStyle,fontFamily){return fontStyle+' '+pixelSize+'px '+fontFamily;} +const uri=new URL(this.client.config.endpoint+path);return yield this.client.call('patch',uri,{'content-type':'application/json',},payload);});}} +exports.Account=Account;exports.AppwriteException=AppwriteException;exports.Avatars=Avatars;exports.Client=Client;exports.Databases=Databases;exports.Functions=Functions;exports.Health=Health;exports.Locale=Locale;exports.Projects=Projects;exports.Query=Query;exports.Storage=Storage;exports.Teams=Teams;exports.Users=Users;Object.defineProperty(exports,'__esModule',{value:true});})(this.Appwrite=this.Appwrite||{},null,window);(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=typeof globalThis!=='undefined'?globalThis:global||self,global.Chart=factory());})(this,(function(){'use strict';function fontString(pixelSize,fontStyle,fontFamily){return fontStyle+' '+pixelSize+'px '+fontFamily;} const requestAnimFrame=(function(){if(typeof window==='undefined'){return function(callback){return callback();};} return window.requestAnimationFrame;}());function throttled(fn,thisArg,updateFn){const updateArgs=updateFn||((args)=>Array.prototype.slice.call(args));let ticking=false;let args=[];return function(...rest){args=updateArgs(rest);if(!ticking){ticking=true;requestAnimFrame.call(window,()=>{ticking=false;fn.apply(thisArg,args);});}};} function debounce(fn,delay){let timeout;return function(...args){if(delay){clearTimeout(timeout);timeout=setTimeout(fn,delay,args);}else{fn.apply(this,args);} @@ -956,10 +1148,12 @@ gc.splice(0,gcLen);} return longest;} function _alignPixel(chart,pixel,width){const devicePixelRatio=chart.currentDevicePixelRatio;const halfWidth=width!==0?Math.max(width/2,0.5):0;return Math.round((pixel-halfWidth)*devicePixelRatio)/devicePixelRatio+halfWidth;} function clearCanvas(canvas,ctx){ctx=ctx||canvas.getContext('2d');ctx.save();ctx.resetTransform();ctx.clearRect(0,0,canvas.width,canvas.height);ctx.restore();} -function drawPoint(ctx,options,x,y){let type,xOffset,yOffset,size,cornerRadius;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}} +function drawPoint(ctx,options,x,y){drawPointLegend(ctx,options,x,y,null);} +function drawPointLegend(ctx,options,x,y,w){let type,xOffset,yOffset,size,cornerRadius,width;const style=options.pointStyle;const rotation=options.rotation;const radius=options.radius;let rad=(rotation||0)*RAD_PER_DEG;if(style&&typeof style==='object'){type=style.toString();if(type==='[object HTMLImageElement]'||type==='[object HTMLCanvasElement]'){ctx.save();ctx.translate(x,y);ctx.rotate(rad);ctx.drawImage(style,-style.width/2,-style.height/2,style.width,style.height);ctx.restore();return;}} if(isNaN(radius)||radius<=0){return;} -ctx.beginPath();switch(style){default:ctx.arc(x,y,radius,0,TAU);ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;ctx.rect(x-size,y-size,2*size,2*size);break;} -rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;} +ctx.beginPath();switch(style){default:if(w){ctx.ellipse(x,y,w/2,radius,0,0,TAU);}else{ctx.arc(x,y,radius,0,TAU);} +ctx.closePath();break;case'triangle':ctx.moveTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);rad+=TWO_THIRDS_PI;ctx.lineTo(x+Math.sin(rad)*radius,y-Math.cos(rad)*radius);ctx.closePath();break;case'rectRounded':cornerRadius=radius*0.516;size=radius-cornerRadius;xOffset=Math.cos(rad+QUARTER_PI)*size;yOffset=Math.sin(rad+QUARTER_PI)*size;ctx.arc(x-xOffset,y-yOffset,cornerRadius,rad-PI,rad-HALF_PI);ctx.arc(x+yOffset,y-xOffset,cornerRadius,rad-HALF_PI,rad);ctx.arc(x+xOffset,y+yOffset,cornerRadius,rad,rad+HALF_PI);ctx.arc(x-yOffset,y+xOffset,cornerRadius,rad+HALF_PI,rad+PI);ctx.closePath();break;case'rect':if(!rotation){size=Math.SQRT1_2*radius;width=w?w/2:size;ctx.rect(x-width,y-size,2*width,2*size);break;} +rad+=QUARTER_PI;case'rectRot':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+yOffset,y-xOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.lineTo(x-yOffset,y+xOffset);ctx.closePath();break;case'crossRot':rad+=QUARTER_PI;case'cross':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'star':xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);rad+=QUARTER_PI;xOffset=Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);ctx.moveTo(x+yOffset,y-xOffset);ctx.lineTo(x-yOffset,y+xOffset);break;case'line':xOffset=w?w/2:Math.cos(rad)*radius;yOffset=Math.sin(rad)*radius;ctx.moveTo(x-xOffset,y-yOffset);ctx.lineTo(x+xOffset,y+yOffset);break;case'dash':ctx.moveTo(x,y);ctx.lineTo(x+Math.cos(rad)*radius,y+Math.sin(rad)*radius);break;} ctx.fill();if(options.borderWidth>0){ctx.stroke();}} function _isPointInArea(point,area,margin){margin=margin||0.5;return!area||(point&&point.x>area.left-margin&&point.xarea.top-margin&&point.ya.filter(x=>!b.some(y=>x.plugin.id===y.plugin.id));this._notify(diff(previousDescriptors,descriptors),chart,'stop');this._notify(diff(descriptors,previousDescriptors),chart,'start');}} -function allPlugins(config){const plugins=[];const keys=Object.keys(registry.plugins.items);for(let i=0;iisObject(value)&&Object.getOwnPropertyNames(value).reduce((acc,key)=>acc||isFunction(value[key]),false);function needContext(proxy,names){const{isScriptable,isIndexable}=_descriptors(proxy);for(const prop of names){const scriptable=isScriptable(prop);const indexable=isIndexable(prop);const value=(indexable||scriptable)&&proxy[prop];if((scriptable&&(isFunction(value)||hasFunction(value)))||(indexable&&isArray(value))){return true;}} return false;} -var version="3.8.0";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} +var version="3.8.2";const KNOWN_POSITIONS=['top','bottom','left','right','chartArea'];function positionIsHorizontal(position,axis){return position==='top'||position==='bottom'||(KNOWN_POSITIONS.indexOf(position)===-1&&axis==='x');} function compare2Level(l1,l2){return function(a,b){return a[l1]===b[l1]?a[l2]-b[l2]:a[l1]-b[l1];};} function onAnimationsComplete(context){const chart=context.chart;const animationOptions=chart.options.animation;chart.notifyPlugins('afterRender');callback(animationOptions&&animationOptions.onComplete,[context],chart);} function onAnimationProgress(context){const chart=context.chart;const animationOptions=chart.options.animation;callback(animationOptions&&animationOptions.onProgress,[context],chart);} @@ -1643,7 +1839,7 @@ const instances={};const getChart=(key)=>{const canvas=getCanvas(key);return Obj function determineLastEvent(e,lastEvent,inChartArea,isClick){if(!inChartArea||e.type==='mouseout'){return null;} if(isClick){return lastEvent;} return e;} -class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas can be reused.');} +class Chart{constructor(item,userConfig){const config=this.config=new Config(userConfig);const initialCanvas=getCanvas(item);const existingChart=getChart(initialCanvas);if(existingChart){throw new Error('Canvas is already in use. Chart with ID \''+existingChart.id+'\''+' must be destroyed before the canvas with ID \''+existingChart.canvas.id+'\' can be reused.');} const options=config.createResolver(config.chartOptionScopes(),this.getContext());this.platform=new(config.platform||_detectPlatform(initialCanvas))();this.platform.updateConfig(config);const context=this.platform.acquireContext(initialCanvas,options.aspectRatio);const canvas=context&&context.canvas;const height=canvas&&canvas.height;const width=canvas&&canvas.width;this.id=uid();this.ctx=context;this.canvas=canvas;this.width=width;this.height=height;this._options=options;this._aspectRatio=this.aspectRatio;this._layers=[];this._metasets=[];this._stacks=undefined;this.boxes=[];this.currentDevicePixelRatio=undefined;this.chartArea=undefined;this._active=[];this._lastEvent=undefined;this._listeners={};this._responsiveListeners=undefined;this._sortedMetasets=[];this.scales={};this._plugins=new PluginService();this.$proxies={};this._hiddenIndices={};this.attached=false;this._animationsDisabled=undefined;this.$context=undefined;this._doResize=debounce(mode=>this.update(mode),options.resizeDelay||0);this._dataChanges=[];instances[this.id]=this;if(!context||!canvas){console.error("Failed to create chart: can't acquire context from the given item");return;} animator.listen(this,'complete',onAnimationsComplete);animator.listen(this,'progress',onAnimationProgress);this._initialize();if(this.attached){this.update();}} get aspectRatio(){const{options:{aspectRatio,maintainAspectRatio},width,height,_aspectRatio}=this;if(!isNullOrUndef(aspectRatio)){return aspectRatio;} @@ -1808,12 +2004,11 @@ getMaxOverflow(){return 0;} getLabelAndValue(index){const meta=this._cachedMeta;const{iScale,vScale}=meta;const parsed=this.getParsed(index);const custom=parsed._custom;const value=isFloatBar(custom)?'['+custom.start+', '+custom.end+']':''+vScale.getLabelForValue(parsed[vScale.axis]);return{label:''+iScale.getLabelForValue(parsed[iScale.axis]),value};} initialize(){this.enableOptionSharing=true;super.initialize();const meta=this._cachedMeta;meta.stack=this.getDataset().stack;} update(mode){const meta=this._cachedMeta;this.updateElements(meta.data,0,meta.data.length,mode);} -updateElements(bars,start,count,mode){const reset=mode==='reset';const{index,_cachedMeta:{vScale}}=this;const base=vScale.getBasePixel();const horizontal=vScale.isHorizontal();const ruler=this._getRuler();const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);this.updateSharedOptions(sharedOptions,mode,firstOpts);for(let i=start;imeta.controller.options.grouped);const stacked=iScale.options.stacked;const stacks=[];const skipNull=(meta)=>{const parsed=meta.controller.getParsed(dataIndex);const val=parsed&&parsed[meta.vScale.axis];if(isNullOrUndef(val)||isNaN(val)){return true;}};for(const meta of metasets){if(dataIndex!==undefined&&skipNull(meta)){continue;} +if(stacked===false||stacks.indexOf(meta.stack)===-1||(stacked===undefined&&meta.stack===undefined)){stacks.push(meta.stack);} +if(meta.index===last){break;}} if(!stacks.length){stacks.push(undefined);} return stacks;} _getStackCount(index){return this._getStacks(undefined,index).length;} @@ -1842,9 +2037,8 @@ getMaxOverflow(){const data=this._cachedMeta.data;let max=0;for(let i=data.lengt return max>0&&max;} getLabelAndValue(index){const meta=this._cachedMeta;const{xScale,yScale}=meta;const parsed=this.getParsed(index);const x=xScale.getLabelForValue(parsed.x);const y=yScale.getLabelForValue(parsed.y);const r=parsed._custom;return{label:meta.label,value:'('+x+', '+y+(r?', '+r:'')+')'};} update(mode){const points=this._cachedMeta.data;this.updateElements(points,0,points.length,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;for(let i=start;i0&&!isNaN(value)){return TAU*(Math.abs(value)/total);} @@ -1886,11 +2079,10 @@ return dataLabel;}}}}};class LineController extends DatasetController{initialize update(mode){const meta=this._cachedMeta;const{dataset:line,data:points=[],_dataset}=meta;const animationsDisabled=this.chart._animationsDisabled;let{start,count}=getStartAndCountOfVisiblePoints(meta,points,animationsDisabled);this._drawStart=start;this._drawCount=count;if(scaleRangesChanged(meta)){start=0;count=points.length;} line._chart=this.chart;line._datasetIndex=this.index;line._decimated=!!_dataset._decimated;line.points=points;const options=this.resolveDatasetElementOptions(mode);if(!this.options.showLine){options.borderWidth=0;} options.segment=this.options.segment;this.updateElement(line,undefined,{animated:!animationsDisabled,options},mode);this.updateElements(points,start,count,mode);} -updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const firstOpts=this.resolveDataElementOptions(start,mode);const sharedOptions=this.getSharedOptions(firstOpts);const includeOptions=this.includeOptions(mode,sharedOptions);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} +updateElements(points,start,count,mode){const reset=mode==='reset';const{iScale,vScale,_stacked,_dataset}=this._cachedMeta;const{sharedOptions,includeOptions}=this._getSharedOptions(start,mode);const iAxis=iScale.axis;const vAxis=vScale.axis;const{spanGaps,segment}=this.options;const maxGapLength=isNumber(spanGaps)?spanGaps:Number.POSITIVE_INFINITY;const directUpdate=this.chart._animationsDisabled||reset||mode==='none';let prevParsed=start>0&&this.getParsed(start-1);for(let i=start;i0&&(Math.abs(parsed[iAxis]-prevParsed[iAxis]))>maxGapLength;if(segment){properties.parsed=parsed;properties.raw=_dataset.data[i];} if(includeOptions){properties.options=sharedOptions||this.resolveDataElementOptions(i,point.active?'active':mode);} if(!directUpdate){this.updateElement(point,i,properties,mode);} -prevParsed=parsed;} -this.updateSharedOptions(sharedOptions,mode,firstOpts);} +prevParsed=parsed;}} getMaxOverflow(){const meta=this._cachedMeta;const dataset=meta.dataset;const border=dataset.options&&dataset.options.borderWidth||0;const data=meta.data||[];if(!data.length){return border;} const firstPoint=data[0].size(this.resolveDataElementOptions(0));const lastPoint=data[data.length-1].size(this.resolveDataElementOptions(data.length-1));return Math.max(border,firstPoint,lastPoint)/2;} draw(){const meta=this._cachedMeta;meta.dataset.updateControlPoints(this.chart.chartArea,meta.iScale.axis);super.draw();}} @@ -2057,6 +2249,7 @@ function _getEdge(a,b,prop,fn){if(a&&b){return fn(a[prop],b[prop]);} return a?a[prop]:b?b[prop]:0;} function _createBoundaryLine(boundary,line){let points=[];let _loop=false;if(isArray(boundary)){_loop=true;points=boundary;}else{points=_pointsFromSegments(boundary,line);} return points.length?new LineElement({points,options:{tension:0},_loop,_fullLoop:_loop}):null;} +function _shouldApplyFill(source){return source&&source.fill!==false;} function _resolveTarget(sources,index,propagate){const source=sources[index];let fill=source.fill;const visited=[index];let target;if(!propagate){return fill;} while(fill!==false&&visited.indexOf(fill)===-1){if(!isNumberFinite(fill)){return fill;} target=sources[fill];if(!target){return false;} @@ -2119,9 +2312,9 @@ var index={id:'filler',afterDatasetsUpdate(chart,_args,options){const count=(cha meta.$filler=source;sources.push(source);} for(i=0;i=0;--i){const source=metasets[i].$filler;if(!source){continue;} -source.line.updateControlPoints(area,source.axis);if(draw){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} -const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(source){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!source||source.fill===false||options.drawTime!=='beforeDatasetDraw'){return;} -_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=Math.min(boxWidth,fontSize);} +source.line.updateControlPoints(area,source.axis);if(draw&&source.fill){_drawfill(chart.ctx,source,area);}}},beforeDatasetsDraw(chart,_args,options){if(options.drawTime!=='beforeDatasetsDraw'){return;} +const metasets=chart.getSortedVisibleDatasetMetas();for(let i=metasets.length-1;i>=0;--i){const source=metasets[i].$filler;if(_shouldApplyFill(source)){_drawfill(chart.ctx,source,chart.chartArea);}}},beforeDatasetDraw(chart,args,options){const source=args.meta.$filler;if(!_shouldApplyFill(source)||options.drawTime!=='beforeDatasetDraw'){return;} +_drawfill(chart.ctx,source,chart.chartArea);},defaults:{propagate:true,drawTime:'beforeDatasetDraw'}};const getBoxSize=(labelOpts,fontSize)=>{let{boxHeight=fontSize,boxWidth=fontSize}=labelOpts;if(labelOpts.usePointStyle){boxHeight=Math.min(boxHeight,fontSize);boxWidth=labelOpts.pointStyleWidth||Math.min(boxWidth,fontSize);} return{boxWidth,boxHeight,itemHeight:Math.max(fontSize,boxHeight)};};const itemsEqual=(a,b)=>a!==null&&b!==null&&a.datasetIndex===b.datasetIndex&&a.index===b.index;class Legend extends Element{constructor(config){super();this._added=false;this.legendHitBoxes=[];this._hoveredItem=null;this.doughnutMode=false;this.chart=config.chart;this.options=config.options;this.ctx=config.ctx;this.legendItems=undefined;this.columnSizes=undefined;this.lineWidths=undefined;this.maxHeight=undefined;this.maxWidth=undefined;this.top=undefined;this.bottom=undefined;this.left=undefined;this.right=undefined;this.height=undefined;this.width=undefined;this._margins=undefined;this.position=undefined;this.weight=undefined;this.fullSize=undefined;} update(maxWidth,maxHeight,margins){this.maxWidth=maxWidth;this.maxHeight=maxHeight;this._margins=margins;this.setDimensions();this.buildLabels();this.fit();} setDimensions(){if(this.isHorizontal()){this.width=this.maxWidth;this.left=this._margins.left;this.right=this.width;}else{this.height=this.maxHeight;this.top=this._margins.top;this.bottom=this.height;}} @@ -2143,7 +2336,7 @@ hitbox.top=top;hitbox.left+=this.left+padding;hitbox.left=rtlHelper.leftForLtr(r isHorizontal(){return this.options.position==='top'||this.options.position==='bottom';} draw(){if(this.options.display){const ctx=this.ctx;clipArea(ctx,this);this._draw();unclipArea(ctx);}} _draw(){const{options:opts,columnSizes,lineWidths,ctx}=this;const{align,labels:labelOpts}=opts;const defaultColor=defaults.color;const rtlHelper=getRtlAdapter(opts.rtl,this.left,this.width);const labelFont=toFont(labelOpts.font);const{color:fontColor,padding}=labelOpts;const fontSize=labelFont.size;const halfFontSize=fontSize/2;let cursor;this.drawTitle();ctx.textAlign=rtlHelper.textAlign('left');ctx.textBaseline='middle';ctx.lineWidth=0.5;ctx.font=labelFont.string;const{boxWidth,boxHeight,itemHeight}=getBoxSize(labelOpts,fontSize);const drawLegendBox=function(x,y,legendItem){if(isNaN(boxWidth)||boxWidth<=0||isNaN(boxHeight)||boxHeight<0){return;} -ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxWidth*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPoint(ctx,drawOptions,centerX,centerY);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);} +ctx.save();const lineWidth=valueOrDefault(legendItem.lineWidth,1);ctx.fillStyle=valueOrDefault(legendItem.fillStyle,defaultColor);ctx.lineCap=valueOrDefault(legendItem.lineCap,'butt');ctx.lineDashOffset=valueOrDefault(legendItem.lineDashOffset,0);ctx.lineJoin=valueOrDefault(legendItem.lineJoin,'miter');ctx.lineWidth=lineWidth;ctx.strokeStyle=valueOrDefault(legendItem.strokeStyle,defaultColor);ctx.setLineDash(valueOrDefault(legendItem.lineDash,[]));if(labelOpts.usePointStyle){const drawOptions={radius:boxHeight*Math.SQRT2/2,pointStyle:legendItem.pointStyle,rotation:legendItem.rotation,borderWidth:lineWidth};const centerX=rtlHelper.xPlus(x,boxWidth/2);const centerY=y+halfFontSize;drawPointLegend(ctx,drawOptions,centerX,centerY,boxWidth);}else{const yBoxTop=y+Math.max((fontSize-boxHeight)/2,0);const xBoxLeft=rtlHelper.leftForLtr(x,boxWidth);const borderRadius=toTRBLCorners(legendItem.borderRadius);ctx.beginPath();if(Object.values(borderRadius).some(v=>v!==0)){addRoundedRectPath(ctx,{x:xBoxLeft,y:yBoxTop,w:boxWidth,h:boxHeight,radius:borderRadius,});}else{ctx.rect(xBoxLeft,yBoxTop,boxWidth,boxHeight);} ctx.fill();if(lineWidth!==0){ctx.stroke();}} ctx.restore();};const fillText=function(x,y,legendItem){renderText(ctx,legendItem.text,x,y+(itemHeight/2),labelFont,{strikethrough:legendItem.hidden,textAlign:rtlHelper.textAlign(legendItem.textAlign)});};const isHorizontal=this.isHorizontal();const titleHeight=this._computeTitleHeight();if(isHorizontal){cursor={x:_alignStartEnd(align,this.left+padding,this.right-lineWidths[0]),y:this.top+padding+titleHeight,line:0};}else{cursor={x:this.left+padding,y:_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[0].height),line:0};} overrideTextDirection(this.ctx,opts.textDirection);const lineHeight=itemHeight+padding;this.legendItems.forEach((legendItem,i)=>{ctx.strokeStyle=legendItem.fontColor||fontColor;ctx.fillStyle=legendItem.fontColor||fontColor;const textWidth=ctx.measureText(legendItem.text).width;const textAlign=rtlHelper.textAlign(legendItem.textAlign||(legendItem.textAlign=labelOpts.textAlign));const width=boxWidth+halfFontSize+textWidth;let x=cursor.x;let y=cursor.y;rtlHelper.setWidth(this.width);if(isHorizontal){if(i>0&&x+width+padding>this.right){y=cursor.y+=lineHeight;cursor.line++;x=cursor.x=_alignStartEnd(align,this.left+padding,this.right-lineWidths[cursor.line]);}}else if(i>0&&y+lineHeight>this.bottom){x=cursor.x=x+columnSizes[cursor.line].width+padding;cursor.line++;y=cursor.y=_alignStartEnd(align,this.top+titleHeight+padding,this.bottom-columnSizes[cursor.line].height);} @@ -2233,7 +2426,7 @@ if(yAlign==='top'){y1=ptY;y2=y1-caretSize;x1=x2-caretSize;x3=x2+caretSize;}else{ y3=y1;} return{x1,x2,x3,y1,y2,y3};} drawTitle(pt,ctx,options){const title=this.title;const length=title.length;let titleFont,titleSpacing,i;if(length){const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);pt.x=getAlignedX(this,options.titleAlign,options);ctx.textAlign=rtlHelper.textAlign(options.titleAlign);ctx.textBaseline='middle';titleFont=toFont(options.titleFont);titleSpacing=options.titleSpacing;ctx.fillStyle=options.titleColor;ctx.font=titleFont.string;for(i=0;iv!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}} +_drawColorBox(ctx,pt,i,rtlHelper,options){const labelColors=this.labelColors[i];const labelPointStyle=this.labelPointStyles[i];const{boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);const colorX=getAlignedX(this,'left',options);const rtlColorX=rtlHelper.x(colorX);const yOffSet=boxHeightv!==0)){ctx.beginPath();ctx.fillStyle=options.multiKeyBackground;addRoundedRectPath(ctx,{x:outerX,y:colorY,w:boxWidth,h:boxHeight,radius:borderRadius,});ctx.fill();ctx.stroke();ctx.fillStyle=labelColors.backgroundColor;ctx.beginPath();addRoundedRectPath(ctx,{x:innerX,y:colorY+1,w:boxWidth-2,h:boxHeight-2,radius:borderRadius,});ctx.fill();}else{ctx.fillStyle=options.multiKeyBackground;ctx.fillRect(outerX,colorY,boxWidth,boxHeight);ctx.strokeRect(outerX,colorY,boxWidth,boxHeight);ctx.fillStyle=labelColors.backgroundColor;ctx.fillRect(innerX,colorY+1,boxWidth-2,boxHeight-2);}} ctx.fillStyle=this.labelTextColors[i];} drawBody(pt,ctx,options){const{body}=this;const{bodySpacing,bodyAlign,displayColors,boxHeight,boxWidth,boxPadding}=options;const bodyFont=toFont(options.bodyFont);let bodyLineHeight=bodyFont.lineHeight;let xLinePadding=0;const rtlHelper=getRtlAdapter(options.rtl,this.x,this.width);const fillLineOfText=function(line){ctx.fillText(line,rtlHelper.x(pt.x+xLinePadding),pt.y+bodyLineHeight/2);pt.y+=bodyLineHeight+bodySpacing;};const bodyAlignForCalculation=rtlHelper.textAlign(bodyAlign);let bodyItem,textColor,lines,i,j,ilen,jlen;ctx.textAlign=bodyAlign;ctx.textBaseline='middle';ctx.font=bodyFont.string;pt.x=getAlignedX(this,bodyAlignForCalculation,options);ctx.fillStyle=options.bodyColor;each(this.beforeBody,fillLineOfText);xLinePadding=displayColors&&bodyAlignForCalculation!=='right'?bodyAlign==='center'?(boxWidth/2+boxPadding):(boxWidth+2+boxPadding):0;for(i=0,ilen=body.length;i\s]/i.test(str);} -function isLinkClose(str){return/^<\/a\s*>/i.test(str);} -var linkify=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;} +return this.__cache__[chainName]||[];};var ruler=Ruler;var NEWLINES_RE=/\r\n?|\n/g;var NULL_RE=/\0/g;var normalize=function normalize(state){var str;str=state.src.replace(NEWLINES_RE,"\n");str=str.replace(NULL_RE,"\ufffd");state.src=str;};var block=function block(state){var token;if(state.inlineMode){token=new state.Token("inline","",0);token.content=state.src;token.map=[0,1];token.children=[];state.tokens.push(token);}else{state.md.block.parse(state.src,state.md,state.env,state.tokens);}};var inline=function inline(state){var tokens=state.tokens,tok,i,l;for(i=0,l=tokens.length;i\s]/i.test(str);} +function isLinkClose$1(str){return/^<\/a\s*>/i.test(str);} +var linkify$1=function linkify(state){var i,j,l,tokens,token,currentToken,nodes,ln,text,pos,lastPos,level,htmlLinkLevel,url,fullUrl,urlText,blockTokens=state.tokens,links;if(!state.md.options.linkify){return;} for(j=0,l=blockTokens.length;j=0;i--){currentToken=tokens[i];if(currentToken.type==="link_close"){i--;while(tokens[i].level!==currentToken.level&&tokens[i].type!=="link_open"){i--;} continue;} -if(currentToken.type==="html_inline"){if(isLinkOpen(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;} -if(isLinkClose(currentToken.content)){htmlLinkLevel++;}} +if(currentToken.type==="html_inline"){if(isLinkOpen$1(currentToken.content)&&htmlLinkLevel>0){htmlLinkLevel--;} +if(isLinkClose$1(currentToken.content)){htmlLinkLevel++;}} if(htmlLinkLevel>0){continue;} -if(currentToken.type==="text"&&state.md.linkify.test(currentToken.content)){text=currentToken.content;links=state.md.linkify.match(text);nodes=[];level=currentToken.level;lastPos=0;for(ln=0;ln0&&links[0].index===0&&i>0&&tokens[i-1].type==="text_special"){links=links.slice(1);} +for(ln=0;lnlastPos){token=new state.Token("text","",0);token.content=text.slice(lastPos,pos);token.level=level;nodes.push(token);} token=new state.Token("link_open","a",1);token.attrs=[["href",fullUrl]];token.level=level++;token.markup="linkify";token.info="auto";nodes.push(token);token=new state.Token("text","",0);token.content=urlText;token.level=level;nodes.push(token);token=new state.Token("link_close","a",-1);token.level=--level;token.markup="linkify";token.info="auto";nodes.push(token);lastPos=links[ln].lastIndex;} if(lastPos=0;i--){token=inlineTokens[i];if(token.type==="text"&&!inside_autolink){token.content=token.content.replace(SCOPED_ABBR_RE,replaceFn);} if(token.type==="link_open"&&token.info==="auto"){inside_autolink--;} if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}} @@ -2644,7 +2838,7 @@ if(token.type==="link_close"&&token.info==="auto"){inside_autolink++;}}} var replacements=function replace(state){var blkIdx;if(!state.md.options.typographer){return;} for(blkIdx=state.tokens.length-1;blkIdx>=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"){continue;} if(SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)){replace_scoped(state.tokens[blkIdx].children);} -if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.substr(0,index)+ch+str.substr(index+1);} +if(RARE_RE.test(state.tokens[blkIdx].content)){replace_rare(state.tokens[blkIdx].children);}}};var isWhiteSpace$1=utils.isWhiteSpace;var isPunctChar$1=utils.isPunctChar;var isMdAsciiPunct$1=utils.isMdAsciiPunct;var QUOTE_TEST_RE=/['"]/;var QUOTE_RE=/['"]/g;var APOSTROPHE="\u2019";function replaceAt(str,index,ch){return str.slice(0,index)+ch+str.slice(index+1);} function process_inlines(tokens,state){var i,token,text,t,pos,max,thisLevel,item,lastChar,nextChar,isLastPunctChar,isNextPunctChar,isLastWhiteSpace,isNextWhiteSpace,canOpen,canClose,j,isSingle,stack,openQuote,closeQuote;stack=[];for(i=0;i=0;j--){if(stack[j].level<=thisLevel){break;}} stack.length=j+1;if(token.type!=="text"){continue;} text=token.content;pos=0;max=text.length;OUTER:while(pos=0;blkIdx--){if(state.tokens[blkIdx].type!=="inline"||!QUOTE_TEST_RE.test(state.tokens[blkIdx].content)){continue;} -process_inlines(state.tokens[blkIdx].children,state);}};function Token(type,tag,nesting){this.type=type;this.tag=tag;this.attrs=null;this.map=null;this.nesting=nesting;this.level=0;this.children=null;this.content="";this.markup="";this.info="";this.meta=null;this.block=false;this.hidden=false;} +process_inlines(state.tokens[blkIdx].children,state);}};var text_join=function text_join(state){var j,l,tokens,curr,max,last,blockTokens=state.tokens;for(j=0,l=blockTokens.length;j=0){value=this.attrs[idx][1];} return value;};Token.prototype.attrJoin=function attrJoin(name,value){var idx=this.attrIndex(name);if(idx<0){this.attrPush([name,value]);}else{this.attrs[idx][1]=this.attrs[idx][1]+" "+value;}};var token=Token;function StateCore(src,md,env){this.src=src;this.env=env;this.tokens=[];this.inlineMode=false;this.md=md;} -StateCore.prototype.Token=token;var state_core=StateCore;var _rules$2=[["normalize",normalize],["block",block],["inline",inline],["linkify",linkify],["replacements",replacements],["smartquotes",smartquotes]];function Core(){this.ruler=new ruler;for(var i=0;i<_rules$2.length;i++){this.ruler.push(_rules$2[i][0],_rules$2[i][1]);}} -Core.prototype.process=function(state){var i,l,rules;rules=this.ruler.getRules("");for(i=0,l=rules.length;i0)return false;pos=state.pos;max=state.posMax;if(pos+3>max)return false;if(state.src.charCodeAt(pos)!==58)return false;if(state.src.charCodeAt(pos+1)!==47)return false;if(state.src.charCodeAt(pos+2)!==47)return false;match=state.pending.match(SCHEME_RE);if(!match)return false;proto=match[1];link=state.md.linkify.matchAtStart(state.src.slice(pos-proto.length));if(!link)return false;url=link.url;url=url.replace(/\*+$/,"");fullUrl=state.md.normalizeLink(url);if(!state.md.validateLink(fullUrl))return false;if(!silent){state.pending=state.pending.slice(0,-proto.length);token=state.push("link_open","a",1);token.attrs=[["href",fullUrl]];token.markup="linkify";token.info="auto";token=state.push("text","",0);token.content=state.md.normalizeLinkText(url);token=state.push("link_close","a",-1);token.markup="linkify";token.info="auto";} +state.pos+=url.length-proto.length;return true;};var isSpace$3=utils.isSpace;var newline=function newline(state,silent){var pmax,max,ws,pos=state.pos;if(state.src.charCodeAt(pos)!==10){return false;} pmax=state.pending.length-1;max=state.posMax;if(!silent){if(pmax>=0&&state.pending.charCodeAt(pmax)===32){if(pmax>=1&&state.pending.charCodeAt(pmax-1)===32){ws=pmax-1;while(ws>=1&&state.pending.charCodeAt(ws-1)===32)ws--;state.pending=state.pending.slice(0,ws);state.push("hardbreak","br",0);}else{state.pending=state.pending.slice(0,-1);state.push("softbreak","br",0);}}else{state.push("softbreak","br",0);}} pos++;while(pos?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92){return false;} -pos++;if(pos?@[]^_`{|}~-".split("").forEach((function(ch){ESCAPED[ch.charCodeAt(0)]=1;}));var _escape=function escape(state,silent){var ch1,ch2,origStr,escapedStr,token,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==92)return false;pos++;if(pos>=max)return false;ch1=state.src.charCodeAt(pos);if(ch1===10){if(!silent){state.push("hardbreak","br",0);} +pos++;while(pos=55296&&ch1<=56319&&pos+1=56320&&ch2<=57343){escapedStr+=state.src[pos+1];pos++;}} +origStr="\\"+escapedStr;if(!silent){token=state.push("text_special","",0);if(ch1<256&&ESCAPED[ch1]!==0){token.content=escapedStr;}else{token.content=origStr;} +token.markup=origStr;token.info="escape";} +state.pos=pos+1;return true;};var backticks=function backtick(state,silent){var start,max,marker,token,matchStart,matchEnd,openerLength,closerLength,pos=state.pos,ch=state.src.charCodeAt(pos);if(ch!==96){return false;} start=pos;pos++;max=state.posMax;while(pos=97&&lc<=122;} +return false;};var HTML_TAG_RE=html_re.HTML_TAG_RE;function isLinkOpen(str){return/^\s]/i.test(str);} +function isLinkClose(str){return/^<\/a\s*>/i.test(str);} +function isLetter(ch){var lc=ch|32;return lc>=97&&lc<=122;} var html_inline=function html_inline(state,silent){var ch,match,max,token,pos=state.pos;if(!state.md.options.html){return false;} max=state.posMax;if(state.src.charCodeAt(pos)!==60||pos+2>=max){return false;} ch=state.src.charCodeAt(pos+1);if(ch!==33&&ch!==63&&ch!==47&&!isLetter(ch)){return false;} match=state.src.slice(pos).match(HTML_TAG_RE);if(!match){return false;} -if(!silent){token=state.push("html_inline","",0);token.content=state.src.slice(pos,pos+match[0].length);} -state.pos+=match[0].length;return true;};var has=utils.has;var isValidEntityCode=utils.isValidEntityCode;var fromCodePoint=utils.fromCodePoint;var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;var NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;var entity=function entity(state,silent){var ch,code,match,pos=state.pos,max=state.posMax;if(state.src.charCodeAt(pos)!==38){return false;} -if(pos+1=max)return false;ch=state.src.charCodeAt(pos+1);if(ch===35){match=state.src.slice(pos).match(DIGITAL_RE);if(match){if(!silent){code=match[1][0].toLowerCase()==="x"?parseInt(match[1].slice(1),16):parseInt(match[1],10);token=state.push("text_special","",0);token.content=isValidEntityCode(code)?fromCodePoint(code):fromCodePoint(65533);token.markup=match[0];token.info="entity";} +state.pos+=match[0].length;return true;}}else{match=state.src.slice(pos).match(NAMED_RE);if(match){if(has(entities,match[1])){if(!silent){token=state.push("text_special","",0);token.content=entities[match[1]];token.markup=match[0];token.info="entity";} +state.pos+=match[0].length;return true;}}} +return false;};function processDelimiters(state,delimiters){var closerIdx,openerIdx,closer,opener,minOpenerIdx,newMinOpenerIdx,isOddMatch,lastJump,openersBottom={},max=delimiters.length;if(!max)return;var headerIdx=0;var lastTokenIdx=-2;var jumps=[];for(closerIdx=0;closerIdxminOpenerIdx;openerIdx-=jumps[openerIdx]+1){opener=delimiters[openerIdx];if(opener.marker!==closer.marker)continue;if(opener.open&&opener.end<0){isOddMatch=false;if(opener.close||closer.open){if((opener.length+closer.length)%3===0){if(opener.length%3!==0||closer.length%3!==0){isOddMatch=true;}}} if(!isOddMatch){lastJump=openerIdx>0&&!delimiters[openerIdx-1].open?jumps[openerIdx-1]+1:0;jumps[closerIdx]=closerIdx-openerIdx+lastJump;jumps[openerIdx]=lastJump;closer.open=false;opener.end=closerIdx;opener.close=false;newMinOpenerIdx=-1;lastTokenIdx=-2;break;}}} if(newMinOpenerIdx!==-1){openersBottom[closer.marker][(closer.open?3:0)+(closer.length||0)%3]=newMinOpenerIdx;}}} -var balance_pairs=function link_pairs(state){var curr,tokens_meta=state.tokens_meta,max=state.tokens_meta.length;processDelimiters(state,state.delimiters);for(curr=0;curr0)level++;if(tokens[curr].type==="text"&&curr+10)level++;if(tokens[curr].type==="text"&&curr+10){this.level++;this._prev_delimiters.push(this.delimiters);this.delimiters=[];token_meta={delimiters:this.delimiters};} @@ -2957,7 +3153,7 @@ this.pendingLevel=this.level;this.tokens.push(token$1);this.tokens_meta.push(tok count=pos-start;nextChar=pos=end){break;} continue;} state.pending+=state.src[state.pos++];} -if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;} +if(state.pending){state.pushPending();}};ParserInline.prototype.parse=function(str,md,env,outTokens){var i,rules,len;var state=new this.State(str,md,env,outTokens);this.tokenize(state);rules=this.ruler2.getRules("");len=rules.length;for(i=0;i|$))";re.tpl_email_fuzzy="(^|"+text_separators+'|"|\\(|'+re.src_ZCc+")"+"("+re.src_email_name+"@"+re.tpl_host_fuzzy_strict+")";re.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_fuzzy_strict+re.src_path+")";re.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|"+re.src_ZPCc+"))"+"((?![$+<=>^`|\uff5c])"+re.tpl_host_port_no_ip_fuzzy_strict+re.src_path+")";return re;};function assign(obj){var sources=Array.prototype.slice.call(arguments,1);sources.forEach((function(source){if(!source){return;} Object.keys(source).forEach((function(key){obj[key]=source[key];}));}));return obj;} function _class(obj){return Object.prototype.toString.call(obj);} function isString(obj){return _class(obj)==="[object String]";} @@ -2996,7 +3192,7 @@ if(isFunction(val.normalize)){compiled.normalize=val.normalize;}else if(!val.nor return;} if(isString(val)){aliases.push(name);return;} schemaError(name,val);}));aliases.forEach((function(alias){if(!self.__compiled__[self.__schemas__[alias]]){return;} -self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);} +self.__compiled__[alias].validate=self.__compiled__[self.__schemas__[alias]].validate;self.__compiled__[alias].normalize=self.__compiled__[self.__schemas__[alias]].normalize;}));self.__compiled__[""]={validate:null,normalize:createNormalizer()};var slist=Object.keys(self.__compiled__).filter((function(name){return name.length>0&&self.__compiled__[name];})).map(escapeRE).join("|");self.re.schema_test=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","i");self.re.schema_search=RegExp("(^|(?!_)(?:[><\uff5c]|"+re$1.src_ZPCc+"))("+slist+")","ig");self.re.schema_at_start=RegExp("^"+self.re.schema_search.source,"i");self.re.pretest=RegExp("("+self.re.schema_test.source+")|("+self.re.host_fuzzy_test.source+")|@","i");resetScanCache(self);} function Match(self,shift){var start=self.__index__,end=self.__last_index__,text=self.__text_cache__.slice(start,end);this.schema=self.__schema__.toLowerCase();this.index=start+shift;this.lastIndex=end+shift;this.raw=text;this.text=text;this.url=text;} function createMatch(self,shift){var match=new Match(self,shift);self.__compiled__[match.schema].normalize(match,self);return match;} function LinkifyIt(schemas,options){if(!(this instanceof LinkifyIt)){return new LinkifyIt(schemas,options);} @@ -3010,7 +3206,7 @@ return this.__index__>=0;};LinkifyIt.prototype.pretest=function pretest(text){re return this.__compiled__[schema.toLowerCase()].validate(text,pos,this);};LinkifyIt.prototype.match=function match(text){var shift=0,result=[];if(this.__index__>=0&&this.__text_cache__===text){result.push(createMatch(this,shift));shift=this.__last_index__;} var tail=shift?text.slice(shift):text;while(this.test(tail)){result.push(createMatch(this,shift));tail=tail.slice(this.__last_index__);shift+=this.__last_index__;} if(result.length){return result;} -return null;};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;} +return null;};LinkifyIt.prototype.matchAtStart=function matchAtStart(text){this.__text_cache__=text;this.__index__=-1;if(!text.length)return null;var m=this.re.schema_at_start.exec(text);if(!m)return null;var len=this.testSchemaAt(text,m[2],m[0].length);if(!len)return null;this.__schema__=m[2];this.__index__=m.index+m[1].length;this.__last_index__=m.index+m[0].length+len;return createMatch(this,0);};LinkifyIt.prototype.tlds=function tlds(list,keepOld){list=Array.isArray(list)?list:[list];if(!keepOld){this.__tlds__=list.slice();this.__tlds_replaced__=true;compile(this);return this;} this.__tlds__=this.__tlds__.concat(list).sort().filter((function(el,idx,arr){return el!==arr[idx-1];})).reverse();compile(this);return this;};LinkifyIt.prototype.normalize=function normalize(match){if(!match.schema){match.url="http://"+match.url;} if(match.schema==="mailto:"&&!/^mailto:/i.test(match.url)){match.url="mailto:"+match.url;}};LinkifyIt.prototype.onCompile=function onCompile(){};var linkifyIt=LinkifyIt;var maxInt=2147483647;var base=36;var tMin=1;var tMax=26;var skew=38;var damp=700;var initialBias=72;var initialN=128;var delimiter="-";var regexPunycode=/^xn--/;var regexNonASCII=/[^\x20-\x7E]/;var regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g;var errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var baseMinusTMin=base-tMin;var floor=Math.floor;var stringFromCharCode=String.fromCharCode;function error(type){throw new RangeError(errors[type]);} function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length]);} @@ -3051,7 +3247,7 @@ output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCou return output.join("");} function toUnicode(input){return mapDomain(input,(function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string;}));} function toASCII(input){return mapDomain(input,(function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string;}));} -var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;} +var version="1.4.1";var ucs2={decode:ucs2decode,encode:ucs2encode};var punycode$1={version:version,ucs2:ucs2,toASCII:toASCII,toUnicode:toUnicode,encode:encode,decode:decode};var punycode$2=Object.freeze({__proto__:null,decode:decode,encode:encode,toUnicode:toUnicode,toASCII:toASCII,version:version,ucs2:ucs2,default:punycode$1});var _default={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var zero={options:{html:false,xhtmlOut:false,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var commonmark={options:{html:true,xhtmlOut:true,breaks:false,langPrefix:"language-",linkify:false,typographer:false,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var punycode=getAugmentedNamespace(punycode$2);var config={default:_default,zero:zero,commonmark:commonmark};var BAD_PROTO_RE=/^(vbscript|javascript|file|data):/;var GOOD_DATA_RE=/^data:image\/(gif|png|jpeg|webp);/;function validateLink(url){var str=url.trim().toLowerCase();return BAD_PROTO_RE.test(str)?GOOD_DATA_RE.test(str)?true:false:true;} var RECODE_HOSTNAME_FOR=["http:","https:","mailto:"];function normalizeLink(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toASCII(parsed.hostname);}catch(er){}}} return mdurl.encode(mdurl.format(parsed));} function normalizeLinkText(url){var parsed=mdurl.parse(url,true);if(parsed.hostname){if(!parsed.protocol||RECODE_HOSTNAME_FOR.indexOf(parsed.protocol)>=0){try{parsed.hostname=punycode.toUnicode(parsed.hostname);}catch(er){}}} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index d240f5860..fadc1caf9 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -493,7 +493,7 @@ function handler2(){} handler2.inline=(el,{expression},{cleanup:cleanup2})=>{let root=closestRoot(el);if(!root._x_refs) root._x_refs={};root._x_refs[expression]=el;cleanup2(()=>delete root._x_refs[expression]);};directive("ref",handler2);directive("if",(el,{expression},{effect:effect3,cleanup:cleanup2})=>{let evaluate2=evaluateLater(el,expression);let show=()=>{if(el._x_currentIfEl) return el._x_currentIfEl;let clone2=el.content.cloneNode(true).firstElementChild;addScopeToNode(clone2,{},el);mutateDom(()=>{el.after(clone2);initTree(clone2);});el._x_currentIfEl=clone2;el._x_undoIf=()=>{clone2.remove();delete el._x_currentIfEl;};return clone2;};let hide=()=>{if(!el._x_undoIf) -return;el._x_undoIf();delete el._x_undoIf;};effect3(()=>evaluate2((value)=>{value?show():hide();}));cleanup2(()=>el._x_undoIf&&el._x_undoIf());});mapAttributes(startingWith("@",into(prefix("on:"))));directive("on",skipDuringClone((el,{value,modifiers,expression},{cleanup:cleanup2})=>{let evaluate2=expression?evaluateLater(el,expression):()=>{};let removeListener=on(el,value,modifiers,(e)=>{evaluate2(()=>{},{scope:{$event:e},params:[e]});});cleanup2(()=>removeListener());}));alpine_default.setEvaluator(normalEvaluator);alpine_default.setReactivityEngine({reactive:reactive2,effect:effect2,release:stop,raw:toRaw});var src_default=alpine_default;window.Alpine=src_default;queueMicrotask(()=>{src_default.start();});})();window.ls.error=function(){return function(error){window.console.error(error);if(window.location.pathname!=='/console'){window.location='/console';}};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});document.addEventListener("account.create",function(){let container=window.ls.container;let form=container.get('serviceForm');let sdk=container.get('console');let promise=sdk.account.createEmailSession(form.email,form.password);container.set("serviceForm",{},true,true);promise.then(function(){var subscribe=document.getElementById('newsletter').checked;if(subscribe){let alerts=container.get('alerts');let loaderId=alerts.add({text:'Loading...',class:""},0);fetch('https://appwrite.io/v1/newsletter/subscribe',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:form.name,email:form.email,}),}).finally(function(){alerts.remove(loaderId);window.location='/console';});}else{window.location='/console';}},function(error){window.location='/auth/signup?failure=1';});});window.addEventListener("load",async()=>{const bars=12;const realtime=window.ls.container.get('realtime');const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));let current={};window.ls.container.get('console').subscribe(['project','console'],response=>{if(response.events.includes('stats.connections')){for(let project in response.payload){current[project]=response.payload[project]??0;} +return;el._x_undoIf();delete el._x_undoIf;};effect3(()=>evaluate2((value)=>{value?show():hide();}));cleanup2(()=>el._x_undoIf&&el._x_undoIf());});mapAttributes(startingWith("@",into(prefix("on:"))));directive("on",skipDuringClone((el,{value,modifiers,expression},{cleanup:cleanup2})=>{let evaluate2=expression?evaluateLater(el,expression):()=>{};let removeListener=on(el,value,modifiers,(e)=>{evaluate2(()=>{},{scope:{$event:e},params:[e]});});cleanup2(()=>removeListener());}));alpine_default.setEvaluator(normalEvaluator);alpine_default.setReactivityEngine({reactive:reactive2,effect:effect2,release:stop,raw:toRaw});var src_default=alpine_default;window.Alpine=src_default;queueMicrotask(()=>{src_default.start();});})();window.ls.error=function(){return function(error){window.console.error(error);if(window.location.pathname!=='/console'){window.location='/console';}};};window.addEventListener("error",function(event){console.error("ERROR-EVENT:",event.error.message,event.error.stack);});document.addEventListener("account.deleteSession",function(){window.location="/auth/signin";});document.addEventListener("account.create",function(){let container=window.ls.container;let form=container.get('serviceForm');let sdk=container.get('console');let promise=sdk.account.createEmailSession(form.email,form.password);container.set("serviceForm",{},true,true);promise.then(function(){var subscribe=document.getElementById('newsletter').checked;if(subscribe){let alerts=container.get('alerts');let loaderId=alerts.add({text:'Loading...',class:""},0);fetch('https://appwrite.io/v1/newsletter/subscribe',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({name:form.name,email:form.email,}),}).finally(function(){alerts.remove(loaderId);window.location='/console';});}else{window.location='/console';}},function(error){window.location='/auth/signup?failure=1';});});window.addEventListener("load",async()=>{const bars=12;const realtime=window.ls.container.get('realtime');const sleep=ms=>new Promise(resolve=>setTimeout(resolve,ms));let current={};window.ls.container.get('console').client.subscribe(['project','console'],response=>{if(response.events.includes('stats.connections')){for(let project in response.payload){current[project]=response.payload[project]??0;} return;} if(response.events.includes('databases.*.collections.*.attributes.*')){document.dispatchEvent(new CustomEvent('databases.createAttribute'));return;} if(response.events.includes('databases.*.collections.*.indexes.*')){document.dispatchEvent(new CustomEvent('databases.createIndex'));return;} @@ -521,7 +521,7 @@ params=formData;break;} return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){request.setRequestHeader(key,headers[key]);}} request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type');contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;} resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);} -request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var sdk=new window.Appwrite();var endpoint=window.location.origin+'/v1';sdk.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return sdk;},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f +request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((params.length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let analytics={create:function(id,source,activity,url){return http.post('/analytics',{'content-type':'application/json'},{id:id,source:source,activity:activity,url:url,version:env.VERSION,setup:env.SETUP});},};return{analytics:analytics,};},true);})(window);(function(window){"use strict";window.ls.container.set('console',function(window){var client=new Appwrite.Client();var endpoint=window.location.origin+'/v1';client.setEndpoint(endpoint).setProject('console').setLocale(APP_ENV.LOCALE);return{client:client,account:new Appwrite.Account(client),avatars:new Appwrite.Avatars(client),databases:new Appwrite.Databases(client),functions:new Appwrite.Functions(client),health:new Appwrite.Health(client),locale:new Appwrite.Locale(client),projects:new Appwrite.Projects(client),storage:new Appwrite.Storage(client),teams:new Appwrite.Teams(client),users:new Appwrite.Users(client)}},true);})(window);(function(window){"use strict";window.ls.container.set('date',function(){function format(format,timestamp){var jsdate,f var txtWords=['Sun','Mon','Tues','Wednes','Thurs','Fri','Satur','January','February','March','April','May','June','July','August','September','October','November','December'] var formatChr=/\\?(.?)/gi var formatChrCb=function(t,s){return f[t]?f[t]():s} @@ -651,7 +651,7 @@ return slf.renderToken(tokens,idx,opts);} md.renderer.rules.strong_open=renderEm;md.renderer.rules.strong_close=renderEm;return md;},true);})(window);(function(window){"use strict";window.ls.container.set('rtl',function(){var rtlStock="^ا^ب^ت^ث^ج^ح^خ^د^ذ^ر^ز^س^ش^ص^ض^ط^ظ^ع^غ^ف^ق^ك^ل^م^ن^ه^و^ي^א^ב^ג^ד^ה^ו^ז^ח^ט^י^כ^ך^ל^מ^ם^נ^ן^ס^ע^פ^ף^צ^ץ^ק^ר^ש^ת^";var special=["\n"," "," ","״",'"',"_","'","!","@","#","$","^","&","%","*","(",")","+","=","-","[","]","\\","/","{","}","|",":","<",">","?",",",".","0","1","2","3","4","5","6","7","8","9"];var isRTL=function(value){for(var i=0;i{return{current:null,history:null,setCurrent:function(currentConnections){var scope=this;scope.current=currentConnections;return scope.current;},setHistory:function(history){var scope=this;scope.history=history;return scope.history;}};},true,true);})(window);window.ls.router.add("/auth/signin",{template:"/auth/signin?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/signup",{template:"/auth/signup?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery",{template:"/auth/recovery?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery/reset",{template:"/auth/recovery/reset?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/confirm",{template:"/auth/confirm?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/join",{template:"/auth/join?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/magic-url",{template:"/auth/magic-url?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/success",{template:"/auth/oauth2/success?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/failure",{template:"/auth/oauth2/failure?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/console",{template:"/console?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account/:tab",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/home",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/home/:tab",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/platforms/:platform",{template:function(window){return window.location.pathname+"?version="+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/notifications",{template:"/console/notifications?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/settings",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/settings/:tab",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks",{template:"/console/webhooks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks/webhook",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/webhooks/webhook/new",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/keys",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/keys/:tab",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks/:tab",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases",{template:"/console/databases?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases/database",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/database/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage",{template:"/console/storage?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/storage/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/users",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user/:tab",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team/:tab",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/:tab",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function/:tab",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/:tab",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true});window.ls.filter.add("avatar",function($value,element){if(!$value){return"";} +return false;};return{isRTL:isRTL,};},true);})(window);(function(window){"use strict";window.ls.container.set('sdk',function(window,router){var client=new Appwrite.Client();var endpoint=window.location.origin+'/v1';client.setEndpoint(endpoint).setProject(router.params.project||'').setLocale(APP_ENV.LOCALE).setMode('admin');return{client:client,account:new Appwrite.Account(client),avatars:new Appwrite.Avatars(client),databases:new Appwrite.Databases(client),functions:new Appwrite.Functions(client),health:new Appwrite.Health(client),locale:new Appwrite.Locale(client),storage:new Appwrite.Storage(client),teams:new Appwrite.Teams(client),users:new Appwrite.Users(client)}},false);})(window);(function(window){"use strict";window.ls.container.set('search',function(window){return{params:{},path:'',pointer:'',selected:'',};},true,true);})(window);(function(window){"use strict";window.ls.container.set('timezone',function(){return{convert:function(unixTime){var timezoneMinutes=new Date().getTimezoneOffset();timezoneMinutes=(timezoneMinutes===0)?0:-timezoneMinutes;return parseInt(unixTime)+(timezoneMinutes*60);}};},true);})(window);(function(window){"use strict";window.ls.container.set('realtime',()=>{return{current:null,history:null,setCurrent:function(currentConnections){var scope=this;scope.current=currentConnections;return scope.current;},setHistory:function(history){var scope=this;scope.history=history;return scope.history;}};},true,true);})(window);window.ls.router.add("/auth/signin",{template:"/auth/signin?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/signup",{template:"/auth/signup?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery",{template:"/auth/recovery?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/recovery/reset",{template:"/auth/recovery/reset?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/confirm",{template:"/auth/confirm?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/join",{template:"/auth/join?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/magic-url",{template:"/auth/magic-url?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/success",{template:"/auth/oauth2/success?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/auth/oauth2/failure",{template:"/auth/oauth2/failure?version="+APP_ENV.CACHEBUSTER,scope:"home"}).add("/console",{template:"/console?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/account/:tab",{template:"/console/account?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/home",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/home/:tab",{template:"/console/home?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/platforms/:platform",{template:function(window){return window.location.pathname+"?version="+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/notifications",{template:"/console/notifications?version="+APP_ENV.CACHEBUSTER,scope:"console"}).add("/console/settings",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/settings/:tab",{template:"/console/settings?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks",{template:"/console/webhooks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/webhooks/webhook",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/webhooks/webhook/new",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/keys",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/keys/:tab",{template:"/console/keys?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/tasks/:tab",{template:"/console/tasks?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases",{template:"/console/databases?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/databases/database",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/database/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/collection/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/databases/document/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage",{template:"/console/storage?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/storage/usage",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/storage/bucket/:tab",{template:function(window){return window.location.pathname+window.location.search+'&version='+APP_ENV.CACHEBUSTER;},scope:"console",project:true}).add("/console/users",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/user/:tab",{template:"/console/users/user?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/teams/team/:tab",{template:"/console/users/teams/team?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/users/:tab",{template:"/console/users?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/function/:tab",{template:"/console/functions/function?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true}).add("/console/functions/:tab",{template:"/console/functions?version="+APP_ENV.CACHEBUSTER,scope:"console",project:true});window.ls.filter.add("avatar",function($value,element){if(!$value){return"";} let size=element.dataset["size"]||80;let name=$value.name||$value||"";name=(typeof name!=='string')?'--':name;return def="/v1/avatars/initials?project=console"+"&name="+ encodeURIComponent(name)+"&width="+ size+"&height="+ @@ -714,14 +714,15 @@ return url;}}else{if(typeof value!=="undefined"&&value!==null){var separator=url return url;}else{return url;}}};keys=keys.split(",").map(element=>element.trim());return function(serviceForm,router,window){let url=window.location.href;keys.map(node=>{node=node.split("=");let key=node[0]||"";let name=node[1]||key;let value=getValue(key,"param",serviceForm);url=updateQueryString(name,value?value:null,url);});if(url!==window.location.href){window.history.pushState({},"",url);router.reset();}};},trigger:function(events){return function(document){events=events.trim().split(",");for(let i=0;i)|{)/m;const REGEX_PARAMETERS_VALUES=/\s*([\w\\$]+)\s*(?:=\s*((?:(?:(['"])(?:\3|(?:.*?[^\\]\3)))((\s*\+\s*)(?:(?:(['"])(?:\6|(?:.*?[^\\]\6)))|(?:[\w$]*)))*)|.*?))?\s*(?:,|$)/gm;let functionAsString=func.toString();let params=[];let match;functionAsString=functionAsString.replaceAll('={}',"");functionAsString=functionAsString.replaceAll('=[]',"");functionAsString=functionAsString.replace(REGEX_COMMENTS,"");functionAsString=functionAsString.match(REGEX_FUNCTION_PARAMS)[1];if(functionAsString.charAt(0)==="("){functionAsString=functionAsString.slice(1,-1);} +if(element.array){document[element.key]=[];}}}}}};let getParams=function getParams(func){const REGEX_COMMENTS=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;const REGEX_FUNCTION_PARAMS=/(?:\s*(?:function\s*[^(]*)?\s*)((?:[^'"]|(?:(?:(['"])(?:(?:.*?[^\\]\2)|\2))))*?)\s*(?=(?:=>)|{)/m;const REGEX_PARAMETERS_VALUES=/\s*([\w\\$]+)\s*(?:=\s*((?:(?:(['"])(?:\3|(?:.*?[^\\]\3)))((\s*\+\s*)(?:(?:(['"])(?:\6|(?:.*?[^\\]\6)))|(?:[\w$]*)))*)|.*?))?\s*(?:,|$)/gm;let functionAsString=func.toString();let params=[];let match;let indexOfArguments=functionAsString.indexOf('(');if(indexOfArguments!==-1){functionAsString=functionAsString.slice(indexOfArguments,-1);} +functionAsString=functionAsString.replaceAll('={}',"");functionAsString=functionAsString.replaceAll('=[]',"");functionAsString=functionAsString.replace(REGEX_COMMENTS,"");functionAsString=functionAsString.match(REGEX_FUNCTION_PARAMS)[1];if(functionAsString.charAt(0)==="("){functionAsString=functionAsString.slice(1,-1);} while((match=REGEX_PARAMETERS_VALUES.exec(functionAsString))){params.push(match[1]);} return params;};let getValue=function(key,prefix,data){let result=null;if(!key){return null;} let attrKey=prefix+key.charAt(0).toUpperCase()+key.slice(1);if(element.dataset[attrKey]){result=expression.parse(element.dataset[attrKey]);if(element.dataset[attrKey+"CastTo"]==="array"){result=result.split(",");}} if(typeof data[key]!=='undefined'){result=data[key];} if(typeof result==='undefined'){result="";} return result;};let resolve=function(target,prefix="param",data={}){if(!target){return function(){};} -let args=getParams(target);return target.apply(target,args.map(function(value){let result=getValue(value,prefix,data);return result??undefined;}));};let exec=function(event){let parsedSuccess=expression.parse(success);let parsedFailure=expression.parse(failure);let parsedAction=expression.parse(action);parsedSuccess=parsedSuccess&&parsedSuccess!=""?parsedSuccess.split(",").map(element=>element.trim()):[];parsedFailure=parsedFailure&&parsedFailure!=""?parsedFailure.split(",").map(element=>element.trim()):[];element.$lsSkip=true;element.classList.add("load-service-start");if(!document.body.contains(element)){element=undefined;return false;} +let args=getParams(target);return target.apply(container.get(scope),args.map(function(value){let result=getValue(value,prefix,data);return result??undefined;}));};let exec=function(event){let parsedSuccess=expression.parse(success);let parsedFailure=expression.parse(failure);let parsedAction=expression.parse(action);parsedSuccess=parsedSuccess&&parsedSuccess!=""?parsedSuccess.split(",").map(element=>element.trim()):[];parsedFailure=parsedFailure&&parsedFailure!=""?parsedFailure.split(",").map(element=>element.trim()):[];element.$lsSkip=true;element.classList.add("load-service-start");if(!document.body.contains(element)){element=undefined;return false;} if(event){event.preventDefault();} if(running){return false;} running=true;element.style.backgroud='red';if(confirm){if(window.confirm(confirm)!==true){element.classList.add("load-service-end");element.$lsSkip=false;running=false;return false;}} diff --git a/public/scripts/dependencies/appwrite.js b/public/scripts/dependencies/appwrite.js index 2651ddb21..44df64ac9 100644 --- a/public/scripts/dependencies/appwrite.js +++ b/public/scripts/dependencies/appwrite.js @@ -1,7 +1,7 @@ (function (exports, isomorphicFormData, crossFetch) { 'use strict'; - /*! ***************************************************************************** + /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -26,6 +26,45 @@ }); } + class Service { + constructor(client) { + this.client = client; + } + static flatten(data, prefix = '') { + let output = {}; + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? `${prefix}[${key}]` : key; + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); + } + else { + output[finalKey] = value; + } + } + return output; + } + } + Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB + + class Query { + } + Query.equal = (attribute, value) => Query.addQuery(attribute, 'equal', value); + Query.notEqual = (attribute, value) => Query.addQuery(attribute, 'notEqual', value); + Query.lesser = (attribute, value) => Query.addQuery(attribute, 'lesser', value); + Query.lesserEqual = (attribute, value) => Query.addQuery(attribute, 'lesserEqual', value); + Query.greater = (attribute, value) => Query.addQuery(attribute, 'greater', value); + Query.greaterEqual = (attribute, value) => Query.addQuery(attribute, 'greaterEqual', value); + Query.search = (attribute, value) => Query.addQuery(attribute, 'search', value); + Query.addQuery = (attribute, oper, value) => value instanceof Array + ? `${attribute}.${oper}(${value + .map((v) => Query.parseValues(v)) + .join(',')})` + : `${attribute}.${oper}(${Query.parseValues(value)})`; + Query.parseValues = (value) => typeof value === 'string' || value instanceof String + ? `"${value}"` + : `${value}`; + class AppwriteException extends Error { constructor(message, code = 0, type = '', response = '') { super(message); @@ -36,7 +75,7 @@ this.response = response; } } - class Appwrite { + class Client { constructor() { this.config = { endpoint: 'https://HOSTNAME/v1', @@ -48,7 +87,7 @@ mode: '', }; this.headers = { - 'x-sdk-version': 'appwrite:web:5.0.0', + 'x-sdk-version': 'appwrite:web:6.0.0', 'X-Appwrite-Response-Format': '0.15.0', }; this.realtime = { @@ -178,5841 +217,6 @@ }); } }; - this.account = { - /** - * Get Account - * - * Get currently logged in user data as JSON object. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - get: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Account - * - * Use this endpoint to allow a new user to register a new account in your - * project. After the user registration completes successfully, you can use - * the [/account/verfication](/docs/client/account#accountCreateVerification) - * route to start verifying the user email address. To allow the new user to - * login to their new account, you need to create a new [account - * session](/docs/client/account#accountCreateSession). - * - * @param {string} userId - * @param {string} email - * @param {string} password - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - create: (userId, email, password, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/account'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Email - * - * Update currently logged in user account email address. After changing user - * address, the user confirmation status will get reset. A new confirmation - * email is not sent automatically however you can use the send confirmation - * email endpoint again to send the confirmation email. For security measures, - * user password is required to complete this request. - * This endpoint can also be used to convert an anonymous account to a normal - * one, by passing an email address and a new password. - * - * - * @param {string} email - * @param {string} password - * @throws {AppwriteException} - * @returns {Promise} - */ - updateEmail: (email, password) => __awaiter(this, void 0, void 0, function* () { - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/account/email'; - let payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Account JWT - * - * Use this endpoint to create a JSON Web Token. You can use the resulting JWT - * to authenticate on behalf of the current user when working with the - * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes - * from its creation and will be invalid if the user will logout in that time - * frame. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - createJWT: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/jwt'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Account Logs - * - * Get currently logged in user list of latest security activity logs. Each - * log returns user IP address, location and date and time of log. - * - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - getLogs: (limit, offset) => __awaiter(this, void 0, void 0, function* () { - let path = '/account/logs'; - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Name - * - * Update currently logged in user account name. - * - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - updateName: (name) => __awaiter(this, void 0, void 0, function* () { - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/account/name'; - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Password - * - * Update currently logged in user password. For validation, user is required - * to pass in the new password, and the old password. For users created with - * OAuth, Team Invites and Magic URL, oldPassword is optional. - * - * @param {string} password - * @param {string} oldPassword - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePassword: (password, oldPassword) => __awaiter(this, void 0, void 0, function* () { - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/account/password'; - let payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof oldPassword !== 'undefined') { - payload['oldPassword'] = oldPassword; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Phone - * - * Update currently logged in user account phone number. After changing phone - * number, the user confirmation status will get reset. A new confirmation SMS - * is not sent automatically however you can use the phone confirmation - * endpoint again to send the confirmation SMS. - * - * @param {string} number - * @param {string} password - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePhone: (number, password) => __awaiter(this, void 0, void 0, function* () { - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/account/phone'; - let payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Account Preferences - * - * Get currently logged in user preferences as a key-value object. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getPrefs: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/prefs'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Preferences - * - * Update currently logged in user account preferences. The object you pass is - * stored as is, and replaces any previous value. The maximum allowed prefs - * size is 64kB and throws error if exceeded. - * - * @param {object} prefs - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePrefs: (prefs) => __awaiter(this, void 0, void 0, function* () { - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - let path = '/account/prefs'; - let payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Password Recovery - * - * Sends the user an email with a temporary secret key for password reset. - * When the user clicks the confirmation link he is redirected back to your - * app password reset URL with the secret key and email address values - * attached to the URL query string. Use the query string params to submit a - * request to the [PUT - * /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to - * complete the process. The verification link sent to the user's email - * address is valid for 1 hour. - * - * @param {string} email - * @param {string} url - * @throws {AppwriteException} - * @returns {Promise} - */ - createRecovery: (email, url) => __awaiter(this, void 0, void 0, function* () { - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - let path = '/account/recovery'; - let payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Password Recovery (confirmation) - * - * Use this endpoint to complete the user account password reset. Both the - * **userId** and **secret** arguments will be passed as query parameters to - * the redirect URL you have provided when sending your request to the [POST - * /account/recovery](/docs/client/account#accountCreateRecovery) endpoint. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * @param {string} userId - * @param {string} secret - * @param {string} password - * @param {string} passwordAgain - * @throws {AppwriteException} - * @returns {Promise} - */ - updateRecovery: (userId, secret, password, passwordAgain) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (typeof passwordAgain === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordAgain"'); - } - let path = '/account/recovery'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordAgain !== 'undefined') { - payload['passwordAgain'] = passwordAgain; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Account Sessions - * - * Get currently logged in user list of active sessions across different - * devices. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getSessions: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/sessions'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete All Account Sessions - * - * Delete all sessions from the user account and remove any sessions cookies - * from the end client. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteSessions: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/sessions'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Anonymous Session - * - * Use this endpoint to allow a new user to register an anonymous account in - * your project. This route will also create a new session for the user. To - * allow the new user to convert an anonymous account to a normal account, you - * need to update its [email and - * password](/docs/client/account#accountUpdateEmail) or create an [OAuth2 - * session](/docs/client/account#accountCreateOAuth2Session). - * - * @throws {AppwriteException} - * @returns {Promise} - */ - createAnonymousSession: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/sessions/anonymous'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Account Session with Email - * - * Allow the user to login into their account by providing a valid email and - * password combination. This route will create a new session for the user. - * - * @param {string} email - * @param {string} password - * @throws {AppwriteException} - * @returns {Promise} - */ - createEmailSession: (email, password) => __awaiter(this, void 0, void 0, function* () { - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/account/sessions/email'; - let payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Magic URL session - * - * Sends the user an email with a secret key for creating a session. When the - * user clicks the link in the email, the user is redirected back to the URL - * you provided with the secret key and userId values attached to the URL - * query string. Use the query string parameters to submit a request to the - * [PUT - * /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) - * endpoint to complete the login process. The link sent to the user's email - * address is valid for 1 hour. If you are on a mobile device you can leave - * the URL parameter empty, so that the login completion will be handled by - * your Appwrite instance by default. - * - * @param {string} userId - * @param {string} email - * @param {string} url - * @throws {AppwriteException} - * @returns {Promise} - */ - createMagicURLSession: (userId, email, url) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - let path = '/account/sessions/magic-url'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Magic URL session (confirmation) - * - * Use this endpoint to complete creating the session with the Magic URL. Both - * the **userId** and **secret** arguments will be passed as query parameters - * to the redirect URL you have provided when sending your request to the - * [POST - * /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession) - * endpoint. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * @param {string} userId - * @param {string} secret - * @throws {AppwriteException} - * @returns {Promise} - */ - updateMagicURLSession: (userId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - let path = '/account/sessions/magic-url'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Account Session with OAuth2 - * - * Allow the user to login to their account using the OAuth2 provider of their - * choice. Each OAuth2 provider should be enabled from the Appwrite console - * first. Use the success and failure arguments to provide a redirect URL's - * back to your app when login is completed. - * - * If there is already an active session, the new session will be attached to - * the logged-in account. If there are no active sessions, the server will - * attempt to look for a user with the same email address as the email - * received from the OAuth2 provider and attach the new session to the - * existing user. If no matching user is found - the server will create a new - * user.. - * - * - * @param {string} provider - * @param {string} success - * @param {string} failure - * @param {string[]} scopes - * @throws {AppwriteException} - * @returns {void|string} - */ - createOAuth2Session: (provider, success, failure, scopes) => { - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - let path = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider); - let payload = {}; - if (typeof success !== 'undefined') { - payload['success'] = success; - } - if (typeof failure !== 'undefined') { - payload['failure'] = failure; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) { - window.location.href = uri.toString(); - } - else { - return uri; - } - }, - /** - * Create Phone session - * - * Sends the user a SMS with a secret key for creating a session. Use the - * returned user ID and the secret to submit a request to the [PUT - * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) - * endpoint to complete the login process. The secret sent to the user's phone - * is valid for 15 minutes. - * - * @param {string} userId - * @param {string} number - * @throws {AppwriteException} - * @returns {Promise} - */ - createPhoneSession: (userId, number) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - let path = '/account/sessions/phone'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof number !== 'undefined') { - payload['number'] = number; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Phone session (confirmation) - * - * Use this endpoint to complete creating the session with the Magic URL. Both - * the **userId** and **secret** arguments will be passed as query parameters - * to the redirect URL you have provided when sending your request to the - * [POST - * /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession) - * endpoint. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * @param {string} userId - * @param {string} secret - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePhoneSession: (userId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - let path = '/account/sessions/phone'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Session By ID - * - * Use this endpoint to get a logged in user's session using a Session ID. - * Inputting 'current' will return the current session being used. - * - * @param {string} sessionId - * @throws {AppwriteException} - * @returns {Promise} - */ - getSession: (sessionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Session (Refresh Tokens) - * - * Access tokens have limited lifespan and expire to mitigate security risks. - * If session was created using an OAuth provider, this route can be used to - * "refresh" the access token. - * - * @param {string} sessionId - * @throws {AppwriteException} - * @returns {Promise} - */ - updateSession: (sessionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Account Session - * - * Use this endpoint to log out the currently logged in user from all their - * account sessions across all of their different devices. When using the - * Session ID argument, only the unique session ID provided is deleted. - * - * - * @param {string} sessionId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteSession: (sessionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Account Status - * - * Block the currently logged in user account. Behind the scene, the user - * record is not deleted but permanently blocked from any access. To - * completely delete a user, use the Users API instead. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - updateStatus: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/status'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Email Verification - * - * Use this endpoint to send a verification message to your user email address - * to confirm they are the valid owners of that address. Both the **userId** - * and **secret** arguments will be passed as query parameters to the URL you - * have provided to be attached to the verification email. The provided URL - * should redirect the user back to your app and allow you to complete the - * verification process by verifying both the **userId** and **secret** - * parameters. Learn more about how to [complete the verification - * process](/docs/client/account#accountUpdateEmailVerification). The - * verification link sent to the user's email address is valid for 7 days. - * - * Please note that in order to avoid a [Redirect - * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), - * the only valid redirect URLs are the ones from domains you have set when - * adding your platforms in the console interface. - * - * - * @param {string} url - * @throws {AppwriteException} - * @returns {Promise} - */ - createVerification: (url) => __awaiter(this, void 0, void 0, function* () { - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - let path = '/account/verification'; - let payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Email Verification (confirmation) - * - * Use this endpoint to complete the user email verification process. Use both - * the **userId** and **secret** parameters that were attached to your app URL - * to verify the user email ownership. If confirmed this route will return a - * 200 status code. - * - * @param {string} userId - * @param {string} secret - * @throws {AppwriteException} - * @returns {Promise} - */ - updateVerification: (userId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - let path = '/account/verification'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Phone Verification - * - * Use this endpoint to send a verification message to your user's phone - * number to confirm they are the valid owners of that address. The provided - * secret should allow you to complete the verification process by verifying - * both the **userId** and **secret** parameters. Learn more about how to - * [complete the verification - * process](/docs/client/account#accountUpdatePhoneVerification). The - * verification link sent to the user's phone number is valid for 15 minutes. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - createPhoneVerification: () => __awaiter(this, void 0, void 0, function* () { - let path = '/account/verification/phone'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Phone Verification (confirmation) - * - * Use this endpoint to complete the user phone verification process. Use the - * **userId** and **secret** that were sent to your user's phone number to - * verify the user email ownership. If confirmed this route will return a 200 - * status code. - * - * @param {string} userId - * @param {string} secret - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePhoneVerification: (userId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - let path = '/account/verification/phone'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.avatars = { - /** - * 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](/docs/client/account#accountGetSessions) 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 {string} code - * @param {number} width - * @param {number} height - * @param {number} quality - * @throws {AppwriteException} - * @returns {URL} - */ - getBrowser: (code, width, height, quality) => { - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - let path = '/avatars/browsers/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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 {string} code - * @param {number} width - * @param {number} height - * @param {number} quality - * @throws {AppwriteException} - * @returns {URL} - */ - getCreditCard: (code, width, height, quality) => { - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - let path = '/avatars/credit-cards/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * Get Favicon - * - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote - * website URL. - * - * - * @param {string} url - * @throws {AppwriteException} - * @returns {URL} - */ - getFavicon: (url) => { - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - let path = '/avatars/favicon'; - let payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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. - * - * 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} code - * @param {number} width - * @param {number} height - * @param {number} quality - * @throws {AppwriteException} - * @returns {URL} - */ - getFlag: (code, width, height, quality) => { - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - let path = '/avatars/flags/{code}'.replace('{code}', code); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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. - * - * - * @param {string} url - * @param {number} width - * @param {number} height - * @throws {AppwriteException} - * @returns {URL} - */ - getImage: (url, width, height) => { - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - let path = '/avatars/image'; - let payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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 '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 - * @param {number} width - * @param {number} height - * @param {string} color - * @param {string} background - * @throws {AppwriteException} - * @returns {URL} - */ - getInitials: (name, width, height, color, background) => { - let path = '/avatars/initials'; - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof color !== 'undefined') { - payload['color'] = color; - } - if (typeof background !== 'undefined') { - payload['background'] = background; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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 {URL} - */ - getQR: (text, size, margin, download) => { - if (typeof text === 'undefined') { - throw new AppwriteException('Missing required parameter: "text"'); - } - let path = '/avatars/qr'; - let payload = {}; - if (typeof text !== 'undefined') { - payload['text'] = text; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof margin !== 'undefined') { - payload['margin'] = margin; - } - if (typeof download !== 'undefined') { - payload['download'] = download; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - } - }; - this.databases = { - /** - * List Databases - * - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - list: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/databases'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Database - * - * - * @param {string} databaseId - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - create: (databaseId, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/databases'; - let payload = {}; - if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for the database - * - * - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage: (range) => __awaiter(this, void 0, void 0, function* () { - let path = '/databases/usage'; - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Database - * - * - * @param {string} databaseId - * @throws {AppwriteException} - * @returns {Promise} - */ - get: (databaseId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Database - * - * - * @param {string} databaseId - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - update: (databaseId, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Database - * - * - * @param {string} databaseId - * @throws {AppwriteException} - * @returns {Promise} - */ - delete: (databaseId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Collections - * - * Get a list of all the user collections. You can use the query params to - * filter your results. On admin mode, this endpoint will return a list of all - * of the project's collections. [Learn more about different API - * modes](/docs/admin). - * - * @param {string} databaseId - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - listCollections: (databaseId, search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Collection - * - * Create a new Collection. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} name - * @param {string} permission - * @param {string[]} read - * @param {string[]} write - * @throws {AppwriteException} - * @returns {Promise} - */ - createCollection: (databaseId, collectionId, name, permission, read, write) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof permission === 'undefined') { - throw new AppwriteException('Missing required parameter: "permission"'); - } - if (typeof read === 'undefined') { - throw new AppwriteException('Missing required parameter: "read"'); - } - if (typeof write === 'undefined') { - throw new AppwriteException('Missing required parameter: "write"'); - } - let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); - let payload = {}; - if (typeof collectionId !== 'undefined') { - payload['collectionId'] = collectionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permission !== 'undefined') { - payload['permission'] = permission; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Collection - * - * Get a collection by its unique ID. This endpoint response returns a JSON - * object with the collection metadata. - * - * @param {string} databaseId - * @param {string} collectionId - * @throws {AppwriteException} - * @returns {Promise} - */ - getCollection: (databaseId, collectionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Collection - * - * Update a collection by its unique ID. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} name - * @param {string} permission - * @param {string[]} read - * @param {string[]} write - * @param {boolean} enabled - * @throws {AppwriteException} - * @returns {Promise} - */ - updateCollection: (databaseId, collectionId, name, permission, read, write, enabled) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof permission === 'undefined') { - throw new AppwriteException('Missing required parameter: "permission"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permission !== 'undefined') { - payload['permission'] = permission; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Collection - * - * Delete a collection by its unique ID. Only users with write permissions - * have access to delete this resource. - * - * @param {string} databaseId - * @param {string} collectionId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteCollection: (databaseId, collectionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Attributes - * - * - * @param {string} databaseId - * @param {string} collectionId - * @throws {AppwriteException} - * @returns {Promise} - */ - listAttributes: (databaseId, collectionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Boolean Attribute - * - * Create a boolean attribute. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {boolean} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createBooleanAttribute: (databaseId, collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Email Attribute - * - * Create an email attribute. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createEmailAttribute: (databaseId, collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Enum Attribute - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {string[]} elements - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createEnumAttribute: (databaseId, collectionId, key, elements, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Float Attribute - * - * Create a float attribute. Optionally, minimum and maximum values can be - * provided. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {number} min - * @param {number} max - * @param {number} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createFloatAttribute: (databaseId, collectionId, key, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Integer Attribute - * - * Create an integer attribute. Optionally, minimum and maximum values can be - * provided. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {number} min - * @param {number} max - * @param {number} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createIntegerAttribute: (databaseId, collectionId, key, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create IP Address Attribute - * - * Create IP address attribute. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createIpAttribute: (databaseId, collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create String Attribute - * - * Create a string attribute. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {number} size - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createStringAttribute: (databaseId, collectionId, key, size, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create URL Attribute - * - * Create a URL attribute. - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {boolean} required - * @param {string} xdefault - * @param {boolean} array - * @throws {AppwriteException} - * @returns {Promise} - */ - createUrlAttribute: (databaseId, collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Attribute - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise} - */ - getAttribute: (databaseId, collectionId, key) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Attribute - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteAttribute: (databaseId, collectionId, key) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Documents - * - * Get a list of all the user documents. You can use the query params to - * filter your results. On admin mode, this endpoint will return a list of all - * of the project's documents. [Learn more about different API - * modes](/docs/admin). - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string[]} queries - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string[]} orderAttributes - * @param {string[]} orderTypes - * @throws {AppwriteException} - * @returns {Promise} - */ - listDocuments: (databaseId, collectionId, queries, limit, offset, cursor, cursorDirection, orderAttributes, orderTypes) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderAttributes !== 'undefined') { - payload['orderAttributes'] = orderAttributes; - } - if (typeof orderTypes !== 'undefined') { - payload['orderTypes'] = orderTypes; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Document - * - * Create a new Document. Before using this route, you should create a new - * collection resource using either a [server - * integration](/docs/server/database#databaseCreateCollection) API or - * directly from your database console. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} documentId - * @param {object} data - * @param {string[]} read - * @param {string[]} write - * @throws {AppwriteException} - * @returns {Promise} - */ - createDocument: (databaseId, collectionId, documentId, data, read, write) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof documentId !== 'undefined') { - payload['documentId'] = documentId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Document - * - * Get a document by its unique ID. This endpoint response returns a JSON - * object with the document data. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} documentId - * @throws {AppwriteException} - * @returns {Promise} - */ - getDocument: (databaseId, collectionId, documentId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Document - * - * Update a document by its unique ID. Using the patch method you can pass - * only specific fields that will get updated. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} documentId - * @param {object} data - * @param {string[]} read - * @param {string[]} write - * @throws {AppwriteException} - * @returns {Promise} - */ - updateDocument: (databaseId, collectionId, documentId, data, read, write) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - let payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Document - * - * Delete a document by its unique ID. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} documentId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteDocument: (databaseId, collectionId, documentId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Document Logs - * - * Get the document activity logs list by its unique ID. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} documentId - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - listDocumentLogs: (databaseId, collectionId, documentId, limit, offset) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Indexes - * - * - * @param {string} databaseId - * @param {string} collectionId - * @throws {AppwriteException} - * @returns {Promise} - */ - listIndexes: (databaseId, collectionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Index - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @param {string} type - * @param {string[]} attributes - * @param {string[]} orders - * @throws {AppwriteException} - * @returns {Promise} - */ - createIndex: (databaseId, collectionId, key, type, attributes, orders) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof attributes === 'undefined') { - throw new AppwriteException('Missing required parameter: "attributes"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Index - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise} - */ - getIndex: (databaseId, collectionId, key) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Index - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} key - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteIndex: (databaseId, collectionId, key) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Collection Logs - * - * Get the collection activity logs list by its unique ID. - * - * @param {string} databaseId - * @param {string} collectionId - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - listCollectionLogs: (databaseId, collectionId, limit, offset) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for a collection - * - * - * @param {string} databaseId - * @param {string} collectionId - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getCollectionUsage: (databaseId, collectionId, range) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - let path = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Collection Logs - * - * Get the collection activity logs list by its unique ID. - * - * @param {string} databaseId - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - listLogs: (databaseId, limit, offset) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - let path = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for the database - * - * - * @param {string} databaseId - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getDatabaseUsage: (databaseId, range) => __awaiter(this, void 0, void 0, function* () { - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - let path = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId); - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.functions = { - /** - * List Functions - * - * Get a list of all the project's functions. You can use the query params to - * filter your results. - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - list: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/functions'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Function - * - * Create a new function. You can pass a list of - * [permissions](/docs/permissions) to allow different project users or team - * with access to execute the function using the client API. - * - * @param {string} functionId - * @param {string} name - * @param {string[]} execute - * @param {string} runtime - * @param {object} vars - * @param {string[]} events - * @param {string} schedule - * @param {number} timeout - * @throws {AppwriteException} - * @returns {Promise} - */ - create: (functionId, name, execute, runtime, vars, events, schedule, timeout) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof execute === 'undefined') { - throw new AppwriteException('Missing required parameter: "execute"'); - } - if (typeof runtime === 'undefined') { - throw new AppwriteException('Missing required parameter: "runtime"'); - } - let path = '/functions'; - let payload = {}; - if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; - } - if (typeof vars !== 'undefined') { - payload['vars'] = vars; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List runtimes - * - * Get a list of all runtimes that are currently active on your instance. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - listRuntimes: () => __awaiter(this, void 0, void 0, function* () { - let path = '/functions/runtimes'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Function - * - * Get a function by its unique ID. - * - * @param {string} functionId - * @throws {AppwriteException} - * @returns {Promise} - */ - get: (functionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}'.replace('{functionId}', functionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Function - * - * Update function by its unique ID. - * - * @param {string} functionId - * @param {string} name - * @param {string[]} execute - * @param {object} vars - * @param {string[]} events - * @param {string} schedule - * @param {number} timeout - * @throws {AppwriteException} - * @returns {Promise} - */ - update: (functionId, name, execute, vars, events, schedule, timeout) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof execute === 'undefined') { - throw new AppwriteException('Missing required parameter: "execute"'); - } - let path = '/functions/{functionId}'.replace('{functionId}', functionId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof vars !== 'undefined') { - payload['vars'] = vars; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Function - * - * Delete a function by its unique ID. - * - * @param {string} functionId - * @throws {AppwriteException} - * @returns {Promise} - */ - delete: (functionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}'.replace('{functionId}', functionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Deployments - * - * Get a list of all the project's code deployments. You can use the query - * params to filter your results. - * - * @param {string} functionId - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - listDeployments: (functionId, search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create 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](/docs/functions). - * - * Use the "command" param to set the entry point used to execute your code. - * - * @param {string} functionId - * @param {string} entrypoint - * @param {File} code - * @param {boolean} activate - * @throws {AppwriteException} - * @returns {Promise} - */ - createDeployment: (functionId, entrypoint, code, activate, onProgress = (progress) => { }) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof entrypoint === 'undefined') { - throw new AppwriteException('Missing required parameter: "entrypoint"'); - } - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } - let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - let payload = {}; - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof code !== 'undefined') { - payload['code'] = code; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.config.endpoint + path); - if (!(code instanceof File)) { - throw new AppwriteException('Parameter "code" has to be a File.'); - } - const size = code.size; - if (size <= Appwrite.CHUNK_SIZE) { - return yield this.call('post', uri, { - 'content-type': 'multipart/form-data', - }, payload); - } - let id = undefined; - let response = undefined; - const headers = { - 'content-type': 'multipart/form-data', - }; - let counter = 0; - const totalCounters = Math.ceil(size / Appwrite.CHUNK_SIZE); - for (counter; counter < totalCounters; counter++) { - const start = (counter * Appwrite.CHUNK_SIZE); - const end = Math.min((((counter * Appwrite.CHUNK_SIZE) + Appwrite.CHUNK_SIZE) - 1), size); - headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; - if (id) { - headers['x-appwrite-id'] = id; - } - const stream = code.slice(start, end + 1); - payload['code'] = new File([stream], code.name); - response = yield this.call('post', uri, headers, payload); - if (!id) { - id = response['$id']; - } - if (onProgress) { - onProgress({ - $id: response.$id, - progress: Math.min((counter + 1) * Appwrite.CHUNK_SIZE - 1, size) / size * 100, - sizeUploaded: end, - chunksTotal: response.chunksTotal, - chunksUploaded: response.chunksUploaded - }); - } - } - return response; - }), - /** - * Get Deployment - * - * Get a code deployment by its unique ID. - * - * @param {string} functionId - * @param {string} deploymentId - * @throws {AppwriteException} - * @returns {Promise} - */ - getDeployment: (functionId, deploymentId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Function Deployment - * - * Update the function code deployment ID using the unique function ID. Use - * this endpoint to switch the code deployment that should be executed by the - * execution endpoint. - * - * @param {string} functionId - * @param {string} deploymentId - * @throws {AppwriteException} - * @returns {Promise} - */ - updateDeployment: (functionId, deploymentId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Deployment - * - * Delete a code deployment by its unique ID. - * - * @param {string} functionId - * @param {string} deploymentId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteDeployment: (functionId, deploymentId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Retry Build - * - * - * @param {string} functionId - * @param {string} deploymentId - * @param {string} buildId - * @throws {AppwriteException} - * @returns {Promise} - */ - retryBuild: (functionId, deploymentId, buildId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - if (typeof buildId === 'undefined') { - throw new AppwriteException('Missing required parameter: "buildId"'); - } - let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Executions - * - * Get a list of all the current user function execution logs. You can use the - * query params to filter your results. On admin mode, this endpoint will - * return a list of all of the project's executions. [Learn more about - * different API modes](/docs/admin). - * - * @param {string} functionId - * @param {number} limit - * @param {number} offset - * @param {string} search - * @param {string} cursor - * @param {string} cursorDirection - * @throws {AppwriteException} - * @returns {Promise} - */ - listExecutions: (functionId, limit, offset, search, cursor, cursorDirection) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create 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 - * @param {string} data - * @param {boolean} async - * @throws {AppwriteException} - * @returns {Promise} - */ - createExecution: (functionId, data, async) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - let payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof async !== 'undefined') { - payload['async'] = async; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Execution - * - * Get a function execution log by its unique ID. - * - * @param {string} functionId - * @param {string} executionId - * @throws {AppwriteException} - * @returns {Promise} - */ - getExecution: (functionId, executionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Function Usage - * - * - * @param {string} functionId - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage: (functionId, range) => __awaiter(this, void 0, void 0, function* () { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - let path = '/functions/{functionId}/usage'.replace('{functionId}', functionId); - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.health = { - /** - * Get HTTP - * - * Check the Appwrite HTTP server is up and responsive. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - get: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Antivirus - * - * Check the Appwrite Antivirus server is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getAntivirus: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/anti-virus'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Cache - * - * Check the Appwrite in-memory cache server is up and connection is - * successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getCache: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/cache'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get DB - * - * Check the Appwrite database server is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getDB: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/db'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueCertificates: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/queue/certificates'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Functions Queue - * - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueFunctions: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/queue/functions'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Logs Queue - * - * Get the number of logs that are waiting to be processed in the Appwrite - * internal queue server. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueLogs: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/queue/logs'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Webhooks Queue - * - * Get the number of webhooks that are waiting to be processed in the Appwrite - * internal queue server. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getQueueWebhooks: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/queue/webhooks'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Local Storage - * - * Check the Appwrite local storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getStorageLocal: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/storage/local'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getTime: () => __awaiter(this, void 0, void 0, function* () { - let path = '/health/time'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.locale = { - /** - * 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} - */ - get: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Continents - * - * List of all continents. You can use the locale header to get the data in a - * supported language. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getContinents: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/continents'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Countries - * - * List of all countries. You can use the locale header to get the data in a - * supported language. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getCountries: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/countries'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getCountriesEU: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/countries/eu'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getCountriesPhones: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/countries/phones'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getCurrencies: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/currencies'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getLanguages: () => __awaiter(this, void 0, void 0, function* () { - let path = '/locale/languages'; - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.projects = { - /** - * List Projects - * - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - list: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/projects'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Project - * - * - * @param {string} projectId - * @param {string} name - * @param {string} teamId - * @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} - */ - create: (projectId, name, teamId, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects'; - let payload = {}; - if (typeof projectId !== 'undefined') { - payload['projectId'] = projectId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - 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.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Project - * - * - * @param {string} projectId - * @throws {AppwriteException} - * @returns {Promise} - */ - get: (projectId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}'.replace('{projectId}', projectId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, 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} - */ - update: (projectId, name, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/projects/{projectId}'.replace('{projectId}', projectId); - let 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.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Project - * - * - * @param {string} projectId - * @param {string} password - * @throws {AppwriteException} - * @returns {Promise} - */ - delete: (projectId, password) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/projects/{projectId}'.replace('{projectId}', projectId); - let payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Project users limit - * - * - * @param {string} projectId - * @param {number} limit - * @throws {AppwriteException} - * @returns {Promise} - */ - updateAuthLimit: (projectId, limit) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof limit === 'undefined') { - throw new AppwriteException('Missing required parameter: "limit"'); - } - let path = '/projects/{projectId}/auth/limit'.replace('{projectId}', projectId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project. - * - * - * @param {string} projectId - * @param {string} method - * @param {boolean} status - * @throws {AppwriteException} - * @returns {Promise} - */ - updateAuthStatus: (projectId, method, status) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method); - let payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Domains - * - * - * @param {string} projectId - * @throws {AppwriteException} - * @returns {Promise} - */ - listDomains: (projectId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}/domains'.replace('{projectId}', projectId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Domain - * - * - * @param {string} projectId - * @param {string} domain - * @throws {AppwriteException} - * @returns {Promise} - */ - createDomain: (projectId, domain) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - let path = '/projects/{projectId}/domains'.replace('{projectId}', projectId); - let payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Domain - * - * - * @param {string} projectId - * @param {string} domainId - * @throws {AppwriteException} - * @returns {Promise} - */ - getDomain: (projectId, domainId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof domainId === 'undefined') { - throw new AppwriteException('Missing required parameter: "domainId"'); - } - let path = '/projects/{projectId}/domains/{domainId}'.replace('{projectId}', projectId).replace('{domainId}', domainId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Domain - * - * - * @param {string} projectId - * @param {string} domainId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteDomain: (projectId, domainId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof domainId === 'undefined') { - throw new AppwriteException('Missing required parameter: "domainId"'); - } - let path = '/projects/{projectId}/domains/{domainId}'.replace('{projectId}', projectId).replace('{domainId}', domainId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Domain Verification Status - * - * - * @param {string} projectId - * @param {string} domainId - * @throws {AppwriteException} - * @returns {Promise} - */ - updateDomainVerification: (projectId, domainId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof domainId === 'undefined') { - throw new AppwriteException('Missing required parameter: "domainId"'); - } - let path = '/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}', projectId).replace('{domainId}', domainId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Keys - * - * - * @param {string} projectId - * @throws {AppwriteException} - * @returns {Promise} - */ - listKeys: (projectId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Key - * - * - * @param {string} projectId - * @param {string} name - * @param {string[]} scopes - * @param {number} expire - * @throws {AppwriteException} - * @returns {Promise} - */ - createKey: (projectId, name, scopes, expire) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId); - let 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.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Key - * - * - * @param {string} projectId - * @param {string} keyId - * @throws {AppwriteException} - * @returns {Promise} - */ - getKey: (projectId, keyId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Key - * - * - * @param {string} projectId - * @param {string} keyId - * @param {string} name - * @param {string[]} scopes - * @param {number} expire - * @throws {AppwriteException} - * @returns {Promise} - */ - updateKey: (projectId, keyId, name, scopes, expire) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - let 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.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Key - * - * - * @param {string} projectId - * @param {string} keyId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteKey: (projectId, keyId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Project OAuth2 - * - * - * @param {string} projectId - * @param {string} provider - * @param {string} appId - * @param {string} secret - * @throws {AppwriteException} - * @returns {Promise} - */ - updateOAuth2: (projectId, provider, appId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - let path = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId); - let payload = {}; - if (typeof provider !== 'undefined') { - payload['provider'] = provider; - } - if (typeof appId !== 'undefined') { - payload['appId'] = appId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Platforms - * - * - * @param {string} projectId - * @throws {AppwriteException} - * @returns {Promise} - */ - listPlatforms: (projectId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Platform - * - * - * @param {string} projectId - * @param {string} type - * @param {string} name - * @param {string} key - * @param {string} store - * @param {string} hostname - * @throws {AppwriteException} - * @returns {Promise} - */ - createPlatform: (projectId, type, name, key, store, hostname) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); - let 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.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Platform - * - * - * @param {string} projectId - * @param {string} platformId - * @throws {AppwriteException} - * @returns {Promise} - */ - getPlatform: (projectId, platformId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, 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} - */ - updatePlatform: (projectId, platformId, name, key, store, hostname) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - let 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.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Platform - * - * - * @param {string} projectId - * @param {string} platformId - * @throws {AppwriteException} - * @returns {Promise} - */ - deletePlatform: (projectId, platformId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update service status - * - * - * @param {string} projectId - * @param {string} service - * @param {boolean} status - * @throws {AppwriteException} - * @returns {Promise} - */ - updateServiceStatus: (projectId, service, status) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/service'.replace('{projectId}', projectId); - let payload = {}; - if (typeof service !== 'undefined') { - payload['service'] = service; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for a project - * - * - * @param {string} projectId - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage: (projectId, range) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId); - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Webhooks - * - * - * @param {string} projectId - * @throws {AppwriteException} - * @returns {Promise} - */ - listWebhooks: (projectId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - let path = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Webhook - * - * - * @param {string} projectId - * @param {string} name - * @param {string[]} events - * @param {string} url - * @param {boolean} security - * @param {string} httpUser - * @param {string} httpPass - * @throws {AppwriteException} - * @returns {Promise} - */ - createWebhook: (projectId, name, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Webhook - * - * - * @param {string} projectId - * @param {string} webhookId - * @throws {AppwriteException} - * @returns {Promise} - */ - getWebhook: (projectId, webhookId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Webhook - * - * - * @param {string} projectId - * @param {string} webhookId - * @param {string} name - * @param {string[]} events - * @param {string} url - * @param {boolean} security - * @param {string} httpUser - * @param {string} httpPass - * @throws {AppwriteException} - * @returns {Promise} - */ - updateWebhook: (projectId, webhookId, name, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () { - 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"'); - } - let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - 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.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Webhook - * - * - * @param {string} projectId - * @param {string} webhookId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteWebhook: (projectId, webhookId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Webhook Signature Key - * - * - * @param {string} projectId - * @param {string} webhookId - * @throws {AppwriteException} - * @returns {Promise} - */ - updateWebhookSignature: (projectId, webhookId) => __awaiter(this, void 0, void 0, function* () { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - let path = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.storage = { - /** - * List buckets - * - * Get a list of all the storage buckets. You can use the query params to - * filter your results. - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - listBuckets: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/storage/buckets'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create bucket - * - * Create a new storage bucket. - * - * @param {string} bucketId - * @param {string} name - * @param {string} permission - * @param {string[]} read - * @param {string[]} write - * @param {boolean} enabled - * @param {number} maximumFileSize - * @param {string[]} allowedFileExtensions - * @param {boolean} encryption - * @param {boolean} antivirus - * @throws {AppwriteException} - * @returns {Promise} - */ - createBucket: (bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof permission === 'undefined') { - throw new AppwriteException('Missing required parameter: "permission"'); - } - let path = '/storage/buckets'; - let payload = {}; - if (typeof bucketId !== 'undefined') { - payload['bucketId'] = bucketId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permission !== 'undefined') { - payload['permission'] = permission; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - getBucket: (bucketId) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Bucket - * - * Update a storage bucket by its unique ID. - * - * @param {string} bucketId - * @param {string} name - * @param {string} permission - * @param {string[]} read - * @param {string[]} write - * @param {boolean} enabled - * @param {number} maximumFileSize - * @param {string[]} allowedFileExtensions - * @param {boolean} encryption - * @param {boolean} antivirus - * @throws {AppwriteException} - * @returns {Promise} - */ - updateBucket: (bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof permission === 'undefined') { - throw new AppwriteException('Missing required parameter: "permission"'); - } - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permission !== 'undefined') { - payload['permission'] = permission; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete Bucket - * - * Delete a storage bucket by its unique ID. - * - * @param {string} bucketId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteBucket: (bucketId) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Files - * - * Get a list of all the user files. You can use the query params to filter - * your results. On admin mode, this endpoint will return a list of all of the - * project's files. [Learn more about different API modes](/docs/admin). - * - * @param {string} bucketId - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - listFiles: (bucketId, search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create File - * - * Create a new file. Before using this route, you should create a new bucket - * resource using either a [server - * integration](/docs/server/database#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 - * @param {string} fileId - * @param {File} file - * @param {string[]} read - * @param {string[]} write - * @throws {AppwriteException} - * @returns {Promise} - */ - createFile: (bucketId, fileId, file, read, write, onProgress = (progress) => { }) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - if (typeof file === 'undefined') { - throw new AppwriteException('Missing required parameter: "file"'); - } - let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); - let payload = {}; - if (typeof fileId !== 'undefined') { - payload['fileId'] = fileId; - } - if (typeof file !== 'undefined') { - payload['file'] = file; - } - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - const uri = new URL(this.config.endpoint + path); - if (!(file instanceof File)) { - throw new AppwriteException('Parameter "file" has to be a File.'); - } - const size = file.size; - if (size <= Appwrite.CHUNK_SIZE) { - return yield this.call('post', uri, { - 'content-type': 'multipart/form-data', - }, payload); - } - let id = undefined; - let response = undefined; - const headers = { - 'content-type': 'multipart/form-data', - }; - let counter = 0; - const totalCounters = Math.ceil(size / Appwrite.CHUNK_SIZE); - if (fileId != 'unique()') { - try { - response = yield this.call('GET', new URL(this.config.endpoint + path + '/' + fileId), headers); - counter = response.chunksUploaded; - } - catch (e) { - } - } - for (counter; counter < totalCounters; counter++) { - const start = (counter * Appwrite.CHUNK_SIZE); - const end = Math.min((((counter * Appwrite.CHUNK_SIZE) + Appwrite.CHUNK_SIZE) - 1), size); - headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; - if (id) { - headers['x-appwrite-id'] = id; - } - const stream = file.slice(start, end + 1); - payload['file'] = new File([stream], file.name); - response = yield this.call('post', uri, headers, payload); - if (!id) { - id = response['$id']; - } - if (onProgress) { - onProgress({ - $id: response.$id, - progress: Math.min((counter + 1) * Appwrite.CHUNK_SIZE - 1, size) / size * 100, - sizeUploaded: end, - chunksTotal: response.chunksTotal, - chunksUploaded: response.chunksUploaded - }); - } - } - return response; - }), - /** - * 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} - */ - getFile: (bucketId, fileId) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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[]} read - * @param {string[]} write - * @throws {AppwriteException} - * @returns {Promise} - */ - updateFile: (bucketId, fileId, read, write) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - if (typeof read !== 'undefined') { - payload['read'] = read; - } - if (typeof write !== 'undefined') { - payload['write'] = write; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - deleteFile: (bucketId, fileId) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get File for Download - * - * 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. - * - * @param {string} bucketId - * @param {string} fileId - * @throws {AppwriteException} - * @returns {URL} - */ - getFileDownload: (bucketId, fileId) => { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * 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 {string} gravity - * @param {number} quality - * @param {number} borderWidth - * @param {string} borderColor - * @param {number} borderRadius - * @param {number} opacity - * @param {number} rotation - * @param {string} background - * @param {string} output - * @throws {AppwriteException} - * @returns {URL} - */ - 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"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof gravity !== 'undefined') { - payload['gravity'] = gravity; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (typeof borderWidth !== 'undefined') { - payload['borderWidth'] = borderWidth; - } - if (typeof borderColor !== 'undefined') { - payload['borderColor'] = borderColor; - } - if (typeof borderRadius !== 'undefined') { - payload['borderRadius'] = borderRadius; - } - if (typeof opacity !== 'undefined') { - payload['opacity'] = opacity; - } - if (typeof rotation !== 'undefined') { - payload['rotation'] = rotation; - } - if (typeof background !== 'undefined') { - payload['background'] = background; - } - if (typeof output !== 'undefined') { - payload['output'] = output; - } - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * Get File for View - * - * 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 - * @param {string} fileId - * @throws {AppwriteException} - * @returns {URL} - */ - getFileView: (bucketId, fileId) => { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - let path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - payload['project'] = this.config.project; - for (const [key, value] of Object.entries(this.flatten(payload))) { - uri.searchParams.append(key, value); - } - return uri; - }, - /** - * Get usage stats for storage - * - * - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage: (range) => __awaiter(this, void 0, void 0, function* () { - let path = '/storage/usage'; - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for a storage bucket - * - * - * @param {string} bucketId - * @param {string} range - * @throws {AppwriteException} - * @returns {Promise} - */ - getBucketUsage: (bucketId, range) => __awaiter(this, void 0, void 0, function* () { - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - let path = '/storage/{bucketId}/usage'.replace('{bucketId}', bucketId); - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.teams = { - /** - * 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. - * - * In admin mode, this endpoint returns a list of all the teams in the current - * project. [Learn more about different API modes](/docs/admin). - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - list: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/teams'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - create: (teamId, name, roles) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/teams'; - let payload = {}; - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Team - * - * Get a team by its ID. All team members have read access for this resource. - * - * @param {string} teamId - * @throws {AppwriteException} - * @returns {Promise} - */ - get: (teamId) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - let path = '/teams/{teamId}'.replace('{teamId}', teamId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Team - * - * Update a team using its ID. Only members with the owner role can update the - * team. - * - * @param {string} teamId - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - update: (teamId, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/teams/{teamId}'.replace('{teamId}', teamId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('put', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - delete: (teamId) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - let path = '/teams/{teamId}'.replace('{teamId}', teamId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * List Team Logs - * - * Get the team activity logs list by its unique ID. - * - * @param {string} teamId - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - listLogs: (teamId, limit, offset) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Team Memberships - * - * Use this endpoint to list a team's members using the team's ID. All team - * members have read access to this endpoint. - * - * @param {string} teamId - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - getMemberships: (teamId, search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create Team Membership - * - * Invite a new member to join your team. If initiated from the client SDK, an - * email with a link to join the team will be sent to the member's email - * address and an account will be created for them should they not be signed - * up already. If initiated from server-side SDKs, the new member will - * automatically be added to the team. - * - * Use the 'url' parameter to redirect the user from the invitation email back - * to your app. When the user is redirected, use the [Update Team Membership - * Status](/docs/client/teams#teamsUpdateMembershipStatus) 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) - * the only valid redirect URL's are the once from domains you have set when - * adding your platforms in the console interface. - * - * @param {string} teamId - * @param {string} email - * @param {string[]} roles - * @param {string} url - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - createMembership: (teamId, email, roles, url, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof roles === 'undefined') { - throw new AppwriteException('Missing required parameter: "roles"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); - let payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get Team Membership - * - * Get a team member by the membership unique id. All team members have read - * access for this resource. - * - * @param {string} teamId - * @param {string} membershipId - * @throws {AppwriteException} - * @returns {Promise} - */ - getMembership: (teamId, membershipId) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Membership Roles - * - * 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](/docs/permissions). - * - * @param {string} teamId - * @param {string} membershipId - * @param {string[]} roles - * @throws {AppwriteException} - * @returns {Promise} - */ - updateMembershipRoles: (teamId, membershipId, roles) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (typeof roles === 'undefined') { - throw new AppwriteException('Missing required parameter: "roles"'); - } - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - let payload = {}; - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - deleteMembership: (teamId, membershipId) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * 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} - */ - updateMembershipStatus: (teamId, membershipId, userId, secret) => __awaiter(this, void 0, void 0, function* () { - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; - this.users = { - /** - * List Users - * - * Get a list of all the project's users. You can use the query params to - * filter your results. - * - * @param {string} search - * @param {number} limit - * @param {number} offset - * @param {string} cursor - * @param {string} cursorDirection - * @param {string} orderType - * @throws {AppwriteException} - * @returns {Promise} - */ - list: (search, limit, offset, cursor, cursorDirection, orderType) => __awaiter(this, void 0, void 0, function* () { - let path = '/users'; - let payload = {}; - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - if (typeof cursor !== 'undefined') { - payload['cursor'] = cursor; - } - if (typeof cursorDirection !== 'undefined') { - payload['cursorDirection'] = cursorDirection; - } - if (typeof orderType !== 'undefined') { - payload['orderType'] = orderType; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Create User - * - * Create a new user. - * - * @param {string} userId - * @param {string} email - * @param {string} password - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - create: (userId, email, password, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/users'; - let payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('post', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get usage stats for the users API - * - * - * @param {string} range - * @param {string} provider - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage: (range, provider) => __awaiter(this, void 0, void 0, function* () { - let path = '/users/usage'; - let payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - if (typeof provider !== 'undefined') { - payload['provider'] = provider; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get User - * - * Get a user by its unique ID. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - get: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete User - * - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is - * released and can be reused, all user-related resources like documents or - * storage files should be deleted before user deletion. If you want to keep - * ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus) - * endpoint instead. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - delete: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Email - * - * Update the user email by its unique ID. - * - * @param {string} userId - * @param {string} email - * @throws {AppwriteException} - * @returns {Promise} - */ - updateEmail: (userId, email) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - let path = '/users/{userId}/email'.replace('{userId}', userId); - let payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get User Logs - * - * Get the user activity logs list by its unique ID. - * - * @param {string} userId - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - getLogs: (userId, limit, offset) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}/logs'.replace('{userId}', userId); - let payload = {}; - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get User Memberships - * - * Get the user membership list by its unique ID. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - getMemberships: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}/memberships'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Name - * - * Update the user name by its unique ID. - * - * @param {string} userId - * @param {string} name - * @throws {AppwriteException} - * @returns {Promise} - */ - updateName: (userId, name) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - let path = '/users/{userId}/name'.replace('{userId}', userId); - let payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Password - * - * Update the user password by its unique ID. - * - * @param {string} userId - * @param {string} password - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePassword: (userId, password) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - let path = '/users/{userId}/password'.replace('{userId}', userId); - let payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Phone - * - * Update the user phone by its unique ID. - * - * @param {string} userId - * @param {string} number - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePhone: (userId, number) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - let path = '/users/{userId}/phone'.replace('{userId}', userId); - let payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get User Preferences - * - * Get the user preferences by its unique ID. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - getPrefs: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}/prefs'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update User Preferences - * - * Update the user 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 error if exceeded. - * - * @param {string} userId - * @param {object} prefs - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePrefs: (userId, prefs) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - let path = '/users/{userId}/prefs'.replace('{userId}', userId); - let payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Get User Sessions - * - * Get the user sessions list by its unique ID. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - getSessions: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}/sessions'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('get', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete User Sessions - * - * Delete all user's sessions by using the user's unique ID. - * - * @param {string} userId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteSessions: (userId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - let path = '/users/{userId}/sessions'.replace('{userId}', userId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Delete User Session - * - * Delete a user sessions by its unique ID. - * - * @param {string} userId - * @param {string} sessionId - * @throws {AppwriteException} - * @returns {Promise} - */ - deleteSession: (userId, sessionId) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); - let payload = {}; - const uri = new URL(this.config.endpoint + path); - return yield this.call('delete', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update User Status - * - * Update the user status by its unique ID. Use this endpoint as an - * alternative to deleting a user if you want to keep user's ID reserved. - * - * @param {string} userId - * @param {boolean} status - * @throws {AppwriteException} - * @returns {Promise} - */ - updateStatus: (userId, status) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - let path = '/users/{userId}/status'.replace('{userId}', userId); - let payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Email Verification - * - * Update the user email verification status by its unique ID. - * - * @param {string} userId - * @param {boolean} emailVerification - * @throws {AppwriteException} - * @returns {Promise} - */ - updateEmailVerification: (userId, emailVerification) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof emailVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "emailVerification"'); - } - let path = '/users/{userId}/verification'.replace('{userId}', userId); - let payload = {}; - if (typeof emailVerification !== 'undefined') { - payload['emailVerification'] = emailVerification; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }), - /** - * Update Phone Verification - * - * Update the user phone verification status by its unique ID. - * - * @param {string} userId - * @param {boolean} phoneVerification - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePhoneVerification: (userId, phoneVerification) => __awaiter(this, void 0, void 0, function* () { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof phoneVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "phoneVerification"'); - } - let path = '/users/{userId}/verification/phone'.replace('{userId}', userId); - let payload = {}; - if (typeof phoneVerification !== 'undefined') { - payload['phoneVerification'] = phoneVerification; - } - const uri = new URL(this.config.endpoint + path); - return yield this.call('patch', uri, { - 'content-type': 'application/json', - }, payload); - }) - }; } /** * Set Endpoint @@ -6159,7 +363,7 @@ headers['X-Fallback-Cookies'] = (_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : ''; } if (method === 'GET') { - for (const [key, value] of Object.entries(this.flatten(params))) { + for (const [key, value] of Object.entries(Service.flatten(params))) { url.searchParams.append(key, value); } } @@ -6214,43 +418,6242 @@ } }); } - flatten(data, prefix = '') { - let output = {}; - for (const key in data) { - let value = data[key]; - let finalKey = prefix ? `${prefix}[${key}]` : key; - if (Array.isArray(value)) { - output = Object.assign(output, this.flatten(value, finalKey)); + } + + class Account extends Service { + constructor(client) { + super(client); + } + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + get() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#accountCreateVerification) + * route to start verifying the user email address. To allow the new user to + * login to their new account, you need to create a new [account + * session](/docs/client/account#accountCreateSession). + * + * @param {string} userId + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + create(userId, email, password, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); } - else { - output[finalKey] = value; + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/account'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, the user confirmation status will get reset. A new confirmation + * email is not sent automatically however you can use the send confirmation + * email endpoint again to send the confirmation email. For security measures, + * user password is required to complete this request. + * This endpoint can also be used to convert an anonymous account to a normal + * one, by passing an email address and a new password. + * + * + * @param {string} email + * @param {string} password + * @throws {AppwriteException} + * @returns {Promise} + */ + updateEmail(email, password) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/account/email'; + let payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Account JWT + * + * Use this endpoint to create a JSON Web Token. You can use the resulting JWT + * to authenticate on behalf of the current user when working with the + * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes + * from its creation and will be invalid if the user will logout in that time + * frame. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + createJWT() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/jwt'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + getLogs(limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/logs'; + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + updateName(name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/account/name'; + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass in the new password, and the old password. For users created with + * OAuth, Team Invites and Magic URL, oldPassword is optional. + * + * @param {string} password + * @param {string} oldPassword + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePassword(password, oldPassword) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/account/password'; + let payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof oldPassword !== 'undefined') { + payload['oldPassword'] = oldPassword; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Phone + * + * Update the currently logged in user's phone number. After updating the + * phone number, the phone verification status will be reset. A confirmation + * SMS is not sent automatically, however you can use the [POST + * /account/verification/phone](/docs/client/account#accountCreatePhoneVerification) + * endpoint to send a confirmation SMS. + * + * @param {string} number + * @param {string} password + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePhone(number, password) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/account/phone'; + let payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getPrefs() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/prefs'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. The object you pass is + * stored as is, and replaces any previous value. The maximum allowed prefs + * size is 64kB and throws error if exceeded. + * + * @param {Partial} prefs + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePrefs(prefs) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + let path = '/account/prefs'; + let payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT + * /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to + * complete the process. The verification link sent to the user's email + * address is valid for 1 hour. + * + * @param {string} email + * @param {string} url + * @throws {AppwriteException} + * @returns {Promise} + */ + createRecovery(email, url) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + let path = '/account/recovery'; + let payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Password Recovery (confirmation) + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#accountCreateRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {AppwriteException} + * @returns {Promise} + */ + updateRecovery(userId, secret, password, passwordAgain) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + if (typeof passwordAgain === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordAgain"'); + } + let path = '/account/recovery'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordAgain !== 'undefined') { + payload['passwordAgain'] = passwordAgain; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getSessions() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/sessions'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteSessions() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/sessions'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Anonymous Session + * + * Use this endpoint to allow a new user to register an anonymous account in + * your project. This route will also create a new session for the user. To + * allow the new user to convert an anonymous account to a normal account, you + * need to update its [email and + * password](/docs/client/account#accountUpdateEmail) or create an [OAuth2 + * session](/docs/client/account#accountCreateOAuth2Session). + * + * @throws {AppwriteException} + * @returns {Promise} + */ + createAnonymousSession() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/sessions/anonymous'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Account Session with Email + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {AppwriteException} + * @returns {Promise} + */ + createEmailSession(email, password) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/account/sessions/email'; + let payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Magic URL session + * + * Sends the user an email with a secret key for creating a session. If the + * provided user ID has not be registered, a new user will be created. When + * the user clicks the link in the email, the user is redirected back to the + * URL you provided with the secret key and userId values attached to the URL + * query string. Use the query string parameters to submit a request to the + * [PUT + * /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) + * endpoint to complete the login process. The link sent to the user's email + * address is valid for 1 hour. If you are on a mobile device you can leave + * the URL parameter empty, so that the login completion will be handled by + * your Appwrite instance by default. + * + * @param {string} userId + * @param {string} email + * @param {string} url + * @throws {AppwriteException} + * @returns {Promise} + */ + createMagicURLSession(userId, email, url) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + let path = '/account/sessions/magic-url'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Magic URL session (confirmation) + * + * Use this endpoint to complete creating the session with the Magic URL. Both + * the **userId** and **secret** arguments will be passed as query parameters + * to the redirect URL you have provided when sending your request to the + * [POST + * /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession) + * endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMagicURLSession(userId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + let path = '/account/sessions/magic-url'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * If there is already an active session, the new session will be attached to + * the logged-in account. If there are no active sessions, the server will + * attempt to look for a user with the same email address as the email + * received from the OAuth2 provider and attach the new session to the + * existing user. If no matching user is found - the server will create a new + * user.. + * + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {AppwriteException} + * @returns {void|string} + */ + createOAuth2Session(provider, success, failure, scopes) { + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); } - return output; + let path = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider); + let payload = {}; + if (typeof success !== 'undefined') { + payload['success'] = success; + } + if (typeof failure !== 'undefined') { + payload['failure'] = failure; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) { + window.location.href = uri.toString(); + } + else { + return uri; + } + } + /** + * Create Phone session + * + * Sends the user an SMS with a secret key for creating a session. If the + * provided user ID has not be registered, a new user will be created. Use the + * returned user ID and secret and submit a request to the [PUT + * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession) + * endpoint to complete the login process. The secret sent to the user's phone + * is valid for 15 minutes. + * + * @param {string} userId + * @param {string} number + * @throws {AppwriteException} + * @returns {Promise} + */ + createPhoneSession(userId, number) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + let path = '/account/sessions/phone'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof number !== 'undefined') { + payload['number'] = number; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Phone session (confirmation) + * + * Use this endpoint to complete creating a session with SMS. Use the + * **userId** from the + * [createPhoneSession](/docs/client/account#accountCreatePhoneSession) + * endpoint and the **secret** received via SMS to successfully update and + * confirm the phone session. + * + * @param {string} userId + * @param {string} secret + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePhoneSession(userId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + let path = '/account/sessions/phone'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Session By ID + * + * Use this endpoint to get a logged in user's session using a Session ID. + * Inputting 'current' will return the current session being used. + * + * @param {string} sessionId + * @throws {AppwriteException} + * @returns {Promise} + */ + getSession(sessionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Session (Refresh Tokens) + * + * Access tokens have limited lifespan and expire to mitigate security risks. + * If session was created using an OAuth provider, this route can be used to + * "refresh" the access token. + * + * @param {string} sessionId + * @throws {AppwriteException} + * @returns {Promise} + */ + updateSession(sessionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all their + * account sessions across all of their different devices. When using the + * Session ID argument, only the unique session ID provided is deleted. + * + * + * @param {string} sessionId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteSession(sessionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Account Status + * + * Block the currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. To + * completely delete a user, use the Users API instead. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + updateStatus() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/status'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#accountUpdateEmailVerification). The + * verification link sent to the user's email address is valid for 7 days. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {AppwriteException} + * @returns {Promise} + */ + createVerification(url) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + let path = '/account/verification'; + let payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Email Verification (confirmation) + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {AppwriteException} + * @returns {Promise} + */ + updateVerification(userId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + let path = '/account/verification'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Phone Verification + * + * Use this endpoint to send a verification SMS to the currently logged in + * user. This endpoint is meant for use after updating a user's phone number + * using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone) + * endpoint. Learn more about how to [complete the verification + * process](/docs/client/account#accountUpdatePhoneVerification). The + * verification code sent to the user's phone number is valid for 15 minutes. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + createPhoneVerification() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/account/verification/phone'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Phone Verification (confirmation) + * + * Use this endpoint to complete the user phone verification process. Use the + * **userId** and **secret** that were sent to your user's phone number to + * verify the user email ownership. If confirmed this route will return a 200 + * status code. + * + * @param {string} userId + * @param {string} secret + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePhoneVerification(userId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + let path = '/account/verification/phone'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); } } - Appwrite.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB - class Query { - } - Query.equal = (attribute, value) => Query.addQuery(attribute, "equal", value); - Query.notEqual = (attribute, value) => Query.addQuery(attribute, "notEqual", value); - Query.lesser = (attribute, value) => Query.addQuery(attribute, "lesser", value); - Query.lesserEqual = (attribute, value) => Query.addQuery(attribute, "lesserEqual", value); - Query.greater = (attribute, value) => Query.addQuery(attribute, "greater", value); - Query.greaterEqual = (attribute, value) => Query.addQuery(attribute, "greaterEqual", value); - Query.search = (attribute, value) => Query.addQuery(attribute, "search", value); - Query.addQuery = (attribute, oper, value) => value instanceof Array - ? `${attribute}.${oper}(${value - .map((v) => Query.parseValues(v)) - .join(",")})` - : `${attribute}.${oper}(${Query.parseValues(value)})`; - Query.parseValues = (value) => typeof value === "string" || value instanceof String - ? `"${value}"` - : `${value}`; - exports.Appwrite = Appwrite; + class Avatars extends Service { + constructor(client) { + super(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](/docs/client/account#accountGetSessions) 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 {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + */ + getBrowser(code, width, height, quality) { + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + let path = '/avatars/browsers/{code}'.replace('{code}', code); + let payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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 {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + */ + getCreditCard(code, width, height, quality) { + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + let path = '/avatars/credit-cards/{code}'.replace('{code}', code); + let payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param {string} url + * @throws {AppwriteException} + * @returns {URL} + */ + getFavicon(url) { + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + let path = '/avatars/favicon'; + let payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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. + * + * 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} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {AppwriteException} + * @returns {URL} + */ + getFlag(code, width, height, quality) { + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + let path = '/avatars/flags/{code}'.replace('{code}', code); + let payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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. + * + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {AppwriteException} + * @returns {URL} + */ + getImage(url, width, height) { + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + let path = '/avatars/image'; + let payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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 '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 + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {AppwriteException} + * @returns {URL} + */ + getInitials(name, width, height, color, background) { + let path = '/avatars/initials'; + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof color !== 'undefined') { + payload['color'] = color; + } + if (typeof background !== 'undefined') { + payload['background'] = background; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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 {URL} + */ + getQR(text, size, margin, download) { + if (typeof text === 'undefined') { + throw new AppwriteException('Missing required parameter: "text"'); + } + let path = '/avatars/qr'; + let payload = {}; + if (typeof text !== 'undefined') { + payload['text'] = text; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof margin !== 'undefined') { + payload['margin'] = margin; + } + if (typeof download !== 'undefined') { + payload['download'] = download; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + } + + class Databases extends Service { + constructor(client) { + super(client); + } + /** + * List Databases + * + * Get a list of all databases from the current Appwrite project. You can use + * the search parameter to filter your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + list(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/databases'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Database + * + * Create a new Database. + * + * + * @param {string} databaseId + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + create(databaseId, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/databases'; + let payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for the database + * + * + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(range) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/databases/usage'; + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Database + * + * Get a database by its unique ID. This endpoint response returns a JSON + * object with the database metadata. + * + * @param {string} databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(databaseId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Database + * + * Update a database by its unique ID. + * + * @param {string} databaseId + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + update(databaseId, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Database + * + * Delete a database by its unique ID. Only API keys with with databases.write + * scope can delete a database. + * + * @param {string} databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + delete(databaseId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Collections + * + * Get a list of all collections that belong to the provided databaseId. You + * can use the search parameter to filter your results. + * + * @param {string} databaseId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + listCollections(databaseId, search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Collection + * + * Create a new Collection. Before using this route, you should create a new + * database resource using either a [server + * integration](/docs/server/database#databaseCreateCollection) API or + * directly from your database console. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} name + * @param {string} permission + * @param {string[]} read + * @param {string[]} write + * @throws {AppwriteException} + * @returns {Promise} + */ + createCollection(databaseId, collectionId, name, permission, read, write) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof permission === 'undefined') { + throw new AppwriteException('Missing required parameter: "permission"'); + } + if (typeof read === 'undefined') { + throw new AppwriteException('Missing required parameter: "read"'); + } + if (typeof write === 'undefined') { + throw new AppwriteException('Missing required parameter: "write"'); + } + let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + let payload = {}; + if (typeof collectionId !== 'undefined') { + payload['collectionId'] = collectionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permission !== 'undefined') { + payload['permission'] = permission; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Collection + * + * Get a collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} databaseId + * @param {string} collectionId + * @throws {AppwriteException} + * @returns {Promise} + */ + getCollection(databaseId, collectionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Collection + * + * Update a collection by its unique ID. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} name + * @param {string} permission + * @param {string[]} read + * @param {string[]} write + * @param {boolean} enabled + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCollection(databaseId, collectionId, name, permission, read, write, enabled) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof permission === 'undefined') { + throw new AppwriteException('Missing required parameter: "permission"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permission !== 'undefined') { + payload['permission'] = permission; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} databaseId + * @param {string} collectionId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteCollection(databaseId, collectionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Attributes + * + * + * @param {string} databaseId + * @param {string} collectionId + * @throws {AppwriteException} + * @returns {Promise} + */ + listAttributes(databaseId, collectionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Boolean Attribute + * + * Create a boolean attribute. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {boolean} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createBooleanAttribute(databaseId, collectionId, key, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Email Attribute + * + * Create an email attribute. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Enum Attribute + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {string[]} elements + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Float Attribute + * + * Create a float attribute. Optionally, minimum and maximum values can be + * provided. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {number} min + * @param {number} max + * @param {number} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Integer Attribute + * + * Create an integer attribute. Optionally, minimum and maximum values can be + * provided. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {number} min + * @param {number} max + * @param {number} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create IP Address Attribute + * + * Create IP address attribute. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createIpAttribute(databaseId, collectionId, key, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create String Attribute + * + * Create a string attribute. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {number} size + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create URL Attribute + * + * Create a URL attribute. + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {boolean} required + * @param {string} xdefault + * @param {boolean} array + * @throws {AppwriteException} + * @returns {Promise} + */ + createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Attribute + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise} + */ + getAttribute(databaseId, collectionId, key) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Attribute + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteAttribute(databaseId, collectionId, key) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Documents + * + * Get a list of all the user's documents in a given collection. You can use + * the query params to filter your results. On admin mode, this endpoint will + * return a list of all of documents belonging to the provided collectionId. + * [Learn more about different API modes](/docs/admin). + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string[]} queries + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string[]} orderAttributes + * @param {string[]} orderTypes + * @throws {AppwriteException} + * @returns {Promise} + */ + listDocuments(databaseId, collectionId, queries, limit, offset, cursor, cursorDirection, orderAttributes, orderTypes) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderAttributes !== 'undefined') { + payload['orderAttributes'] = orderAttributes; + } + if (typeof orderTypes !== 'undefined') { + payload['orderTypes'] = orderTypes; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database#databaseCreateCollection) API or + * directly from your database console. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {Omit} data + * @param {string[]} read + * @param {string[]} write + * @throws {AppwriteException} + * @returns {Promise} + */ + createDocument(databaseId, collectionId, documentId, data, read, write) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof documentId !== 'undefined') { + payload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Document + * + * Get a document by its unique ID. This endpoint response returns a JSON + * object with the document data. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @throws {AppwriteException} + * @returns {Promise} + */ + getDocument(databaseId, collectionId, documentId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Document + * + * Update a document by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {Partial>} data + * @param {string[]} read + * @param {string[]} write + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDocument(databaseId, collectionId, documentId, data, read, write) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + let payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Document + * + * Delete a document by its unique ID. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteDocument(databaseId, collectionId, documentId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Document Logs + * + * Get the document activity logs list by its unique ID. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + listDocumentLogs(databaseId, collectionId, documentId, limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Indexes + * + * + * @param {string} databaseId + * @param {string} collectionId + * @throws {AppwriteException} + * @returns {Promise} + */ + listIndexes(databaseId, collectionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Index + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @param {string} type + * @param {string[]} attributes + * @param {string[]} orders + * @throws {AppwriteException} + * @returns {Promise} + */ + createIndex(databaseId, collectionId, key, type, attributes, orders) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof attributes === 'undefined') { + throw new AppwriteException('Missing required parameter: "attributes"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof attributes !== 'undefined') { + payload['attributes'] = attributes; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Index + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise} + */ + getIndex(databaseId, collectionId, key) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Index + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} key + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteIndex(databaseId, collectionId, key) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Collection Logs + * + * Get the collection activity logs list by its unique ID. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + listCollectionLogs(databaseId, collectionId, limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for a collection + * + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getCollectionUsage(databaseId, collectionId, range) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + let path = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Collection Logs + * + * Get the collection activity logs list by its unique ID. + * + * @param {string} databaseId + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + listLogs(databaseId, limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + let path = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for the database + * + * + * @param {string} databaseId + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getDatabaseUsage(databaseId, range) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + let path = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId); + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Functions extends Service { + constructor(client) { + super(client); + } + /** + * List Functions + * + * Get a list of all the project's functions. You can use the query params to + * filter your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + list(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/functions'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Function + * + * Create a new function. You can pass a list of + * [permissions](/docs/permissions) to allow different project users or team + * with access to execute the function using the client API. + * + * @param {string} functionId + * @param {string} name + * @param {string[]} execute + * @param {string} runtime + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {AppwriteException} + * @returns {Promise} + */ + create(functionId, name, execute, runtime, vars, events, schedule, timeout) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof execute === 'undefined') { + throw new AppwriteException('Missing required parameter: "execute"'); + } + if (typeof runtime === 'undefined') { + throw new AppwriteException('Missing required parameter: "runtime"'); + } + let path = '/functions'; + let payload = {}; + if (typeof functionId !== 'undefined') { + payload['functionId'] = functionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof vars !== 'undefined') { + payload['vars'] = vars; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List runtimes + * + * Get a list of all runtimes that are currently active on your instance. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listRuntimes() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/functions/runtimes'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Function + * + * Get a function by its unique ID. + * + * @param {string} functionId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(functionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}'.replace('{functionId}', functionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Function + * + * Update function by its unique ID. + * + * @param {string} functionId + * @param {string} name + * @param {string[]} execute + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {AppwriteException} + * @returns {Promise} + */ + update(functionId, name, execute, vars, events, schedule, timeout) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof execute === 'undefined') { + throw new AppwriteException('Missing required parameter: "execute"'); + } + let path = '/functions/{functionId}'.replace('{functionId}', functionId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof vars !== 'undefined') { + payload['vars'] = vars; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Function + * + * Delete a function by its unique ID. + * + * @param {string} functionId + * @throws {AppwriteException} + * @returns {Promise} + */ + delete(functionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}'.replace('{functionId}', functionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Deployments + * + * Get a list of all the project's code deployments. You can use the query + * params to filter your results. + * + * @param {string} functionId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + listDeployments(functionId, search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create 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](/docs/functions). + * + * Use the "command" param to set the entry point used to execute your code. + * + * @param {string} functionId + * @param {string} entrypoint + * @param {File} code + * @param {boolean} activate + * @throws {AppwriteException} + * @returns {Promise} + */ + createDeployment(functionId, entrypoint, code, activate, onProgress = (progress) => { }) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof entrypoint === 'undefined') { + throw new AppwriteException('Missing required parameter: "entrypoint"'); + } + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + if (typeof activate === 'undefined') { + throw new AppwriteException('Missing required parameter: "activate"'); + } + let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + let payload = {}; + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + path); + if (!(code instanceof File)) { + throw new AppwriteException('Parameter "code" has to be a File.'); + } + const size = code.size; + if (size <= Service.CHUNK_SIZE) { + return yield this.client.call('post', uri, { + 'content-type': 'multipart/form-data', + }, payload); + } + let id = undefined; + let response = undefined; + const headers = { + 'content-type': 'multipart/form-data', + }; + let counter = 0; + const totalCounters = Math.ceil(size / Service.CHUNK_SIZE); + for (counter; counter < totalCounters; counter++) { + const start = (counter * Service.CHUNK_SIZE); + const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size); + headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; + if (id) { + headers['x-appwrite-id'] = id; + } + const stream = code.slice(start, end + 1); + payload['code'] = new File([stream], code.name); + response = yield this.client.call('post', uri, headers, payload); + if (!id) { + id = response['$id']; + } + if (onProgress) { + onProgress({ + $id: response.$id, + progress: Math.min((counter + 1) * Service.CHUNK_SIZE - 1, size) / size * 100, + sizeUploaded: end, + chunksTotal: response.chunksTotal, + chunksUploaded: response.chunksUploaded + }); + } + } + return response; + }); + } + /** + * Get Deployment + * + * Get a code deployment by its unique ID. + * + * @param {string} functionId + * @param {string} deploymentId + * @throws {AppwriteException} + * @returns {Promise} + */ + getDeployment(functionId, deploymentId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Function Deployment + * + * Update the function code deployment ID using the unique function ID. Use + * this endpoint to switch the code deployment that should be executed by the + * execution endpoint. + * + * @param {string} functionId + * @param {string} deploymentId + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDeployment(functionId, deploymentId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Deployment + * + * Delete a code deployment by its unique ID. + * + * @param {string} functionId + * @param {string} deploymentId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteDeployment(functionId, deploymentId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Retry Build + * + * + * @param {string} functionId + * @param {string} deploymentId + * @param {string} buildId + * @throws {AppwriteException} + * @returns {Promise} + */ + retryBuild(functionId, deploymentId, buildId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + if (typeof buildId === 'undefined') { + throw new AppwriteException('Missing required parameter: "buildId"'); + } + let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Executions + * + * Get a list of all the current user function execution logs. You can use the + * query params to filter your results. On admin mode, this endpoint will + * return a list of all of the project's executions. [Learn more about + * different API modes](/docs/admin). + * + * @param {string} functionId + * @param {number} limit + * @param {number} offset + * @param {string} search + * @param {string} cursor + * @param {string} cursorDirection + * @throws {AppwriteException} + * @returns {Promise} + */ + listExecutions(functionId, limit, offset, search, cursor, cursorDirection) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create 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 + * @param {string} data + * @param {boolean} async + * @throws {AppwriteException} + * @returns {Promise} + */ + createExecution(functionId, data, async) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + let payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof async !== 'undefined') { + payload['async'] = async; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Execution + * + * Get a function execution log by its unique ID. + * + * @param {string} functionId + * @param {string} executionId + * @throws {AppwriteException} + * @returns {Promise} + */ + getExecution(functionId, executionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Function Usage + * + * + * @param {string} functionId + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(functionId, range) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + let path = '/functions/{functionId}/usage'.replace('{functionId}', functionId); + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Health extends Service { + constructor(client) { + super(client); + } + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + get() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Antivirus + * + * Check the Appwrite Antivirus server is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getAntivirus() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/anti-virus'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getCache() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/cache'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getDB() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/db'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueueCertificates() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/queue/certificates'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Functions Queue + * + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueueFunctions() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/queue/functions'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueueLogs() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/queue/logs'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getQueueWebhooks() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/queue/webhooks'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getStorageLocal() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/storage/local'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getTime() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/health/time'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Locale extends Service { + constructor(client) { + super(client); + } + /** + * 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} + */ + get() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getContinents() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/continents'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + getCountries() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/countries'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getCountriesEU() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/countries/eu'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getCountriesPhones() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/countries/phones'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getCurrencies() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/currencies'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getLanguages() { + return __awaiter(this, void 0, void 0, function* () { + let path = '/locale/languages'; + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Projects extends Service { + constructor(client) { + super(client); + } + /** + * List Projects + * + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + list(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/projects'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} teamId + * @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} + */ + create(projectId, name, teamId, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects'; + let payload = {}; + if (typeof projectId !== 'undefined') { + payload['projectId'] = projectId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + 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 + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Project + * + * + * @param {string} projectId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(projectId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}'.replace('{projectId}', projectId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, 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} + */ + update(projectId, name, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/projects/{projectId}'.replace('{projectId}', projectId); + let 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 + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Project + * + * + * @param {string} projectId + * @param {string} password + * @throws {AppwriteException} + * @returns {Promise} + */ + delete(projectId, password) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/projects/{projectId}'.replace('{projectId}', projectId); + let payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Project users limit + * + * + * @param {string} projectId + * @param {number} limit + * @throws {AppwriteException} + * @returns {Promise} + */ + updateAuthLimit(projectId, limit) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof limit === 'undefined') { + throw new AppwriteException('Missing required parameter: "limit"'); + } + let path = '/projects/{projectId}/auth/limit'.replace('{projectId}', projectId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Project auth method status. Use this endpoint to enable or disable a given auth method for this project. + * + * + * @param {string} projectId + * @param {string} method + * @param {boolean} status + * @throws {AppwriteException} + * @returns {Promise} + */ + updateAuthStatus(projectId, method, status) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/auth/{method}'.replace('{projectId}', projectId).replace('{method}', method); + let payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Domains + * + * + * @param {string} projectId + * @throws {AppwriteException} + * @returns {Promise} + */ + listDomains(projectId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}/domains'.replace('{projectId}', projectId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Domain + * + * + * @param {string} projectId + * @param {string} domain + * @throws {AppwriteException} + * @returns {Promise} + */ + createDomain(projectId, domain) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + let path = '/projects/{projectId}/domains'.replace('{projectId}', projectId); + let payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {AppwriteException} + * @returns {Promise} + */ + getDomain(projectId, domainId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof domainId === 'undefined') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + let path = '/projects/{projectId}/domains/{domainId}'.replace('{projectId}', projectId).replace('{domainId}', domainId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteDomain(projectId, domainId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof domainId === 'undefined') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + let path = '/projects/{projectId}/domains/{domainId}'.replace('{projectId}', projectId).replace('{domainId}', domainId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Domain Verification Status + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDomainVerification(projectId, domainId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof domainId === 'undefined') { + throw new AppwriteException('Missing required parameter: "domainId"'); + } + let path = '/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}', projectId).replace('{domainId}', domainId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Keys + * + * + * @param {string} projectId + * @throws {AppwriteException} + * @returns {Promise} + */ + listKeys(projectId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} scopes + * @param {number} expire + * @throws {AppwriteException} + * @returns {Promise} + */ + createKey(projectId, name, scopes, expire) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/keys'.replace('{projectId}', projectId); + let 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 + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {AppwriteException} + * @returns {Promise} + */ + getKey(projectId, keyId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {string[]} scopes + * @param {number} expire + * @throws {AppwriteException} + * @returns {Promise} + */ + updateKey(projectId, keyId, name, scopes, expire) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); + let 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 + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteKey(projectId, keyId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Project OAuth2 + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {AppwriteException} + * @returns {Promise} + */ + updateOAuth2(projectId, provider, appId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); + } + let path = '/projects/{projectId}/oauth2'.replace('{projectId}', projectId); + let payload = {}; + if (typeof provider !== 'undefined') { + payload['provider'] = provider; + } + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {AppwriteException} + * @returns {Promise} + */ + listPlatforms(projectId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {AppwriteException} + * @returns {Promise} + */ + createPlatform(projectId, type, name, key, store, hostname) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/platforms'.replace('{projectId}', projectId); + let 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 + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {AppwriteException} + * @returns {Promise} + */ + getPlatform(projectId, platformId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, 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} + */ + updatePlatform(projectId, platformId, name, key, store, hostname) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); + let 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 + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {AppwriteException} + * @returns {Promise} + */ + deletePlatform(projectId, platformId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update service status + * + * + * @param {string} projectId + * @param {string} service + * @param {boolean} status + * @throws {AppwriteException} + * @returns {Promise} + */ + updateServiceStatus(projectId, service, status) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/service'.replace('{projectId}', projectId); + let payload = {}; + if (typeof service !== 'undefined') { + payload['service'] = service; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for a project + * + * + * @param {string} projectId + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(projectId, range) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}/usage'.replace('{projectId}', projectId); + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {AppwriteException} + * @returns {Promise} + */ + listWebhooks(projectId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + let path = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {AppwriteException} + * @returns {Promise} + */ + createWebhook(projectId, name, events, url, security, httpUser, httpPass) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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 + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {AppwriteException} + * @returns {Promise} + */ + getWebhook(projectId, webhookId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {AppwriteException} + * @returns {Promise} + */ + updateWebhook(projectId, webhookId, name, events, url, security, httpUser, httpPass) { + return __awaiter(this, void 0, void 0, function* () { + 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"'); + } + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + 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 + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteWebhook(projectId, webhookId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Webhook Signature Key + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {AppwriteException} + * @returns {Promise} + */ + updateWebhookSignature(projectId, webhookId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + let path = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Storage extends Service { + constructor(client) { + super(client); + } + /** + * List buckets + * + * Get a list of all the storage buckets. You can use the query params to + * filter your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + listBuckets(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/storage/buckets'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create bucket + * + * Create a new storage bucket. + * + * @param {string} bucketId + * @param {string} name + * @param {string} permission + * @param {string[]} read + * @param {string[]} write + * @param {boolean} enabled + * @param {number} maximumFileSize + * @param {string[]} allowedFileExtensions + * @param {boolean} encryption + * @param {boolean} antivirus + * @throws {AppwriteException} + * @returns {Promise} + */ + createBucket(bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof permission === 'undefined') { + throw new AppwriteException('Missing required parameter: "permission"'); + } + let path = '/storage/buckets'; + let payload = {}; + if (typeof bucketId !== 'undefined') { + payload['bucketId'] = bucketId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permission !== 'undefined') { + payload['permission'] = permission; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + getBucket(bucketId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Bucket + * + * Update a storage bucket by its unique ID. + * + * @param {string} bucketId + * @param {string} name + * @param {string} permission + * @param {string[]} read + * @param {string[]} write + * @param {boolean} enabled + * @param {number} maximumFileSize + * @param {string[]} allowedFileExtensions + * @param {boolean} encryption + * @param {boolean} antivirus + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBucket(bucketId, name, permission, read, write, enabled, maximumFileSize, allowedFileExtensions, encryption, antivirus) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof permission === 'undefined') { + throw new AppwriteException('Missing required parameter: "permission"'); + } + let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permission !== 'undefined') { + payload['permission'] = permission; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete Bucket + * + * Delete a storage bucket by its unique ID. + * + * @param {string} bucketId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteBucket(bucketId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + let path = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project's files. [Learn more about different API modes](/docs/admin). + * + * @param {string} bucketId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + listFiles(bucketId, search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create File + * + * Create a new file. Before using this route, you should create a new bucket + * resource using either a [server + * integration](/docs/server/database#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 + * @param {string} fileId + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {AppwriteException} + * @returns {Promise} + */ + createFile(bucketId, fileId, file, read, write, onProgress = (progress) => { }) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + if (typeof file === 'undefined') { + throw new AppwriteException('Missing required parameter: "file"'); + } + let path = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + let payload = {}; + if (typeof fileId !== 'undefined') { + payload['fileId'] = fileId; + } + if (typeof file !== 'undefined') { + payload['file'] = file; + } + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + const uri = new URL(this.client.config.endpoint + path); + if (!(file instanceof File)) { + throw new AppwriteException('Parameter "file" has to be a File.'); + } + const size = file.size; + if (size <= Service.CHUNK_SIZE) { + return yield this.client.call('post', uri, { + 'content-type': 'multipart/form-data', + }, payload); + } + let id = undefined; + let response = undefined; + const headers = { + 'content-type': 'multipart/form-data', + }; + let counter = 0; + const totalCounters = Math.ceil(size / Service.CHUNK_SIZE); + if (fileId != 'unique()') { + try { + response = yield this.client.call('GET', new URL(this.client.config.endpoint + path + '/' + fileId), headers); + counter = response.chunksUploaded; + } + catch (e) { + } + } + for (counter; counter < totalCounters; counter++) { + const start = (counter * Service.CHUNK_SIZE); + const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size); + headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size; + if (id) { + headers['x-appwrite-id'] = id; + } + const stream = file.slice(start, end + 1); + payload['file'] = new File([stream], file.name); + response = yield this.client.call('post', uri, headers, payload); + if (!id) { + id = response['$id']; + } + if (onProgress) { + onProgress({ + $id: response.$id, + progress: Math.min((counter + 1) * Service.CHUNK_SIZE - 1, size) / size * 100, + sizeUploaded: end, + chunksTotal: response.chunksTotal, + chunksUploaded: response.chunksUploaded + }); + } + } + return response; + }); + } + /** + * 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} + */ + getFile(bucketId, fileId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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[]} read + * @param {string[]} write + * @throws {AppwriteException} + * @returns {Promise} + */ + updateFile(bucketId, fileId, read, write) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + if (typeof read !== 'undefined') { + payload['read'] = read; + } + if (typeof write !== 'undefined') { + payload['write'] = write; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + deleteFile(bucketId, fileId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get File for Download + * + * 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. + * + * @param {string} bucketId + * @param {string} fileId + * @throws {AppwriteException} + * @returns {URL} + */ + getFileDownload(bucketId, fileId) { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * 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 {string} gravity + * @param {number} quality + * @param {number} borderWidth + * @param {string} borderColor + * @param {number} borderRadius + * @param {number} opacity + * @param {number} rotation + * @param {string} background + * @param {string} output + * @throws {AppwriteException} + * @returns {URL} + */ + 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"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof gravity !== 'undefined') { + payload['gravity'] = gravity; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + if (typeof borderWidth !== 'undefined') { + payload['borderWidth'] = borderWidth; + } + if (typeof borderColor !== 'undefined') { + payload['borderColor'] = borderColor; + } + if (typeof borderRadius !== 'undefined') { + payload['borderRadius'] = borderRadius; + } + if (typeof opacity !== 'undefined') { + payload['opacity'] = opacity; + } + if (typeof rotation !== 'undefined') { + payload['rotation'] = rotation; + } + if (typeof background !== 'undefined') { + payload['background'] = background; + } + if (typeof output !== 'undefined') { + payload['output'] = output; + } + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * Get File for View + * + * 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 + * @param {string} fileId + * @throws {AppwriteException} + * @returns {URL} + */ + getFileView(bucketId, fileId) { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + let path = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + return uri; + } + /** + * Get usage stats for storage + * + * + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(range) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/storage/usage'; + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for a storage bucket + * + * + * @param {string} bucketId + * @param {string} range + * @throws {AppwriteException} + * @returns {Promise} + */ + getBucketUsage(bucketId, range) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + let path = '/storage/{bucketId}/usage'.replace('{bucketId}', bucketId); + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Teams extends Service { + constructor(client) { + super(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. + * + * In admin mode, this endpoint returns a list of all the teams in the current + * project. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + list(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/teams'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + create(teamId, name, roles) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/teams'; + let payload = {}; + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Team + * + * Get a team by its ID. All team members have read access for this resource. + * + * @param {string} teamId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(teamId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + let path = '/teams/{teamId}'.replace('{teamId}', teamId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Team + * + * Update a team using its ID. Only members with the owner role can update the + * team. + * + * @param {string} teamId + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + update(teamId, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/teams/{teamId}'.replace('{teamId}', teamId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('put', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + delete(teamId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + let path = '/teams/{teamId}'.replace('{teamId}', teamId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * List Team Logs + * + * Get the team activity logs list by its unique ID. + * + * @param {string} teamId + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + listLogs(teamId, limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Team Memberships + * + * Use this endpoint to list a team's members using the team's ID. All team + * members have read access to this endpoint. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + getMemberships(teamId, search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create Team Membership + * + * Invite a new member to join your team. If initiated from the client SDK, an + * email with a link to join the team will be sent to the member's email + * address and an account will be created for them should they not be signed + * up already. If initiated from server-side SDKs, the new member will + * automatically be added to the team. + * + * Use the 'url' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#teamsUpdateMembershipStatus) 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) + * the only valid redirect URL's are the once from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + createMembership(teamId, email, roles, url, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + let payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get Team Membership + * + * Get a team member by the membership unique id. All team members have read + * access for this resource. + * + * @param {string} teamId + * @param {string} membershipId + * @throws {AppwriteException} + * @returns {Promise} + */ + getMembership(teamId, membershipId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Membership Roles + * + * 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](/docs/permissions). + * + * @param {string} teamId + * @param {string} membershipId + * @param {string[]} roles + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMembershipRoles(teamId, membershipId, roles) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + let payload = {}; + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + deleteMembership(teamId, membershipId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * 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} + */ + updateMembershipStatus(teamId, membershipId, userId, secret) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + class Users extends Service { + constructor(client) { + super(client); + } + /** + * List Users + * + * Get a list of all the project's users. You can use the query params to + * filter your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} cursor + * @param {string} cursorDirection + * @param {string} orderType + * @throws {AppwriteException} + * @returns {Promise} + */ + list(search, limit, offset, cursor, cursorDirection, orderType) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/users'; + let payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof cursor !== 'undefined') { + payload['cursor'] = cursor; + } + if (typeof cursorDirection !== 'undefined') { + payload['cursorDirection'] = cursorDirection; + } + if (typeof orderType !== 'undefined') { + payload['orderType'] = orderType; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Create User + * + * Create a new user. + * + * @param {string} userId + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + create(userId, email, password, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/users'; + let payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('post', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get usage stats for the users API + * + * + * @param {string} range + * @param {string} provider + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(range, provider) { + return __awaiter(this, void 0, void 0, function* () { + let path = '/users/usage'; + let payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + if (typeof provider !== 'undefined') { + payload['provider'] = provider; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get User + * + * Get a user by its unique ID. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + get(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete User + * + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is + * released and can be reused, all user-related resources like documents or + * storage files should be deleted before user deletion. If you want to keep + * ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus) + * endpoint instead. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + delete(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Email + * + * Update the user email by its unique ID. + * + * @param {string} userId + * @param {string} email + * @throws {AppwriteException} + * @returns {Promise} + */ + updateEmail(userId, email) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + let path = '/users/{userId}/email'.replace('{userId}', userId); + let payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get User Logs + * + * Get the user activity logs list by its unique ID. + * + * @param {string} userId + * @param {number} limit + * @param {number} offset + * @throws {AppwriteException} + * @returns {Promise} + */ + getLogs(userId, limit, offset) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}/logs'.replace('{userId}', userId); + let payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get User Memberships + * + * Get the user membership list by its unique ID. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + getMemberships(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}/memberships'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Name + * + * Update the user name by its unique ID. + * + * @param {string} userId + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + updateName(userId, name) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + let path = '/users/{userId}/name'.replace('{userId}', userId); + let payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Password + * + * Update the user password by its unique ID. + * + * @param {string} userId + * @param {string} password + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePassword(userId, password) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + let path = '/users/{userId}/password'.replace('{userId}', userId); + let payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Phone + * + * Update the user phone by its unique ID. + * + * @param {string} userId + * @param {string} number + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePhone(userId, number) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + let path = '/users/{userId}/phone'.replace('{userId}', userId); + let payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get User Preferences + * + * Get the user preferences by its unique ID. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + getPrefs(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}/prefs'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update User Preferences + * + * Update the user 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 error if exceeded. + * + * @param {string} userId + * @param {object} prefs + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePrefs(userId, prefs) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + let path = '/users/{userId}/prefs'.replace('{userId}', userId); + let payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Get User Sessions + * + * Get the user sessions list by its unique ID. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + getSessions(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}/sessions'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('get', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete User Sessions + * + * Delete all user's sessions by using the user's unique ID. + * + * @param {string} userId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteSessions(userId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + let path = '/users/{userId}/sessions'.replace('{userId}', userId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Delete User Session + * + * Delete a user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteSession(userId, sessionId) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); + let payload = {}; + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('delete', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update User Status + * + * Update the user status by its unique ID. Use this endpoint as an + * alternative to deleting a user if you want to keep user's ID reserved. + * + * @param {string} userId + * @param {boolean} status + * @throws {AppwriteException} + * @returns {Promise} + */ + updateStatus(userId, status) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + let path = '/users/{userId}/status'.replace('{userId}', userId); + let payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Email Verification + * + * Update the user email verification status by its unique ID. + * + * @param {string} userId + * @param {boolean} emailVerification + * @throws {AppwriteException} + * @returns {Promise} + */ + updateEmailVerification(userId, emailVerification) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof emailVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "emailVerification"'); + } + let path = '/users/{userId}/verification'.replace('{userId}', userId); + let payload = {}; + if (typeof emailVerification !== 'undefined') { + payload['emailVerification'] = emailVerification; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + /** + * Update Phone Verification + * + * Update the user phone verification status by its unique ID. + * + * @param {string} userId + * @param {boolean} phoneVerification + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePhoneVerification(userId, phoneVerification) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof phoneVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "phoneVerification"'); + } + let path = '/users/{userId}/verification/phone'.replace('{userId}', userId); + let payload = {}; + if (typeof phoneVerification !== 'undefined') { + payload['phoneVerification'] = phoneVerification; + } + const uri = new URL(this.client.config.endpoint + path); + return yield this.client.call('patch', uri, { + 'content-type': 'application/json', + }, payload); + }); + } + } + + exports.Account = Account; + exports.AppwriteException = AppwriteException; + exports.Avatars = Avatars; + exports.Client = Client; + exports.Databases = Databases; + exports.Functions = Functions; + exports.Health = Health; + exports.Locale = Locale; + exports.Projects = Projects; exports.Query = Query; + exports.Storage = Storage; + exports.Teams = Teams; + exports.Users = Users; Object.defineProperty(exports, '__esModule', { value: true }); -}(this.window = this.window || {}, null, window)); +})(this.Appwrite = this.Appwrite || {}, null, window); diff --git a/public/scripts/init.js b/public/scripts/init.js index fae9d91c7..f6493afaa 100644 --- a/public/scripts/init.js +++ b/public/scripts/init.js @@ -57,7 +57,7 @@ window.addEventListener("load", async () => { const realtime = window.ls.container.get('realtime'); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); let current = {}; - window.ls.container.get('console').subscribe(['project', 'console'], response => { + window.ls.container.get('console').client.subscribe(['project', 'console'], response => { if (response.events.includes('stats.connections')) { for (let project in response.payload) { current[project] = response.payload[project] ?? 0; diff --git a/public/scripts/services/console.js b/public/scripts/services/console.js index 0a48aa3d4..c9b1a70ed 100644 --- a/public/scripts/services/console.js +++ b/public/scripts/services/console.js @@ -2,16 +2,28 @@ "use strict"; window.ls.container.set('console', function (window) { - var sdk = new window.Appwrite(); + var client = new Appwrite.Client(); var endpoint = window.location.origin + '/v1'; - sdk + client .setEndpoint(endpoint) .setProject('console') .setLocale(APP_ENV.LOCALE) ; - return sdk; + return { + client: client, + account: new Appwrite.Account(client), + avatars: new Appwrite.Avatars(client), + databases: new Appwrite.Databases(client), + functions: new Appwrite.Functions(client), + health: new Appwrite.Health(client), + locale: new Appwrite.Locale(client), + projects: new Appwrite.Projects(client), + storage: new Appwrite.Storage(client), + teams: new Appwrite.Teams(client), + users: new Appwrite.Users(client) + } }, true); })(window); \ No newline at end of file diff --git a/public/scripts/services/sdk.js b/public/scripts/services/sdk.js index 2ff798747..de355ca11 100644 --- a/public/scripts/services/sdk.js +++ b/public/scripts/services/sdk.js @@ -2,17 +2,28 @@ "use strict"; window.ls.container.set('sdk', function (window, router) { - var sdk = new window.Appwrite(); + var client = new Appwrite.Client(); var endpoint = window.location.origin + '/v1'; - sdk + client .setEndpoint(endpoint) .setProject(router.params.project || '') .setLocale(APP_ENV.LOCALE) .setMode('admin') ; - return sdk; + return { + client: client, + account: new Appwrite.Account(client), + avatars: new Appwrite.Avatars(client), + databases: new Appwrite.Databases(client), + functions: new Appwrite.Functions(client), + health: new Appwrite.Health(client), + locale: new Appwrite.Locale(client), + storage: new Appwrite.Storage(client), + teams: new Appwrite.Teams(client), + users: new Appwrite.Users(client) + } }, false); })(window); \ No newline at end of file diff --git a/public/scripts/views/service.js b/public/scripts/views/service.js index 457434a62..115075b36 100644 --- a/public/scripts/views/service.js +++ b/public/scripts/views/service.js @@ -203,6 +203,12 @@ let params = []; let match; + let indexOfArguments = functionAsString.indexOf('('); + + if (indexOfArguments !== -1) { + functionAsString = functionAsString.slice(indexOfArguments, -1); + } + functionAsString = functionAsString.replaceAll('={}', ""); functionAsString = functionAsString.replaceAll('=[]', ""); functionAsString = functionAsString.replace(REGEX_COMMENTS, ""); @@ -259,7 +265,7 @@ let args = getParams(target); return target.apply( - target, + container.get(scope), args.map(function(value) { let result = getValue(value, prefix, data);