Updated SDKs
This commit is contained in:
parent
585b16559c
commit
11440f8bc1
15 changed files with 238 additions and 238 deletions
|
@ -5,7 +5,7 @@ sdk
|
||||||
setKey('')
|
setKey('')
|
||||||
;
|
;
|
||||||
|
|
||||||
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||||
|
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "appwrite",
|
"name": "appwrite",
|
||||||
"homepage": "https://appwrite.io/support",
|
"homepage": "https://appwrite.io/support",
|
||||||
"description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
|
"description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
|
||||||
"version": "v1.0.19",
|
"version": "v1.0.20",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"main": "src/sdk.js",
|
"main": "src/sdk.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
globalParams.push({key: key, value: value});
|
globalParams.push({key: key, value: value});
|
||||||
};
|
};
|
||||||
|
|
||||||
addGlobalHeader('x-sdk-version', 'appwrite:javascript:v1.0.19');
|
addGlobalHeader('x-sdk-version', 'appwrite:javascript:v1.0.20');
|
||||||
addGlobalHeader('content-type', '');
|
addGlobalHeader('content-type', '');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -572,6 +572,63 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Callback
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param {string} projectId
|
||||||
|
* @param {string} provider
|
||||||
|
* @param {string} code
|
||||||
|
* @param {string} state
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise} */
|
||||||
|
oauthCallback: function(projectId, provider, code, state = '') {
|
||||||
|
if(projectId === undefined) {
|
||||||
|
throw new Error('Missing required parameter: "projectId"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(provider === undefined) {
|
||||||
|
throw new Error('Missing required parameter: "provider"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(code === undefined) {
|
||||||
|
throw new Error('Missing required parameter: "code"');
|
||||||
|
}
|
||||||
|
|
||||||
|
let path = '/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
|
||||||
|
|
||||||
|
return http
|
||||||
|
.get(path, {'content-type': 'application/json'},
|
||||||
|
{
|
||||||
|
'code': code,
|
||||||
|
'state': state
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Login
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param {string} provider
|
||||||
|
* @param {string} success
|
||||||
|
* @param {string} failure
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise} */
|
||||||
|
oauth: function(provider, success = '', failure = '') {
|
||||||
|
if(provider === undefined) {
|
||||||
|
throw new Error('Missing required parameter: "provider"');
|
||||||
|
}
|
||||||
|
|
||||||
|
let path = '/auth/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||||
|
|
||||||
|
return http
|
||||||
|
.get(path, {'content-type': 'application/json'},
|
||||||
|
{
|
||||||
|
'success': success,
|
||||||
|
'failure': failure
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password Recovery
|
* Password Recovery
|
||||||
*
|
*
|
||||||
|
@ -768,63 +825,6 @@
|
||||||
{
|
{
|
||||||
'redirect': redirect
|
'redirect': redirect
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Callback
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param {string} projectId
|
|
||||||
* @param {string} provider
|
|
||||||
* @param {string} code
|
|
||||||
* @param {string} state
|
|
||||||
* @throws {Error}
|
|
||||||
* @return {Promise} */
|
|
||||||
oauthCallback: function(projectId, provider, code, state = '') {
|
|
||||||
if(projectId === undefined) {
|
|
||||||
throw new Error('Missing required parameter: "projectId"');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(provider === undefined) {
|
|
||||||
throw new Error('Missing required parameter: "provider"');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(code === undefined) {
|
|
||||||
throw new Error('Missing required parameter: "code"');
|
|
||||||
}
|
|
||||||
|
|
||||||
let path = '/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
|
|
||||||
|
|
||||||
return http
|
|
||||||
.get(path, {'content-type': 'application/json'},
|
|
||||||
{
|
|
||||||
'code': code,
|
|
||||||
'state': state
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Login
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param {string} provider
|
|
||||||
* @param {string} success
|
|
||||||
* @param {string} failure
|
|
||||||
* @throws {Error}
|
|
||||||
* @return {Promise} */
|
|
||||||
oauth: function(provider, success = '', failure = '') {
|
|
||||||
if(provider === undefined) {
|
|
||||||
throw new Error('Missing required parameter: "provider"');
|
|
||||||
}
|
|
||||||
|
|
||||||
let path = '/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
|
||||||
|
|
||||||
return http
|
|
||||||
.get(path, {'content-type': 'application/json'},
|
|
||||||
{
|
|
||||||
'success': success,
|
|
||||||
'failure': failure
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
14
app/sdks/js/src/sdk.min.js
vendored
14
app/sdks/js/src/sdk.min.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
(function(window){window.Appwrite=function(){let config={endpoint:'https://appwrite.test/v1',project:'',key:'',locale:'',mode:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this};let setProject=function(value){http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this};let setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;index<params[p].length;index++){let param=params[p][index];str.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{str.push(encodeURIComponent(p)+"="+encodeURIComponent(params[p]))}}
|
(function(window){window.Appwrite=function(){let config={endpoint:'https://appwrite.test/v1',project:'',key:'',locale:'',mode:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this};let setProject=function(value){http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this};let setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;index<params[p].length;index++){let param=params[p][index];str.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{str.push(encodeURIComponent(p)+"="+encodeURIComponent(params[p]))}}
|
||||||
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:v1.0.19');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
|
return str.join("&")};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()}};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value})};addGlobalHeader('x-sdk-version','appwrite:javascript:v1.0.20');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name')}
|
||||||
if(typeof path!=='string'){throw new Error('var path must be of type string')}
|
if(typeof path!=='string'){throw new Error('var path must be of type string')}
|
||||||
if(typeof headers!=='object'){throw new Error('var headers must be of type object')}
|
if(typeof headers!=='object'){throw new Error('var headers must be of type object')}
|
||||||
for(i=0;i<globalParams.length;i++){path=addParam(path,globalParams[i].key,globalParams[i].value)}
|
for(i=0;i<globalParams.length;i++){path=addParam(path,globalParams[i].key,globalParams[i].value)}
|
||||||
|
@ -20,7 +20,11 @@ let path='/account/password';return http.patch(path,{'content-type':'application
|
||||||
let path='/account/prefs';return http.patch(path,{'content-type':'application/json'},{'prefs':prefs})},getSecurity:function(){let path='/account/security';return http.get(path,{'content-type':'application/json'},{})},getSessions:function(){let path='/account/sessions';return http.get(path,{'content-type':'application/json'},{})}};let auth={login:function(email,password,success='',failure=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
let path='/account/prefs';return http.patch(path,{'content-type':'application/json'},{'prefs':prefs})},getSecurity:function(){let path='/account/security';return http.get(path,{'content-type':'application/json'},{})},getSessions:function(){let path='/account/sessions';return http.get(path,{'content-type':'application/json'},{})}};let auth={login:function(email,password,success='',failure=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||||
let path='/auth/login';return iframe('post',path,{project:config.project,'email':email,'password':password,'success':success,'failure':failure})},logout:function(){let path='/auth/logout';return http.delete(path,{'content-type':'application/json'},{})},logoutBySession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')}
|
let path='/auth/login';return iframe('post',path,{project:config.project,'email':email,'password':password,'success':success,'failure':failure})},logout:function(){let path='/auth/logout';return http.delete(path,{'content-type':'application/json'},{})},logoutBySession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')}
|
||||||
let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);return http.delete(path,{'content-type':'application/json'},{})},recovery:function(email,redirect){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);return http.delete(path,{'content-type':'application/json'},{})},oauthCallback:function(projectId,provider,code,state=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
||||||
|
if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||||
|
if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
|
let path='/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'code':code,'state':state})},oauth:function(provider,success='',failure=''){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||||
|
let path='/auth/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'success':success,'failure':failure})},recovery:function(email,redirect){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||||
if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||||
let path='/auth/recovery';return http.post(path,{'content-type':'application/json'},{'email':email,'redirect':redirect})},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
let path='/auth/recovery';return http.post(path,{'content-type':'application/json'},{'email':email,'redirect':redirect})},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||||
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
||||||
|
@ -32,11 +36,7 @@ if(redirect===undefined){throw new Error('Missing required parameter: "redirect"
|
||||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'name':name,'redirect':redirect,'success':success,'failure':failure})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'name':name,'redirect':redirect,'success':success,'failure':failure})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||||
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
||||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token})},confirmResend:function(redirect){if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token})},confirmResend:function(redirect){if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'redirect':redirect})},oauthCallback:function(projectId,provider,code,state=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')}
|
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'redirect':redirect})}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
|
||||||
if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
|
||||||
let path='/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'code':code,'state':state})},oauth:function(provider,success='',failure=''){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
|
||||||
let path='/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'success':success,'failure':failure})}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
|
||||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},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);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/avatars/favicon';return http.get(path,{'content-type':'application/json'},{'url':url})},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
let path='/avatars/favicon';return http.get(path,{'content-type':'application/json'},{'url':url})},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
|
|
|
@ -5,7 +5,7 @@ sdk
|
||||||
setKey('')
|
setKey('')
|
||||||
;
|
;
|
||||||
|
|
||||||
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||||
|
|
||||||
promise.then(function (response) {
|
promise.then(function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Client {
|
||||||
this.endpoint = 'https://appwrite.test/v1';
|
this.endpoint = 'https://appwrite.test/v1';
|
||||||
this.headers = {
|
this.headers = {
|
||||||
'content-type': '',
|
'content-type': '',
|
||||||
'x-sdk-version': 'appwrite:nodejs:v1.0.23',
|
'x-sdk-version': 'appwrite:nodejs:v1.0.24',
|
||||||
};
|
};
|
||||||
this.selfSigned = false;
|
this.selfSigned = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,45 @@ class Auth extends Service {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Callback
|
||||||
|
*
|
||||||
|
* @param string projectId
|
||||||
|
* @param string provider
|
||||||
|
* @param string code
|
||||||
|
* @param string state
|
||||||
|
* @throws Exception
|
||||||
|
* @return {}
|
||||||
|
*/
|
||||||
|
async oauthCallback(projectId, provider, code, state = '') {
|
||||||
|
let path = '/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
|
||||||
|
|
||||||
|
return await this.client.call('get', path, {'content-type': 'application/json'},
|
||||||
|
{
|
||||||
|
'code': code,
|
||||||
|
'state': state
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Login
|
||||||
|
*
|
||||||
|
* @param string provider
|
||||||
|
* @param string success
|
||||||
|
* @param string failure
|
||||||
|
* @throws Exception
|
||||||
|
* @return {}
|
||||||
|
*/
|
||||||
|
async oauth(provider, success = '', failure = '') {
|
||||||
|
let path = '/auth/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||||
|
|
||||||
|
return await this.client.call('get', path, {'content-type': 'application/json'},
|
||||||
|
{
|
||||||
|
'success': success,
|
||||||
|
'failure': failure
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password Recovery
|
* Password Recovery
|
||||||
*
|
*
|
||||||
|
@ -227,45 +266,6 @@ class Auth extends Service {
|
||||||
'redirect': redirect
|
'redirect': redirect
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Callback
|
|
||||||
*
|
|
||||||
* @param string projectId
|
|
||||||
* @param string provider
|
|
||||||
* @param string code
|
|
||||||
* @param string state
|
|
||||||
* @throws Exception
|
|
||||||
* @return {}
|
|
||||||
*/
|
|
||||||
async oauthCallback(projectId, provider, code, state = '') {
|
|
||||||
let path = '/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider);
|
|
||||||
|
|
||||||
return await this.client.call('get', path, {'content-type': 'application/json'},
|
|
||||||
{
|
|
||||||
'code': code,
|
|
||||||
'state': state
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Login
|
|
||||||
*
|
|
||||||
* @param string provider
|
|
||||||
* @param string success
|
|
||||||
* @param string failure
|
|
||||||
* @throws Exception
|
|
||||||
* @return {}
|
|
||||||
*/
|
|
||||||
async oauth(provider, success = '', failure = '') {
|
|
||||||
let path = '/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
|
||||||
|
|
||||||
return await this.client.call('get', path, {'content-type': 'application/json'},
|
|
||||||
{
|
|
||||||
'success': success,
|
|
||||||
'failure': failure
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Auth;
|
module.exports = Auth;
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "node-appwrite",
|
"name": "node-appwrite",
|
||||||
"homepage": "https://appwrite.io/support",
|
"homepage": "https://appwrite.io/support",
|
||||||
"description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
|
"description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)",
|
||||||
"version": "v1.0.23",
|
"version": "v1.0.24",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -43,6 +43,35 @@ DELETE https://appwrite.test/v1/auth/logout/{id}
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| id | string | **Required** User specific session unique ID number. if 0 delete all sessions. | |
|
| id | string | **Required** User specific session unique ID number. if 0 delete all sessions. | |
|
||||||
|
|
||||||
|
## OAuth Callback
|
||||||
|
|
||||||
|
```http request
|
||||||
|
GET https://appwrite.test/v1/auth/oauth/callback/{provider}/{projectId}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
| Field Name | Type | Description | Default |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| projectId | string | **Required** Project unique ID | |
|
||||||
|
| provider | string | **Required** OAuth provider | |
|
||||||
|
| code | string | **Required** OAuth code | |
|
||||||
|
| state | string | Login state params | |
|
||||||
|
|
||||||
|
## OAuth Login
|
||||||
|
|
||||||
|
```http request
|
||||||
|
GET https://appwrite.test/v1/auth/oauth/{provider}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
| Field Name | Type | Description | Default |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| provider | string | **Required** OAuth Provider | |
|
||||||
|
| success | string | URL to redirect back to your app after a successful login attempt. | |
|
||||||
|
| failure | string | URL to redirect back to your app after a failed login attempt. | |
|
||||||
|
|
||||||
## Password Recovery
|
## Password Recovery
|
||||||
|
|
||||||
```http request
|
```http request
|
||||||
|
@ -133,32 +162,3 @@ Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWA
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| redirect | string | Confirmation page to redirect user to your app after confirm token has been sent to user email. | |
|
| redirect | string | Confirmation page to redirect user to your app after confirm token has been sent to user email. | |
|
||||||
|
|
||||||
## OAuth Callback
|
|
||||||
|
|
||||||
```http request
|
|
||||||
GET https://appwrite.test/v1/oauth/callback/{provider}/{projectId}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
| Field Name | Type | Description | Default |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| projectId | string | **Required** Project unique ID | |
|
|
||||||
| provider | string | **Required** OAuth provider | |
|
|
||||||
| code | string | **Required** OAuth code | |
|
|
||||||
| state | string | Login state params | |
|
|
||||||
|
|
||||||
## OAuth Login
|
|
||||||
|
|
||||||
```http request
|
|
||||||
GET https://appwrite.test/v1/oauth/{provider}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
| Field Name | Type | Description | Default |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| provider | string | **Required** OAuth Provider | |
|
|
||||||
| success | string | URL to redirect back to your app after a successful login attempt. | |
|
|
||||||
| failure | string | URL to redirect back to your app after a failed login attempt. | |
|
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,4 @@ $client
|
||||||
|
|
||||||
$projects = new Projects($client);
|
$projects = new Projects($client);
|
||||||
|
|
||||||
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
|
@ -37,7 +37,7 @@ class Client
|
||||||
*/
|
*/
|
||||||
protected $headers = [
|
protected $headers = [
|
||||||
'content-type' => '',
|
'content-type' => '',
|
||||||
'x-sdk-version' => 'appwrite:php:v1.0.6',
|
'x-sdk-version' => 'appwrite:php:v1.0.7',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,6 +88,49 @@ class Auth extends Service
|
||||||
], $params);
|
], $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Callback
|
||||||
|
*
|
||||||
|
* @param string $projectId
|
||||||
|
* @param string $provider
|
||||||
|
* @param string $code
|
||||||
|
* @param string $state
|
||||||
|
* @throws Exception
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function oauthCallback($projectId, $provider, $code, $state = '')
|
||||||
|
{
|
||||||
|
$path = str_replace(['{projectId}', '{provider}'], [$projectId, $provider], '/auth/oauth/callback/{provider}/{projectId}');
|
||||||
|
$params = [];
|
||||||
|
|
||||||
|
$params['code'] = $code;
|
||||||
|
$params['state'] = $state;
|
||||||
|
|
||||||
|
return $this->client->call(Client::METHOD_GET, $path, [
|
||||||
|
], $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth Login
|
||||||
|
*
|
||||||
|
* @param string $provider
|
||||||
|
* @param string $success
|
||||||
|
* @param string $failure
|
||||||
|
* @throws Exception
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function oauth($provider, $success = '', $failure = '')
|
||||||
|
{
|
||||||
|
$path = str_replace(['{provider}'], [$provider], '/auth/oauth/{provider}');
|
||||||
|
$params = [];
|
||||||
|
|
||||||
|
$params['success'] = $success;
|
||||||
|
$params['failure'] = $failure;
|
||||||
|
|
||||||
|
return $this->client->call(Client::METHOD_GET, $path, [
|
||||||
|
], $params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password Recovery
|
* Password Recovery
|
||||||
*
|
*
|
||||||
|
@ -250,47 +293,4 @@ class Auth extends Service
|
||||||
], $params);
|
], $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Callback
|
|
||||||
*
|
|
||||||
* @param string $projectId
|
|
||||||
* @param string $provider
|
|
||||||
* @param string $code
|
|
||||||
* @param string $state
|
|
||||||
* @throws Exception
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function oauthCallback($projectId, $provider, $code, $state = '')
|
|
||||||
{
|
|
||||||
$path = str_replace(['{projectId}', '{provider}'], [$projectId, $provider], '/oauth/callback/{provider}/{projectId}');
|
|
||||||
$params = [];
|
|
||||||
|
|
||||||
$params['code'] = $code;
|
|
||||||
$params['state'] = $state;
|
|
||||||
|
|
||||||
return $this->client->call(Client::METHOD_GET, $path, [
|
|
||||||
], $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OAuth Login
|
|
||||||
*
|
|
||||||
* @param string $provider
|
|
||||||
* @param string $success
|
|
||||||
* @param string $failure
|
|
||||||
* @throws Exception
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function oauth($provider, $success = '', $failure = '')
|
|
||||||
{
|
|
||||||
$path = str_replace(['{provider}'], [$provider], '/oauth/{provider}');
|
|
||||||
$params = [];
|
|
||||||
|
|
||||||
$params['success'] = $success;
|
|
||||||
$params['failure'] = $failure;
|
|
||||||
|
|
||||||
return $this->client->call(Client::METHOD_GET, $path, [
|
|
||||||
], $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,31 @@ class Auth(Service):
|
||||||
return self.client.call('delete', path, {
|
return self.client.call('delete', path, {
|
||||||
}, params)
|
}, params)
|
||||||
|
|
||||||
|
def oauth_callback(self, project_id, provider, code, state=''):
|
||||||
|
"""OAuth Callback"""
|
||||||
|
|
||||||
|
params = {}
|
||||||
|
path = '/auth/oauth/callback/{provider}/{projectId}'
|
||||||
|
path.replace('{projectId}', project_id)
|
||||||
|
path.replace('{provider}', provider)
|
||||||
|
params['code'] = code
|
||||||
|
params['state'] = state
|
||||||
|
|
||||||
|
return self.client.call('get', path, {
|
||||||
|
}, params)
|
||||||
|
|
||||||
|
def oauth(self, provider, success='', failure=''):
|
||||||
|
"""OAuth Login"""
|
||||||
|
|
||||||
|
params = {}
|
||||||
|
path = '/auth/oauth/{provider}'
|
||||||
|
path.replace('{provider}', provider)
|
||||||
|
params['success'] = success
|
||||||
|
params['failure'] = failure
|
||||||
|
|
||||||
|
return self.client.call('get', path, {
|
||||||
|
}, params)
|
||||||
|
|
||||||
def recovery(self, email, redirect):
|
def recovery(self, email, redirect):
|
||||||
"""Password Recovery"""
|
"""Password Recovery"""
|
||||||
|
|
||||||
|
@ -94,28 +119,3 @@ class Auth(Service):
|
||||||
|
|
||||||
return self.client.call('post', path, {
|
return self.client.call('post', path, {
|
||||||
}, params)
|
}, params)
|
||||||
|
|
||||||
def oauth_callback(self, project_id, provider, code, state=''):
|
|
||||||
"""OAuth Callback"""
|
|
||||||
|
|
||||||
params = {}
|
|
||||||
path = '/oauth/callback/{provider}/{projectId}'
|
|
||||||
path.replace('{projectId}', project_id)
|
|
||||||
path.replace('{provider}', provider)
|
|
||||||
params['code'] = code
|
|
||||||
params['state'] = state
|
|
||||||
|
|
||||||
return self.client.call('get', path, {
|
|
||||||
}, params)
|
|
||||||
|
|
||||||
def oauth(self, provider, success='', failure=''):
|
|
||||||
"""OAuth Login"""
|
|
||||||
|
|
||||||
params = {}
|
|
||||||
path = '/oauth/{provider}'
|
|
||||||
path.replace('{provider}', provider)
|
|
||||||
params['success'] = success
|
|
||||||
params['failure'] = failure
|
|
||||||
|
|
||||||
return self.client.call('get', path, {
|
|
||||||
}, params)
|
|
||||||
|
|
|
@ -36,6 +36,33 @@ module Appwrite
|
||||||
}, params);
|
}, params);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def oauth_callback(project_id:, provider:, code:, state: '')
|
||||||
|
path = '/auth/oauth/callback/{provider}/{projectId}'
|
||||||
|
.gsub('{project_id}', project_id)
|
||||||
|
.gsub('{provider}', provider)
|
||||||
|
|
||||||
|
params = {
|
||||||
|
'code': code,
|
||||||
|
'state': state
|
||||||
|
}
|
||||||
|
|
||||||
|
return @client.call('get', path, {
|
||||||
|
}, params);
|
||||||
|
end
|
||||||
|
|
||||||
|
def oauth(provider:, success: '', failure: '')
|
||||||
|
path = '/auth/oauth/{provider}'
|
||||||
|
.gsub('{provider}', provider)
|
||||||
|
|
||||||
|
params = {
|
||||||
|
'success': success,
|
||||||
|
'failure': failure
|
||||||
|
}
|
||||||
|
|
||||||
|
return @client.call('get', path, {
|
||||||
|
}, params);
|
||||||
|
end
|
||||||
|
|
||||||
def recovery(email:, redirect:)
|
def recovery(email:, redirect:)
|
||||||
path = '/auth/recovery'
|
path = '/auth/recovery'
|
||||||
|
|
||||||
|
@ -101,33 +128,6 @@ module Appwrite
|
||||||
}, params);
|
}, params);
|
||||||
end
|
end
|
||||||
|
|
||||||
def oauth_callback(project_id:, provider:, code:, state: '')
|
|
||||||
path = '/oauth/callback/{provider}/{projectId}'
|
|
||||||
.gsub('{project_id}', project_id)
|
|
||||||
.gsub('{provider}', provider)
|
|
||||||
|
|
||||||
params = {
|
|
||||||
'code': code,
|
|
||||||
'state': state
|
|
||||||
}
|
|
||||||
|
|
||||||
return @client.call('get', path, {
|
|
||||||
}, params);
|
|
||||||
end
|
|
||||||
|
|
||||||
def oauth(provider:, success: '', failure: '')
|
|
||||||
path = '/oauth/{provider}'
|
|
||||||
.gsub('{provider}', provider)
|
|
||||||
|
|
||||||
params = {
|
|
||||||
'success': success,
|
|
||||||
'failure': failure
|
|
||||||
}
|
|
||||||
|
|
||||||
return @client.call('get', path, {
|
|
||||||
}, params);
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ $cli
|
||||||
|
|
||||||
$clients = [
|
$clients = [
|
||||||
'php' => [
|
'php' => [
|
||||||
'version' => 'v1.0.6',
|
'version' => 'v1.0.7',
|
||||||
'result' => __DIR__ . '/../sdks/php/',
|
'result' => __DIR__ . '/../sdks/php/',
|
||||||
'gitURL' => 'https://github.com/appwrite/sdk-for-php.git',
|
'gitURL' => 'https://github.com/appwrite/sdk-for-php.git',
|
||||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-php.git',
|
'gitRepo' => 'git@github.com:appwrite/sdk-for-php.git',
|
||||||
|
@ -47,7 +47,7 @@ $cli
|
||||||
'warning' => '',
|
'warning' => '',
|
||||||
],
|
],
|
||||||
'js' => [
|
'js' => [
|
||||||
'version' => 'v1.0.19',
|
'version' => 'v1.0.20',
|
||||||
'result' => __DIR__ . '/../sdks/js/',
|
'result' => __DIR__ . '/../sdks/js/',
|
||||||
'gitURL' => 'https://github.com/appwrite/sdk-for-js.git',
|
'gitURL' => 'https://github.com/appwrite/sdk-for-js.git',
|
||||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-js.git',
|
'gitRepo' => 'git@github.com:appwrite/sdk-for-js.git',
|
||||||
|
@ -56,7 +56,7 @@ $cli
|
||||||
'warning' => '',
|
'warning' => '',
|
||||||
],
|
],
|
||||||
'node' => [
|
'node' => [
|
||||||
'version' => 'v1.0.23',
|
'version' => 'v1.0.24',
|
||||||
'result' => __DIR__ . '/../sdks/node/',
|
'result' => __DIR__ . '/../sdks/node/',
|
||||||
'gitURL' => 'https://github.com/appwrite/sdk-for-node.git',
|
'gitURL' => 'https://github.com/appwrite/sdk-for-node.git',
|
||||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-node.git',
|
'gitRepo' => 'git@github.com:appwrite/sdk-for-node.git',
|
||||||
|
|
Loading…
Reference in a new issue