mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Updated SDKs
This commit is contained in:
1 parent
8a5e240131
commit
ef8a4e8c62
33 files changed
+2420
-165
No files matched your search
@@ -286,28 +286,6 @@
|
||||
}
|
||||
}(window.document);
|
||||
|
||||
let iframe = function(method, url, params) {
|
||||
let form = document.createElement('form');
|
||||
|
||||
form.setAttribute('method', method);
|
||||
form.setAttribute('action', config.endpoint + url);
|
||||
|
||||
for(let key in params) {
|
||||
if(params.hasOwnProperty(key)) {
|
||||
let hiddenField = document.createElement("input");
|
||||
hiddenField.setAttribute("type", "hidden");
|
||||
hiddenField.setAttribute("name", key);
|
||||
hiddenField.setAttribute("value", params[key]);
|
||||
|
||||
form.appendChild(hiddenField);
|
||||
}
|
||||
}
|
||||
|
||||
document.body.appendChild(form);
|
||||
|
||||
return form.submit();
|
||||
};
|
||||
|
||||
let account = {
|
||||
|
||||
/**
|
||||
@@ -768,21 +746,13 @@
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @throws {Error}
|
||||
* @return {string}
|
||||
* @return {Promise}
|
||||
*/
|
||||
createOAuth2Session: function(provider, success, failure) {
|
||||
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"');
|
||||
}
|
||||
|
||||
if(success === undefined) {
|
||||
throw new Error('Missing required parameter: "success"');
|
||||
}
|
||||
|
||||
if(failure === undefined) {
|
||||
throw new Error('Missing required parameter: "failure"');
|
||||
}
|
||||
|
||||
let path = '/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||
|
||||
let payload = {};
|
||||
@@ -798,8 +768,8 @@
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
|
||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1162,7 +1132,7 @@
|
||||
* modes](/docs/admin).
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {array} filters
|
||||
* @param {string[]} filters
|
||||
* @param {number} offset
|
||||
* @param {number} limit
|
||||
* @param {string} orderField
|
||||
@@ -1232,8 +1202,8 @@
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {object} data
|
||||
* @param {array} read
|
||||
* @param {array} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @param {string} parentDocument
|
||||
* @param {string} parentProperty
|
||||
* @param {string} parentPropertyType
|
||||
@@ -1328,8 +1298,8 @@
|
||||
* @param {string} collectionId
|
||||
* @param {string} documentId
|
||||
* @param {object} data
|
||||
* @param {array} read
|
||||
* @param {array} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
@@ -1435,7 +1405,7 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* List Countries
|
||||
* List Continents
|
||||
*
|
||||
* List of all continents. You can use the locale header to get the data in a
|
||||
* supported language.
|
||||
@@ -1587,8 +1557,8 @@
|
||||
* read and write arguments.
|
||||
*
|
||||
* @param {File} file
|
||||
* @param {array} read
|
||||
* @param {array} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
@@ -1659,8 +1629,8 @@
|
||||
* to update this resource.
|
||||
*
|
||||
* @param {string} fileId
|
||||
* @param {array} read
|
||||
* @param {array} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
@@ -1743,7 +1713,7 @@
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
||||
@@ -1796,7 +1766,7 @@
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
},
|
||||
|
||||
@@ -1827,7 +1797,7 @@
|
||||
payload['project'] = config.project;
|
||||
|
||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
||||
|
||||
|
||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||
}
|
||||
};
|
||||
@@ -1884,7 +1854,7 @@
|
||||
* project.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {array} roles
|
||||
* @param {string[]} roles
|
||||
* @throws {Error}
|
||||
* @return {Promise}
|
||||
*/
|
||||
@@ -2039,7 +2009,7 @@
|
||||
*
|
||||
* @param {string} teamId
|
||||
* @param {string} email
|
||||
* @param {array} roles
|
||||
* @param {string[]} roles
|
||||
* @param {string} url
|
||||
* @param {string} name
|
||||
* @throws {Error}
|
||||
|
||||
+3
-6
@@ -12,8 +12,7 @@ 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}
|
||||
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,!1)}
|
||||
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 iframe=function(method,url,params){let form=document.createElement('form');form.setAttribute('method',method);form.setAttribute('action',config.endpoint+url);for(let key in params){if(params.hasOwnProperty(key)){let hiddenField=document.createElement("input");hiddenField.setAttribute("type","hidden");hiddenField.setAttribute("name",key);hiddenField.setAttribute("value",params[key]);form.appendChild(hiddenField)}}
|
||||
document.body.appendChild(form);return form.submit()};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"')}
|
||||
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}
|
||||
if(password){payload.password=password}
|
||||
@@ -46,12 +45,10 @@ 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,failure){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
if(success===undefined){throw new Error('Missing required parameter: "success"')}
|
||||
if(failure===undefined){throw new Error('Missing required parameter: "failure"')}
|
||||
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"')}
|
||||
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('&');return config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||
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"')}
|
||||
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"')}
|
||||
|
||||
Reference in new issue
Block a user