Updated SDK
This commit is contained in:
parent
503561dad1
commit
58c91febbd
26 changed files with 140 additions and 130 deletions
|
@ -19,7 +19,7 @@ Add this to your package's pubspec.yaml file:
|
|||
|
||||
```yml
|
||||
dependencies:
|
||||
appwrite: ^0.0.1
|
||||
appwrite: ^0.0.2
|
||||
```
|
||||
|
||||
You can install packages from the command line:
|
||||
|
|
|
@ -12,7 +12,7 @@ class Client {
|
|||
this.endPoint = 'https://appwrite.test/v1';
|
||||
this.headers = {
|
||||
'content-type': 'application/json',
|
||||
'x-sdk-version': 'appwrite:dart:0.0.1',
|
||||
'x-sdk-version': 'appwrite:dart:0.0.2',
|
||||
};
|
||||
this.selfSigned = false;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ class Auth extends Service {
|
|||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
///
|
||||
/// When accessing this route using Javascript from the browser, success and
|
||||
/// failure parameter URLs are required. Appwrite server will respond with a
|
||||
/// 301 redirect status code and will set the user session cookie. This
|
||||
/// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
/// in XHR of fetch request to protect user privacy.
|
||||
/// When not using the success or failure redirect arguments this endpoint will
|
||||
/// result with a 200 status code and the user account object on success and
|
||||
/// with 401 status error on failure. This behavior was applied to help the web
|
||||
/// clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
/// needed for saving the account session token.
|
||||
Future<Response> login({email, password, success, failure}) async {
|
||||
String path = '/auth/login';
|
||||
|
||||
|
@ -80,12 +80,12 @@ class Auth extends Service {
|
|||
/// values attached to the URL query string. Use the query string params to
|
||||
/// submit a request to the /auth/password/reset endpoint to complete the
|
||||
/// process.
|
||||
Future<Response> recovery({email, confirmation}) async {
|
||||
Future<Response> recovery({email, redirect}) async {
|
||||
String path = '/auth/recovery';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'email': email,
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
};
|
||||
|
||||
return await this.client.call('post', path: path, params: params);
|
||||
|
@ -117,7 +117,7 @@ class Auth extends Service {
|
|||
///
|
||||
/// If registration completes successfully user will be sent with a
|
||||
/// confirmation email in order to confirm he is the owner of the account email
|
||||
/// address. Use the confirmation parameter to redirect the user from the
|
||||
/// address. Use the redirect parameter to redirect the user from the
|
||||
/// confirmation email back to your app. When the user is redirected, use the
|
||||
/// /auth/confirm endpoint to complete the account confirmation.
|
||||
///
|
||||
|
@ -126,18 +126,18 @@ class Auth extends Service {
|
|||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
///
|
||||
/// When accessing this route using Javascript from the browser, success and
|
||||
/// failure parameter URLs are required. Appwrite server will respond with a
|
||||
/// 301 redirect status code and will set the user session cookie. This
|
||||
/// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
/// in XHR of fetch request to protect user privacy.
|
||||
Future<Response> register({email, password, confirmation, success = null, failure = null, name = null}) async {
|
||||
/// When not using the success or failure redirect arguments this endpoint will
|
||||
/// result with a 200 status code and the user account object on success and
|
||||
/// with 401 status error on failure. This behavior was applied to help the web
|
||||
/// clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
/// needed for saving the account session token.
|
||||
Future<Response> register({email, password, redirect, success, failure, name = null}) async {
|
||||
String path = '/auth/register';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name,
|
||||
|
@ -167,11 +167,11 @@ class Auth extends Service {
|
|||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
Future<Response> confirmResend({confirmation}) async {
|
||||
Future<Response> confirmResend({redirect}) async {
|
||||
String path = '/auth/register/confirm/resend';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
};
|
||||
|
||||
return await this.client.call('post', path: path, params: params);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: appwrite
|
||||
version: 0.0.1
|
||||
version: 0.0.2
|
||||
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)
|
||||
author: Appwrite Team <team@appwrite.io>
|
||||
homepage: https://github.com/appwrite/sdk-for-dart
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.auth.register('email@example.com', 'password', 'https://example.com');
|
||||
let promise = sdk.auth.register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
|
||||
let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 0);
|
||||
let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', 1);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "appwrite",
|
||||
"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)",
|
||||
"version": "v1.0.20",
|
||||
"version": "1.0.21",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "src/sdk.js",
|
||||
"repository": {
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
globalParams.push({key: key, value: value});
|
||||
};
|
||||
|
||||
addGlobalHeader('x-sdk-version', 'appwrite:javascript:v1.0.20');
|
||||
addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.0.21');
|
||||
addGlobalHeader('content-type', '');
|
||||
|
||||
/**
|
||||
|
@ -500,11 +500,11 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
|
@ -648,16 +648,16 @@
|
|||
* process.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} confirmation
|
||||
* @param {string} redirect
|
||||
* @throws {Error}
|
||||
* @return {Promise} */
|
||||
recovery: function(email, confirmation) {
|
||||
recovery: function(email, redirect) {
|
||||
if(email === undefined) {
|
||||
throw new Error('Missing required parameter: "email"');
|
||||
}
|
||||
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
}
|
||||
|
||||
let path = '/auth/recovery';
|
||||
|
@ -666,7 +666,7 @@
|
|||
.post(path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -727,7 +727,7 @@
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -736,21 +736,21 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
* @param {string} confirmation
|
||||
* @param {string} redirect
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string} name
|
||||
* @throws {Error}
|
||||
* @return {null} */
|
||||
register: function(email, password, confirmation, success = '', failure = '', name = '') {
|
||||
register: function(email, password, redirect, success, failure, name = '') {
|
||||
if(email === undefined) {
|
||||
throw new Error('Missing required parameter: "email"');
|
||||
}
|
||||
|
@ -759,8 +759,16 @@
|
|||
throw new Error('Missing required parameter: "password"');
|
||||
}
|
||||
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
}
|
||||
|
||||
if(success === undefined) {
|
||||
throw new Error('Missing required parameter: "success"');
|
||||
}
|
||||
|
||||
if(failure === undefined) {
|
||||
throw new Error('Missing required parameter: "failure"');
|
||||
}
|
||||
|
||||
let path = '/auth/register';
|
||||
|
@ -768,7 +776,7 @@
|
|||
return iframe('post', path, {project: config.project,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -818,12 +826,12 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param {string} confirmation
|
||||
* @param {string} redirect
|
||||
* @throws {Error}
|
||||
* @return {Promise} */
|
||||
confirmResend: function(confirmation) {
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
confirmResend: function(redirect) {
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
}
|
||||
|
||||
let path = '/auth/register/confirm/resend';
|
||||
|
@ -831,7 +839,7 @@
|
|||
return http
|
||||
.post(path, {'content-type': 'application/json'},
|
||||
{
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
20
app/sdks/js/src/sdk.min.js
vendored
20
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]))}}
|
||||
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')}
|
||||
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:1.0.21');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 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)}
|
||||
|
@ -26,19 +26,21 @@ let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);return http.dele
|
|||
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,confirmation){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/recovery';return http.post(path,{'content-type':'application/json'},{'email':email,'confirmation':confirmation})},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
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"')}
|
||||
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(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')}
|
||||
if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB})},register:function(email,password,confirmation,success='',failure='',name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB})},register:function(email,password,redirect,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirmation':confirmation,'success':success,'failure':failure,'name':name})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||
if(success===undefined){throw new Error('Missing required parameter: "success"')}
|
||||
if(failure===undefined){throw new Error('Missing required parameter: "failure"')}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'redirect':redirect,'success':success,'failure':failure,'name':name})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
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(confirmation){if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'confirmation':confirmation})}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
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})}};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/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"')}
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = auth.register('email@example.com', 'password', 'https://example.com');
|
||||
let promise = auth.register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
||||
let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
|
||||
let promise = projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -7,7 +7,7 @@ class Client {
|
|||
this.endpoint = 'https://appwrite.test/v1';
|
||||
this.headers = {
|
||||
'content-type': '',
|
||||
'x-sdk-version': 'appwrite:nodejs:v1.0.24',
|
||||
'x-sdk-version': 'appwrite:nodejs:1.0.25',
|
||||
};
|
||||
this.selfSigned = false;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param string email
|
||||
* @param string password
|
||||
|
@ -126,17 +126,17 @@ class Auth extends Service {
|
|||
* process.
|
||||
*
|
||||
* @param string email
|
||||
* @param string confirmation
|
||||
* @param string redirect
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async recovery(email, confirmation) {
|
||||
async recovery(email, redirect) {
|
||||
let path = '/auth/recovery';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ class Auth extends Service {
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -190,29 +190,29 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param string email
|
||||
* @param string password
|
||||
* @param string confirmation
|
||||
* @param string redirect
|
||||
* @param string success
|
||||
* @param string failure
|
||||
* @param string name
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async register(email, password, confirmation, success = '', failure = '', name = '') {
|
||||
async register(email, password, redirect, success, failure, name = '') {
|
||||
let path = '/auth/register';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'password': password,
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -254,16 +254,16 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param string confirmation
|
||||
* @param string redirect
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async confirmResend(confirmation) {
|
||||
async confirmResend(redirect) {
|
||||
let path = '/auth/register/confirm/resend';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "node-appwrite",
|
||||
"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)",
|
||||
"version": "v1.0.24",
|
||||
"version": "1.0.25",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
|
|
@ -10,7 +10,7 @@ POST https://appwrite.test/v1/auth/login
|
|||
|
||||
Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.
|
||||
|
||||
When accessing this route using Javascript from the browser, success and failure parameter URLs are required. Appwrite server will respond with a 301 redirect status code and will set the user session cookie. This behavior is enforced because modern browsers are limiting 3rd party cookies in XHR of fetch request to protect user privacy. **
|
||||
When not using the success or failure redirect arguments this endpoint will result with a 200 status code and the user account object on success and with 401 status error on failure. This behavior was applied to help the web clients deal with browsers who don't allow to set 3rd party HTTP cookies needed for saving the account session token. **
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -85,7 +85,7 @@ POST https://appwrite.test/v1/auth/recovery
|
|||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| email | string | User account email address. | |
|
||||
| confirmation | string | Reset page URL in your app to redirect user after reset token has been sent to user email. | |
|
||||
| redirect | string | Reset page in your app to redirect user after reset token has been sent to user email. | |
|
||||
|
||||
## Password Reset
|
||||
|
||||
|
@ -114,11 +114,11 @@ POST https://appwrite.test/v1/auth/register
|
|||
|
||||
** Use this endpoint to allow a new user to register an account in your project. Use the success and failure URL's to redirect users back to your application after signup completes.
|
||||
|
||||
If registration completes successfully user will be sent with a confirmation email in order to confirm he is the owner of the account email address. Use the confirmation parameter to redirect the user from the confirmation email back to your app. When the user is redirected, use the /auth/confirm endpoint to complete the account confirmation.
|
||||
If registration completes successfully user will be sent with a confirmation email in order to confirm he is the owner of the account email address. Use the redirect parameter to redirect the user from the confirmation email back to your app. When the user is redirected, use the /auth/confirm endpoint to complete the account confirmation.
|
||||
|
||||
Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.
|
||||
|
||||
When accessing this route using Javascript from the browser, success and failure parameter URLs are required. Appwrite server will respond with a 301 redirect status code and will set the user session cookie. This behavior is enforced because modern browsers are limiting 3rd party cookies in XHR of fetch request to protect user privacy. **
|
||||
When not using the success or failure redirect arguments this endpoint will result with a 200 status code and the user account object on success and with 401 status error on failure. This behavior was applied to help the web clients deal with browsers who don't allow to set 3rd party HTTP cookies needed for saving the account session token. **
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -126,7 +126,7 @@ When accessing this route using Javascript from the browser, success and failure
|
|||
| --- | --- | --- | --- |
|
||||
| email | string | Account email | |
|
||||
| password | string | User password | |
|
||||
| confirmation | string | Confirmation URL to redirect user after confirm token has been sent to user email | |
|
||||
| redirect | string | Confirmation page to redirect user after confirm token has been sent to user email | |
|
||||
| success | string | Redirect when registration succeed | |
|
||||
| failure | string | Redirect when registration failed | |
|
||||
| name | string | User name | |
|
||||
|
@ -160,5 +160,5 @@ Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWA
|
|||
|
||||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| confirmation | 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. | |
|
||||
|
||||
|
|
|
@ -12,4 +12,4 @@ $client
|
|||
|
||||
$auth = new Auth($client);
|
||||
|
||||
$result = $auth->register('email@example.com', 'password', 'https://example.com');
|
||||
$result = $auth->register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
|
@ -37,7 +37,7 @@ class Client
|
|||
*/
|
||||
protected $headers = [
|
||||
'content-type' => '',
|
||||
'x-sdk-version' => 'appwrite:php:v1.0.7',
|
||||
'x-sdk-version' => 'appwrite:php:1.0.8',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,11 +20,11 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
|
@ -142,17 +142,17 @@ class Auth extends Service
|
|||
* process.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $confirmation
|
||||
* @param string $redirect
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function recovery($email, $confirmation)
|
||||
public function recovery($email, $redirect)
|
||||
{
|
||||
$path = str_replace([], [], '/auth/recovery');
|
||||
$params = [];
|
||||
|
||||
$params['email'] = $email;
|
||||
$params['confirmation'] = $confirmation;
|
||||
$params['redirect'] = $redirect;
|
||||
|
||||
return $this->client->call(Client::METHOD_POST, $path, [
|
||||
], $params);
|
||||
|
@ -201,7 +201,7 @@ class Auth extends Service
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -210,29 +210,29 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
* @param string $confirmation
|
||||
* @param string $redirect
|
||||
* @param string $success
|
||||
* @param string $failure
|
||||
* @param string $name
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function register($email, $password, $confirmation, $success = '', $failure = '', $name = '')
|
||||
public function register($email, $password, $redirect, $success, $failure, $name = '')
|
||||
{
|
||||
$path = str_replace([], [], '/auth/register');
|
||||
$params = [];
|
||||
|
||||
$params['email'] = $email;
|
||||
$params['password'] = $password;
|
||||
$params['confirmation'] = $confirmation;
|
||||
$params['redirect'] = $redirect;
|
||||
$params['success'] = $success;
|
||||
$params['failure'] = $failure;
|
||||
$params['name'] = $name;
|
||||
|
@ -278,16 +278,16 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param string $confirmation
|
||||
* @param string $redirect
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function confirmResend($confirmation)
|
||||
public function confirmResend($redirect)
|
||||
{
|
||||
$path = str_replace([], [], '/auth/register/confirm/resend');
|
||||
$params = [];
|
||||
|
||||
$params['confirmation'] = $confirmation;
|
||||
$params['redirect'] = $redirect;
|
||||
|
||||
return $this->client->call(Client::METHOD_POST, $path, [
|
||||
], $params);
|
||||
|
|
|
@ -7,7 +7,7 @@ class Client:
|
|||
self._endpoint = 'https://appwrite.test/v1'
|
||||
self._global_headers = {
|
||||
'content-type': '',
|
||||
'x-sdk-version': 'appwrite:python:v1.0.0',
|
||||
'x-sdk-version': 'appwrite:python:1.0.0',
|
||||
}
|
||||
|
||||
def set_self_signed(self, status=True):
|
||||
|
|
|
@ -60,13 +60,13 @@ class Auth(Service):
|
|||
return self.client.call('get', path, {
|
||||
}, params)
|
||||
|
||||
def recovery(self, email, confirmation):
|
||||
def recovery(self, email, redirect):
|
||||
"""Password Recovery"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/recovery'
|
||||
params['email'] = email
|
||||
params['confirmation'] = confirmation
|
||||
params['redirect'] = redirect
|
||||
|
||||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
@ -84,14 +84,14 @@ class Auth(Service):
|
|||
return self.client.call('put', path, {
|
||||
}, params)
|
||||
|
||||
def register(self, email, password, confirmation, success='', failure='', name=''):
|
||||
def register(self, email, password, redirect, success, failure, name=''):
|
||||
"""Register User"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register'
|
||||
params['email'] = email
|
||||
params['password'] = password
|
||||
params['confirmation'] = confirmation
|
||||
params['redirect'] = redirect
|
||||
params['success'] = success
|
||||
params['failure'] = failure
|
||||
params['name'] = name
|
||||
|
@ -110,12 +110,12 @@ class Auth(Service):
|
|||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
||||
def confirm_resend(self, confirmation):
|
||||
def confirm_resend(self, redirect):
|
||||
"""Resend Confirmation"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register/confirm/resend'
|
||||
params['confirmation'] = confirmation
|
||||
params['redirect'] = redirect
|
||||
|
||||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
|
|
@ -3,7 +3,7 @@ from distutils.core import setup
|
|||
setup(
|
||||
name = 'appwrite',
|
||||
packages = ['appwrite'],
|
||||
version = 'v1.0.0',
|
||||
version = '1.0.0',
|
||||
license='BSD-3-Clause',
|
||||
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)',
|
||||
author = 'Appwrite Team',
|
||||
|
@ -11,7 +11,7 @@ setup(
|
|||
maintainer = 'Appwrite Team',
|
||||
maintainer_email = 'team@appwrite.io',
|
||||
url = 'https://appwrite.io/support',
|
||||
download_url='https://github.com/appwrite/sdk-for-python/archive/v1.0.0.tar.gz',
|
||||
download_url='https://github.com/appwrite/sdk-for-python/archive/1.0.0.tar.gz',
|
||||
# keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'],
|
||||
install_requires=[
|
||||
'requests',
|
||||
|
|
|
@ -19,7 +19,7 @@ module Appwrite
|
|||
@headers = {
|
||||
'content-type': '',
|
||||
'user-agent': RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
|
||||
'x-sdk-version': 'appwrite:ruby:v1.0.0'
|
||||
'x-sdk-version': 'appwrite:ruby:1.0.1'
|
||||
}
|
||||
@endpoint = 'https://appwrite.test/v1';
|
||||
end
|
||||
|
|
|
@ -63,12 +63,12 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def recovery(email:, confirmation:)
|
||||
def recovery(email:, redirect:)
|
||||
path = '/auth/recovery'
|
||||
|
||||
params = {
|
||||
'email': email,
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
}
|
||||
|
||||
return @client.call('post', path, {
|
||||
|
@ -89,13 +89,13 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def register(email:, password:, confirmation:, success: '', failure: '', name: '')
|
||||
def register(email:, password:, redirect:, success:, failure:, name: '')
|
||||
path = '/auth/register'
|
||||
|
||||
params = {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'confirmation': confirmation,
|
||||
'redirect': redirect,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -117,11 +117,11 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def confirm_resend(confirmation:)
|
||||
def confirm_resend(redirect:)
|
||||
path = '/auth/register/confirm/resend'
|
||||
|
||||
params = {
|
||||
'confirmation': confirmation
|
||||
'redirect': redirect
|
||||
}
|
||||
|
||||
return @client.call('post', path, {
|
||||
|
|
|
@ -98,7 +98,7 @@ $cli
|
|||
];
|
||||
|
||||
foreach ($clients as $name => $client) {
|
||||
Console::success('Fetching API Spec for ' . $name . ' (' . $client['platform'] . ')');
|
||||
Console::info('Fetching API Spec for ' . $name . ' (' . $client['platform'] . ')');
|
||||
$spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1&platform=' . $client['platform']);
|
||||
$spec = getSSLPage('https://appwrite.test/v1/open-api-2.json?extensions=1&platform=' . $client['platform']);
|
||||
|
||||
|
|
Loading…
Reference in a new issue