Updated SDK
This commit is contained in:
parent
8e1eda173a
commit
2366a0dcb4
|
@ -708,10 +708,11 @@
|
|||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string[]} scopes
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||
if(provider === undefined) {
|
||||
throw new Error('Missing required parameter: "provider"');
|
||||
}
|
||||
|
@ -728,9 +729,28 @@
|
|||
payload['failure'] = failure;
|
||||
}
|
||||
|
||||
if(scopes) {
|
||||
payload['scopes'] = scopes;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -882,7 +902,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -925,7 +960,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -955,7 +1005,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -997,7 +1062,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1039,7 +1119,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1093,7 +1188,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1138,7 +1248,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
@ -1758,7 +1883,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1811,7 +1951,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1842,7 +1997,22 @@
|
|||
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
|
36
app/sdks/client-web/src/sdk.min.js
vendored
36
app/sdks/client-web/src/sdk.min.js
vendored
|
@ -45,10 +45,12 @@ return http.put(path,{'content-type':'application/json',},payload)},getSessions:
|
|||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
||||
if(password){payload.password=password}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||
if(failure){payload.failure=failure}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
if(scopes){payload.scopes=scopes}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/account/verification';let payload={};if(url){payload.url=url}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
|
@ -59,31 +61,38 @@ return http.put(path,{'content-type':'application/json',},payload)}};let avatars
|
|||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
||||
if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||
if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(color){payload.color=color}
|
||||
if(background){payload.background=background}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
||||
if(size){payload.size=size}
|
||||
if(margin){payload.margin=margin}
|
||||
if(download){payload.download=download}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters}
|
||||
if(offset){payload.offset=offset}
|
||||
if(limit){payload.limit=limit}
|
||||
|
@ -133,15 +142,18 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
|||
if(write){payload.write=write}
|
||||
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
if(background){payload.background=background}
|
||||
if(output){payload.output=output}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||
if(limit){payload.limit=limit}
|
||||
if(offset){payload.offset=offset}
|
||||
if(orderType){payload.orderType=orderType}
|
||||
|
|
3
app/sdks/client-web/types/index.d.ts
vendored
3
app/sdks/client-web/types/index.d.ts
vendored
|
@ -248,10 +248,11 @@ declare namespace Appwrite {
|
|||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string[]} scopes
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session(provider: string, success: string, failure: string): Promise<object>;
|
||||
createOAuth2Session(provider: string, success: string, failure: string, scopes: string[]): Promise<object>;
|
||||
|
||||
/**
|
||||
* Delete Account Session
|
||||
|
|
|
@ -744,10 +744,11 @@
|
|||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string[]} scopes
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||
if(provider === undefined) {
|
||||
throw new Error('Missing required parameter: "provider"');
|
||||
}
|
||||
|
@ -764,11 +765,30 @@
|
|||
payload['failure'] = failure;
|
||||
}
|
||||
|
||||
if(scopes) {
|
||||
payload['scopes'] = scopes;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -922,7 +942,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -967,7 +1002,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -999,7 +1049,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1043,7 +1108,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1087,7 +1167,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1143,7 +1238,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1190,7 +1300,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
@ -3567,7 +3692,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -3622,7 +3762,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -3655,7 +3810,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
|
36
app/sdks/console-web/src/sdk.min.js
vendored
36
app/sdks/console-web/src/sdk.min.js
vendored
|
@ -45,10 +45,12 @@ return http.put(path,{'content-type':'application/json',},payload)},getSessions:
|
|||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
||||
if(password){payload.password=password}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||
if(failure){payload.failure=failure}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
if(scopes){payload.scopes=scopes}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/account/verification';let payload={};if(url){payload.url=url}
|
||||
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
|
@ -59,31 +61,38 @@ return http.put(path,{'content-type':'application/json',},payload)}};let avatars
|
|||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
||||
if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||
if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(color){payload.color=color}
|
||||
if(background){payload.background=background}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
||||
if(size){payload.size=size}
|
||||
if(margin){payload.margin=margin}
|
||||
if(download){payload.download=download}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload.search=search}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload.search=search}
|
||||
if(limit){payload.limit=limit}
|
||||
if(offset){payload.offset=offset}
|
||||
if(orderType){payload.orderType=orderType}
|
||||
|
@ -304,15 +313,18 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
|||
if(write){payload.write=write}
|
||||
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
||||
if(height){payload.height=height}
|
||||
if(quality){payload.quality=quality}
|
||||
if(background){payload.background=background}
|
||||
if(output){payload.output=output}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||
if(limit){payload.limit=limit}
|
||||
if(offset){payload.offset=offset}
|
||||
if(orderType){payload.orderType=orderType}
|
||||
|
|
3
app/sdks/console-web/types/index.d.ts
vendored
3
app/sdks/console-web/types/index.d.ts
vendored
|
@ -269,10 +269,11 @@ declare namespace Appwrite {
|
|||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string[]} scopes
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session(provider: string, success: string, failure: string): Promise<object>;
|
||||
createOAuth2Session(provider: string, success: string, failure: string, scopes: string[]): Promise<object>;
|
||||
|
||||
/**
|
||||
* Delete Account Session
|
||||
|
|
23
composer.lock
generated
23
composer.lock
generated
|
@ -485,12 +485,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "23730ab1005ca1e760dcdfbd7d853e6c3f1035d6"
|
||||
"reference": "ba7930ff4209374c2817738e408eeeedcf42fa7b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/23730ab1005ca1e760dcdfbd7d853e6c3f1035d6",
|
||||
"reference": "23730ab1005ca1e760dcdfbd7d853e6c3f1035d6",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ba7930ff4209374c2817738e408eeeedcf42fa7b",
|
||||
"reference": "ba7930ff4209374c2817738e408eeeedcf42fa7b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -544,7 +544,7 @@
|
|||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2020-06-06T12:11:37+00:00"
|
||||
"time": "2020-06-16T09:06:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
|
@ -1753,7 +1753,7 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator",
|
||||
"reference": "42b2025652507be19807a2dfb78b442fc5ed4102"
|
||||
"reference": "e2b2752bd789defc87475a4fe118d10702807683"
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
|
@ -1783,7 +1783,7 @@
|
|||
}
|
||||
],
|
||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||
"time": "2020-06-16T06:10:50+00:00"
|
||||
"time": "2020-06-16T19:14:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
|
@ -3382,16 +3382,16 @@
|
|||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webmozart/assert.git",
|
||||
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
|
||||
"reference": "9dc4f203e36f2b486149058bade43c851dd97451"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
|
||||
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
|
||||
"url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
|
||||
"reference": "9dc4f203e36f2b486149058bade43c851dd97451",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3399,6 +3399,7 @@
|
|||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan": "<0.12.20",
|
||||
"vimeo/psalm": "<3.9.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -3426,7 +3427,7 @@
|
|||
"check",
|
||||
"validate"
|
||||
],
|
||||
"time": "2020-04-18T12:12:48+00:00"
|
||||
"time": "2020-06-16T10:16:42+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
56
public/dist/scripts/app-all.js
vendored
56
public/dist/scripts/app-all.js
vendored
|
@ -15,9 +15,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
|||
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});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)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
||||
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;}
|
||||
request.onload=function(){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;}
|
||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(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);}
|
||||
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
||||
if(4===request.readyState&&399>=request.status){resolve(data);}else{reject(data);}};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+((Object.keys(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',path,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 account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
let path='/account';let payload={};if(email){payload['email']=email;}
|
||||
|
@ -51,10 +51,13 @@ return http.put(path,{'content-type':'application/json',},payload);},getSessions
|
|||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
||||
if(password){payload['password']=password;}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
||||
if(failure){payload['failure']=failure;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||
if(scopes){payload['scopes']=scopes;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
|
@ -65,26 +68,45 @@ return http.put(path,{'content-type':'application/json',},payload);}};let avatar
|
|||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
||||
if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload['name']=name;}
|
||||
if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(color){payload['color']=color;}
|
||||
if(background){payload['background']=background;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
||||
if(size){payload['size']=size;}
|
||||
if(margin){payload['margin']=margin;}
|
||||
if(download){payload['download']=download;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||
if(limit){payload['limit']=limit;}
|
||||
if(offset){payload['offset']=offset;}
|
||||
if(orderType){payload['orderType']=orderType;}
|
||||
|
@ -139,7 +161,7 @@ if(write){payload['write']=write;}
|
|||
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
||||
let path='/projects';let payload={};if(name){payload['name']=name;}
|
||||
if(teamId){payload['teamId']=teamId;}
|
||||
|
@ -305,15 +327,21 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
|||
if(write){payload['write']=write;}
|
||||
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
if(background){payload['background']=background;}
|
||||
if(output){payload['output']=output;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||
if(limit){payload['limit']=limit;}
|
||||
if(offset){payload['offset']=offset;}
|
||||
if(orderType){payload['orderType']=orderType;}
|
||||
|
|
56
public/dist/scripts/app-dep.js
vendored
56
public/dist/scripts/app-dep.js
vendored
|
@ -15,9 +15,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
|||
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});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)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
||||
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;}
|
||||
request.onload=function(){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;}
|
||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(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);}
|
||||
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
||||
if(4===request.readyState&&399>=request.status){resolve(data);}else{reject(data);}};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+((Object.keys(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',path,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 account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
let path='/account';let payload={};if(email){payload['email']=email;}
|
||||
|
@ -51,10 +51,13 @@ return http.put(path,{'content-type':'application/json',},payload);},getSessions
|
|||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
||||
if(password){payload['password']=password;}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
||||
if(failure){payload['failure']=failure;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||
if(scopes){payload['scopes']=scopes;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
||||
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
|
@ -65,26 +68,45 @@ return http.put(path,{'content-type':'application/json',},payload);}};let avatar
|
|||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
||||
if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload['name']=name;}
|
||||
if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(color){payload['color']=color;}
|
||||
if(background){payload['background']=background;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
||||
if(size){payload['size']=size;}
|
||||
if(margin){payload['margin']=margin;}
|
||||
if(download){payload['download']=download;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||
if(limit){payload['limit']=limit;}
|
||||
if(offset){payload['offset']=offset;}
|
||||
if(orderType){payload['orderType']=orderType;}
|
||||
|
@ -139,7 +161,7 @@ if(write){payload['write']=write;}
|
|||
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
||||
let path='/projects';let payload={};if(name){payload['name']=name;}
|
||||
if(teamId){payload['teamId']=teamId;}
|
||||
|
@ -305,15 +327,21 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
|||
if(write){payload['write']=write;}
|
||||
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
||||
if(height){payload['height']=height;}
|
||||
if(quality){payload['quality']=quality;}
|
||||
if(background){payload['background']=background;}
|
||||
if(output){payload['output']=output;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||
if(limit){payload['limit']=limit;}
|
||||
if(offset){payload['offset']=offset;}
|
||||
if(orderType){payload['orderType']=orderType;}
|
||||
|
|
|
@ -226,28 +226,27 @@
|
|||
}
|
||||
|
||||
request.onload = function () {
|
||||
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;
|
||||
}
|
||||
|
||||
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
||||
|
||||
if(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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
||||
|
||||
if(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);
|
||||
}
|
||||
|
||||
resolve(data);
|
||||
|
||||
} else {
|
||||
reject(new Error(request.statusText));
|
||||
reject(data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -745,10 +744,11 @@
|
|||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string[]} scopes
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||
if(provider === undefined) {
|
||||
throw new Error('Missing required parameter: "provider"');
|
||||
}
|
||||
|
@ -765,11 +765,30 @@
|
|||
payload['failure'] = failure;
|
||||
}
|
||||
|
||||
if(scopes) {
|
||||
payload['scopes'] = scopes;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -923,7 +942,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -968,7 +1002,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1000,7 +1049,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1044,7 +1108,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1088,7 +1167,93 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {number} width
|
||||
* @param {number} height
|
||||
* @param {string} color
|
||||
* @param {string} background
|
||||
* @throws {Error}
|
||||
* @return {string}
|
||||
*/
|
||||
getInitials: function(name = '', width = 500, height = 500, color = '', background = '') {
|
||||
let path = '/avatars/initials';
|
||||
|
||||
let payload = {};
|
||||
|
||||
if(name) {
|
||||
payload['name'] = name;
|
||||
}
|
||||
|
||||
if(width) {
|
||||
payload['width'] = width;
|
||||
}
|
||||
|
||||
if(height) {
|
||||
payload['height'] = height;
|
||||
}
|
||||
|
||||
if(color) {
|
||||
payload['color'] = color;
|
||||
}
|
||||
|
||||
if(background) {
|
||||
payload['background'] = background;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
payload['key'] = config.key;
|
||||
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -1135,7 +1300,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
@ -1979,9 +2159,9 @@
|
|||
/**
|
||||
* List Currencies
|
||||
*
|
||||
* List of all currencies, including currency symol, 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.
|
||||
* 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 {Error}
|
||||
* @return {Promise}
|
||||
|
@ -1991,6 +2171,26 @@
|
|||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'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 {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
getLanguages: function() {
|
||||
let path = '/locale/languages';
|
||||
|
||||
let payload = {};
|
||||
|
||||
return http
|
||||
.get(path, {
|
||||
'content-type': 'application/json',
|
||||
|
@ -3492,7 +3692,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -3547,7 +3762,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
@ -3580,7 +3810,22 @@
|
|||
|
||||
payload['key'] = config.key;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
let query = [];
|
||||
|
||||
for (let p in payload) {
|
||||
if(Array.isArray(payload[p])) {
|
||||
for (let index = 0; index < payload[p].length; index++) {
|
||||
let param = payload[p][index];
|
||||
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||
}
|
||||
}
|
||||
else {
|
||||
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||
}
|
||||
}
|
||||
|
||||
query = query.join("&");
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue