Updated SDKs
This commit is contained in:
parent
72bcd35dce
commit
04e9fe1682
12 changed files with 171 additions and 174 deletions
|
@ -31,6 +31,16 @@ class Auth extends Service {
|
|||
};
|
||||
|
||||
return await this.client.call('post', path: path, params: params);
|
||||
}
|
||||
Future<Response> oauth({provider, success, failure}) async {
|
||||
String path = '/auth/login/oauth/{provider}'.replaceAll(RegExp('{provider}'), provider);
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
};
|
||||
|
||||
return await this.client.call('get', path: path, params: params);
|
||||
}
|
||||
/// Use this endpoint to log out the currently logged in user from his account.
|
||||
/// When successful this endpoint will delete the user session and remove the
|
||||
|
@ -53,16 +63,6 @@ class Auth extends Service {
|
|||
};
|
||||
|
||||
return await this.client.call('delete', path: path, params: params);
|
||||
}
|
||||
Future<Response> oauth({provider, success, failure}) async {
|
||||
String path = '/auth/oauth/{provider}'.replaceAll(RegExp('{provider}'), provider);
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
};
|
||||
|
||||
return await this.client.call('get', path: path, params: params);
|
||||
}
|
||||
/// Sends the user an email with a temporary secret token for password reset.
|
||||
/// When the user clicks the confirmation link he is redirected back to your
|
||||
|
|
|
@ -36,6 +36,19 @@ func (srv *Auth) Login(Email string, Password string, Success string, Failure st
|
|||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// Oauth
|
||||
func (srv *Auth) Oauth(Provider string, Success string, Failure string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{provider}", Provider)
|
||||
path := r.Replace("/auth/login/oauth/{provider}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"success": Success,
|
||||
"failure": Failure,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// Logout use this endpoint to log out the currently logged in user from his
|
||||
// account. When successful this endpoint will delete the user session and
|
||||
// remove the session secret cookie from the user client.
|
||||
|
@ -62,19 +75,6 @@ func (srv *Auth) LogoutBySession(Id string) (map[string]interface{}, error) {
|
|||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// Oauth
|
||||
func (srv *Auth) Oauth(Provider string, Success string, Failure string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{provider}", Provider)
|
||||
path := r.Replace("/auth/oauth/{provider}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"success": Success,
|
||||
"failure": Failure,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// Recovery sends the user an email with a temporary secret token for password
|
||||
// reset. When the user clicks the confirmation link he is redirected back to
|
||||
// your app password reset redirect URL with a secret token and email address
|
||||
|
|
|
@ -535,7 +535,7 @@
|
|||
let auth = {
|
||||
|
||||
/**
|
||||
* Login User
|
||||
* Login
|
||||
*
|
||||
* Allow the user to login into his account by providing a valid email and
|
||||
* password combination. Use the success and failure arguments to provide a
|
||||
|
@ -593,6 +593,46 @@
|
|||
return iframe('post', path, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Login with OAuth
|
||||
*
|
||||
*
|
||||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @throws {Error}
|
||||
* @return {null}
|
||||
*/
|
||||
oauth: 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"');
|
||||
}
|
||||
|
||||
let path = '/auth/login/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||
|
||||
let payload = {};
|
||||
|
||||
if(success) {
|
||||
payload['success'] = success;
|
||||
}
|
||||
|
||||
if(failure) {
|
||||
payload['failure'] = failure;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
return iframe('get', path, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Logout Current Session
|
||||
*
|
||||
|
@ -640,46 +680,6 @@
|
|||
}, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* OAuth Login
|
||||
*
|
||||
*
|
||||
* @param {string} provider
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @throws {Error}
|
||||
* @return {null}
|
||||
*/
|
||||
oauth: 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"');
|
||||
}
|
||||
|
||||
let path = '/auth/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||
|
||||
let payload = {};
|
||||
|
||||
if(success) {
|
||||
payload['success'] = success;
|
||||
}
|
||||
|
||||
if(failure) {
|
||||
payload['failure'] = failure;
|
||||
}
|
||||
|
||||
payload['project'] = config.project;
|
||||
|
||||
return iframe('get', path, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Password Recovery
|
||||
*
|
||||
|
@ -786,7 +786,7 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Register User
|
||||
* Register
|
||||
*
|
||||
* Use this endpoint to allow a new user to register an account in your
|
||||
* project. Use the success and failure URLs to redirect users back to your
|
||||
|
@ -865,7 +865,7 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Confirm User
|
||||
* Confirmation
|
||||
*
|
||||
* Use this endpoint to complete the confirmation of the user account email
|
||||
* address. Both the **userId** and **token** arguments will be passed as
|
||||
|
|
8
app/sdks/js/src/sdk.min.js
vendored
8
app/sdks/js/src/sdk.min.js
vendored
|
@ -29,13 +29,13 @@ let path='/auth/login';let payload={};if(email){payload.email=email}
|
|||
if(password){payload.password=password}
|
||||
if(success){payload.success=success}
|
||||
if(failure){payload.failure=failure}
|
||||
payload.project=config.project;return iframe('post',path,payload)},logout:function(){let path='/auth/logout';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},logoutBySession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')}
|
||||
let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},oauth:function(provider,success,failure){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
payload.project=config.project;return iframe('post',path,payload)},oauth: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"')}
|
||||
let path='/auth/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||
let path='/auth/login/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||
if(failure){payload.failure=failure}
|
||||
payload.project=config.project;return iframe('get',path,payload)},recovery:function(email,reset){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
payload.project=config.project;return iframe('get',path,payload)},logout:function(){let path='/auth/logout';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},logoutBySession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')}
|
||||
let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},recovery:function(email,reset){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(reset===undefined){throw new Error('Missing required parameter: "reset"')}
|
||||
let path='/auth/recovery';let payload={};if(email){payload.email=email}
|
||||
if(reset){payload.reset=reset}
|
||||
|
|
|
@ -3,7 +3,7 @@ const Service = require('../service.js');
|
|||
class Auth extends Service {
|
||||
|
||||
/**
|
||||
* Login User
|
||||
* Login
|
||||
*
|
||||
* Allow the user to login into his account by providing a valid email and
|
||||
* password combination. Use the success and failure arguments to provide a
|
||||
|
@ -41,6 +41,27 @@ class Auth extends Service {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Login with OAuth
|
||||
*
|
||||
* @param string provider
|
||||
* @param string success
|
||||
* @param string failure
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async oauth(provider, success, failure) {
|
||||
let path = '/auth/login/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider);
|
||||
|
||||
return await this.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
{
|
||||
'success': success,
|
||||
'failure': failure
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout Current Session
|
||||
*
|
||||
|
@ -82,27 +103,6 @@ class Auth extends Service {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
@ -165,7 +165,7 @@ class Auth extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Register User
|
||||
* Register
|
||||
*
|
||||
* Use this endpoint to allow a new user to register an account in your
|
||||
* project. Use the success and failure URLs to redirect users back to your
|
||||
|
@ -214,7 +214,7 @@ class Auth extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Confirm User
|
||||
* Confirmation
|
||||
*
|
||||
* Use this endpoint to complete the confirmation of the user account email
|
||||
* address. Both the **userId** and **token** arguments will be passed as
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Auth Service
|
||||
|
||||
## Login User
|
||||
## Login
|
||||
|
||||
```http request
|
||||
POST https://appwrite.io/v1/auth/login
|
||||
|
@ -21,6 +21,20 @@ When accessing this route using Javascript from the browser, success and failure
|
|||
| 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. | |
|
||||
|
||||
## Login with OAuth
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/auth/login/oauth/{provider}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| provider | string | **Required** OAuth Provider | |
|
||||
| success | string | **Required** URL to redirect back to your app after a successful login attempt. | |
|
||||
| failure | string | **Required** URL to redirect back to your app after a failed login attempt. | |
|
||||
|
||||
## Logout Current Session
|
||||
|
||||
```http request
|
||||
|
@ -43,20 +57,6 @@ DELETE https://appwrite.io/v1/auth/logout/{id}
|
|||
| --- | --- | --- | --- |
|
||||
| id | string | **Required** User specific session unique ID number. if 0 delete all sessions. | |
|
||||
|
||||
## OAuth Login
|
||||
|
||||
```http request
|
||||
GET https://appwrite.io/v1/auth/oauth/{provider}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| provider | string | **Required** OAuth Provider | |
|
||||
| success | string | **Required** URL to redirect back to your app after a successful login attempt. | |
|
||||
| failure | string | **Required** URL to redirect back to your app after a failed login attempt. | |
|
||||
|
||||
## Password Recovery
|
||||
|
||||
```http request
|
||||
|
@ -91,7 +91,7 @@ Please notice that in order to avoid a [Redirect Attack](https://github.com/OWAS
|
|||
| password-a | string | New password. | |
|
||||
| password-b | string | New password again. | |
|
||||
|
||||
## Register User
|
||||
## Register
|
||||
|
||||
```http request
|
||||
POST https://appwrite.io/v1/auth/register
|
||||
|
@ -116,7 +116,7 @@ When accessing this route using Javascript from the browser, success and failure
|
|||
| failure | string | Redirect when registration failed | |
|
||||
| name | string | User name | |
|
||||
|
||||
## Confirm User
|
||||
## Confirmation
|
||||
|
||||
```http request
|
||||
POST https://appwrite.io/v1/auth/register/confirm
|
||||
|
|
|
@ -9,7 +9,7 @@ use Appwrite\Service;
|
|||
class Auth extends Service
|
||||
{
|
||||
/**
|
||||
* Login User
|
||||
* Login
|
||||
*
|
||||
* Allow the user to login into his account by providing a valid email and
|
||||
* password combination. Use the success and failure arguments to provide a
|
||||
|
@ -48,6 +48,28 @@ class Auth extends Service
|
|||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Login with OAuth
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $success
|
||||
* @param string $failure
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function oauth(string $provider, string $success, string $failure):array
|
||||
{
|
||||
$path = str_replace(['{provider}'], [$provider], '/auth/login/oauth/{provider}');
|
||||
$params = [];
|
||||
|
||||
$params['success'] = $success;
|
||||
$params['failure'] = $failure;
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout Current Session
|
||||
*
|
||||
|
@ -91,28 +113,6 @@ class Auth extends Service
|
|||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* OAuth Login
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $success
|
||||
* @param string $failure
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function oauth(string $provider, string $success, string $failure):array
|
||||
{
|
||||
$path = str_replace(['{provider}'], [$provider], '/auth/oauth/{provider}');
|
||||
$params = [];
|
||||
|
||||
$params['success'] = $success;
|
||||
$params['failure'] = $failure;
|
||||
|
||||
return $this->client->call(Client::METHOD_GET, $path, [
|
||||
'content-type' => 'application/json',
|
||||
], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password Recovery
|
||||
*
|
||||
|
@ -177,7 +177,7 @@ class Auth extends Service
|
|||
}
|
||||
|
||||
/**
|
||||
* Register User
|
||||
* Register
|
||||
*
|
||||
* Use this endpoint to allow a new user to register an account in your
|
||||
* project. Use the success and failure URLs to redirect users back to your
|
||||
|
@ -227,7 +227,7 @@ class Auth extends Service
|
|||
}
|
||||
|
||||
/**
|
||||
* Confirm User
|
||||
* Confirmation
|
||||
*
|
||||
* Use this endpoint to complete the confirmation of the user account email
|
||||
* address. Both the **userId** and **token** arguments will be passed as
|
||||
|
|
|
@ -4,7 +4,7 @@ from ..service import Service
|
|||
class Auth(Service):
|
||||
|
||||
def login(self, email, password, success='', failure=''):
|
||||
"""Login User"""
|
||||
"""Login"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/login'
|
||||
|
@ -17,6 +17,19 @@ class Auth(Service):
|
|||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def oauth(self, provider, success, failure):
|
||||
"""Login with OAuth"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/login/oauth/{provider}'
|
||||
path.replace('{provider}', provider)
|
||||
params['success'] = success
|
||||
params['failure'] = failure
|
||||
|
||||
return self.client.call('get', path, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def logout(self):
|
||||
"""Logout Current Session"""
|
||||
|
||||
|
@ -38,19 +51,6 @@ class Auth(Service):
|
|||
'content-type': 'application/json',
|
||||
}, 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, {
|
||||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def recovery(self, email, reset):
|
||||
"""Password Recovery"""
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Auth(Service):
|
|||
}, params)
|
||||
|
||||
def register(self, email, password, confirm, success='', failure='', name=''):
|
||||
"""Register User"""
|
||||
"""Register"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register'
|
||||
|
@ -94,7 +94,7 @@ class Auth(Service):
|
|||
}, params)
|
||||
|
||||
def confirm(self, user_id, token):
|
||||
"""Confirm User"""
|
||||
"""Confirmation"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register/confirm'
|
||||
|
|
|
@ -42,8 +42,7 @@ class Database(Service):
|
|||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def update_collection(self, collection_id, name, read, write, rulesstring(4) ""[]""
|
||||
=[]):
|
||||
def update_collection(self, collection_id, name, read, write, rules=[]):
|
||||
"""Update Collection"""
|
||||
|
||||
params = {}
|
||||
|
@ -69,8 +68,7 @@ class Database(Service):
|
|||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def list_documents(self, collection_id, filtersstring(4) ""[]""
|
||||
=[], offset=0, limit=50, order_field='$uid', order_type='ASC', order_cast='string', search='', first=0, last=0):
|
||||
def list_documents(self, collection_id, filters=[], offset=0, limit=50, order_field='$uid', order_type='ASC', order_cast='string', search='', first=0, last=0):
|
||||
"""List Documents"""
|
||||
|
||||
params = {}
|
||||
|
|
|
@ -17,8 +17,7 @@ class Teams(Service):
|
|||
'content-type': 'application/json',
|
||||
}, params)
|
||||
|
||||
def create_team(self, name, rolesstring(13) ""[\"owner\"]""
|
||||
=[]):
|
||||
def create_team(self, name, roles=[]):
|
||||
"""Create Team"""
|
||||
|
||||
params = {}
|
||||
|
|
|
@ -16,6 +16,20 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def oauth(provider:, success:, failure:)
|
||||
path = '/auth/login/oauth/{provider}'
|
||||
.gsub('{provider}', provider)
|
||||
|
||||
params = {
|
||||
'success': success,
|
||||
'failure': failure
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def logout()
|
||||
path = '/auth/logout'
|
||||
|
||||
|
@ -39,20 +53,6 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def oauth(provider:, success:, failure:)
|
||||
path = '/auth/oauth/{provider}'
|
||||
.gsub('{provider}', provider)
|
||||
|
||||
params = {
|
||||
'success': success,
|
||||
'failure': failure
|
||||
}
|
||||
|
||||
return @client.call('get', path, {
|
||||
'content-type' => 'application/json',
|
||||
}, params);
|
||||
end
|
||||
|
||||
def recovery(email:, reset:)
|
||||
path = '/auth/recovery'
|
||||
|
||||
|
|
4
composer.lock
generated
4
composer.lock
generated
|
@ -92,7 +92,7 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator",
|
||||
"reference": "cd5376697e78c75bff0019c4fdb86a68271297a9"
|
||||
"reference": "ea5bd009b92761af7ec3853c4a92d703e706d131"
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
|
@ -122,7 +122,7 @@
|
|||
}
|
||||
],
|
||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||
"time": "2019-11-02 08:48:07"
|
||||
"time": "2019-11-02 14:50:56"
|
||||
},
|
||||
{
|
||||
"name": "bacon/bacon-qr-code",
|
||||
|
|
Loading…
Reference in a new issue