Merge branch 'master' of github.com:appwrite/appwrite into preloader
This commit is contained in:
commit
38fe69b4a0
44 changed files with 1615 additions and 269 deletions
|
@ -13,7 +13,11 @@
|
||||||
- New UI micro-interactions and styles fixes (@AnatoleLucet)
|
- New UI micro-interactions and styles fixes (@AnatoleLucet)
|
||||||
- UI performance & accessibility improvments
|
- UI performance & accessibility improvments
|
||||||
- Updated ClamAV conntainer to version 1.0.9
|
- Updated ClamAV conntainer to version 1.0.9
|
||||||
|
- New Doctor CLI to debug the Appwrite server ([#415](https://github.com/appwrite/appwrite/issues/415))
|
||||||
- All emails are now sent asynchronously for improved performance (@TorstenDittmann)
|
- All emails are now sent asynchronously for improved performance (@TorstenDittmann)
|
||||||
|
- Updated grid for OAuth2 providers list in the console
|
||||||
|
- Upgraded Redis Resque queue library to version 1.3.6
|
||||||
|
- Added container names to docker-compose.yml (@drandell)
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
@ -23,6 +27,9 @@
|
||||||
- Fixed a UI bug preventing float values in numeric fields
|
- Fixed a UI bug preventing float values in numeric fields
|
||||||
- Fixed scroll positioning when moving rules order up & down
|
- Fixed scroll positioning when moving rules order up & down
|
||||||
- Fixed missing validation for database documents key length (32 chars)
|
- Fixed missing validation for database documents key length (32 chars)
|
||||||
|
- Grammer fix for pt-br email templates (@rubensdemelo)
|
||||||
|
- Fixed update form labels and tooltips for Flutter Android apps
|
||||||
|
- Fixed missing custom scopes param for OAuth2 session create API route
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,7 @@ RUN echo "" >> /var/log/appwrite.log
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
RUN chmod +x /usr/local/bin/start
|
RUN chmod +x /usr/local/bin/start
|
||||||
|
RUN chmod +x /usr/local/bin/doctor
|
||||||
RUN chmod +x /usr/local/bin/migrate
|
RUN chmod +x /usr/local/bin/migrate
|
||||||
RUN chmod +x /usr/local/bin/test
|
RUN chmod +x /usr/local/bin/test
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
[![Discord](https://badgen.net/badge/discord/chat/green)](https://discord.gg/GSeTUeA)
|
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://discord.gg/GSeTUeA)
|
||||||
[![Docker Pulls](https://badgen.net/docker/pulls/appwrite/appwrite)](https://travis-ci.org/appwrite/appwrite)
|
[![Docker Pulls](https://badgen.net/docker/pulls/appwrite/appwrite)](https://travis-ci.org/appwrite/appwrite)
|
||||||
[![Travis CI](https://badgen.net/travis/appwrite/appwrite?label=build)](https://travis-ci.org/appwrite/appwrite)
|
[![Travis CI](https://badgen.net/travis/appwrite/appwrite?label=build)](https://travis-ci.org/appwrite/appwrite)
|
||||||
[![Twitter Account](https://badgen.net/twitter/follow/appwrite_io?label=twitter)](https://twitter.com/appwrite_io)
|
[![Twitter Account](https://badgen.net/twitter/follow/appwrite_io?label=twitter)](https://twitter.com/appwrite_io)
|
||||||
|
|
|
@ -187,7 +187,7 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
|
||||||
throw new Exception('Project not found', 404);
|
throw new Exception('Project not found', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception($user->getAttribute('email', 'Guest').' (role: '.strtolower($roles[$role]['label']).') missing scope ('.$scope.')', 401);
|
throw new Exception($user->getAttribute('email', 'User').' (role: '.strtolower($roles[$role]['label']).') missing scope ('.$scope.')', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auth::USER_STATUS_BLOCKED == $user->getAttribute('status')) { // Account has not been activated
|
if (Auth::USER_STATUS_BLOCKED == $user->getAttribute('status')) { // Account has not been activated
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</p>
|
</p>
|
||||||
{{cta}}
|
{{cta}}
|
||||||
<p>
|
<p>
|
||||||
Caso você não solicitou a redefinição de senha, por favor ignore esta mensagem.
|
Caso não tenha solicitado a redefinição de senha, por favor ignore esta mensagem.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Atenciosamente,
|
Atenciosamente,
|
||||||
|
|
|
@ -74,7 +74,7 @@ return [ // Ordered by ABC.
|
||||||
'mock' => false,
|
'mock' => false,
|
||||||
],
|
],
|
||||||
'google' => [
|
'google' => [
|
||||||
'developers' => 'https://developers.google.com/',
|
'developers' => 'https://support.google.com/googleapi/answer/6158849',
|
||||||
'icon' => 'icon-google',
|
'icon' => 'icon-google',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'form' => false,
|
'form' => false,
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Appwrite\OpenSSL\OpenSSL;
|
||||||
use Appwrite\URL\URL as URLParser;
|
use Appwrite\URL\URL as URLParser;
|
||||||
use DeviceDetector\DeviceDetector;
|
use DeviceDetector\DeviceDetector;
|
||||||
use GeoIp2\Database\Reader;
|
use GeoIp2\Database\Reader;
|
||||||
|
use Utopia\Validator\ArrayList;
|
||||||
|
|
||||||
include_once __DIR__ . '/../shared/api.php';
|
include_once __DIR__ . '/../shared/api.php';
|
||||||
|
|
||||||
|
@ -253,8 +254,9 @@ $utopia->get('/v1/account/sessions/oauth2/:provider')
|
||||||
->param('provider', '', function () { return new WhiteList(array_keys(Config::getParam('providers'))); }, 'OAuth2 Provider. Currently, supported providers are: ' . implode(', ', array_keys(array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.')
|
->param('provider', '', function () { return new WhiteList(array_keys(Config::getParam('providers'))); }, 'OAuth2 Provider. Currently, supported providers are: ' . implode(', ', array_keys(array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.')
|
||||||
->param('success', $oauthDefaultSuccess, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
|
->param('success', $oauthDefaultSuccess, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
|
||||||
->param('failure', $oauthDefaultFailure, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
|
->param('failure', $oauthDefaultFailure, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
|
||||||
|
->param('scopes', [], function () { return new ArrayList(new Text(128)); }, 'A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.', true)
|
||||||
->action(
|
->action(
|
||||||
function ($provider, $success, $failure) use ($response, $request, $project) {
|
function ($provider, $success, $failure, $scopes) use ($response, $request, $project) {
|
||||||
$protocol = Config::getParam('protocol');
|
$protocol = Config::getParam('protocol');
|
||||||
$callback = $protocol.'://'.$request->getServer('HTTP_HOST').'/v1/account/sessions/oauth2/callback/'.$provider.'/'.$project->getId();
|
$callback = $protocol.'://'.$request->getServer('HTTP_HOST').'/v1/account/sessions/oauth2/callback/'.$provider.'/'.$project->getId();
|
||||||
$appId = $project->getAttribute('usersOauth2'.ucfirst($provider).'Appid', '');
|
$appId = $project->getAttribute('usersOauth2'.ucfirst($provider).'Appid', '');
|
||||||
|
@ -277,7 +279,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider')
|
||||||
throw new Exception('Provider is not supported', 501);
|
throw new Exception('Provider is not supported', 501);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oauth2 = new $classname($appId, $appSecret, $callback, ['success' => $success, 'failure' => $failure]);
|
$oauth2 = new $classname($appId, $appSecret, $callback, ['success' => $success, 'failure' => $failure], $scopes);
|
||||||
|
|
||||||
$response
|
$response
|
||||||
->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
|
->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
|
||||||
|
|
|
@ -20,6 +20,15 @@ $utopia->get('/v1/health')
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$utopia->get('/v1/health/version')
|
||||||
|
->desc('Get Version')
|
||||||
|
->label('scope', 'public')
|
||||||
|
->action(
|
||||||
|
function () use ($response) {
|
||||||
|
$response->json(['version' => APP_VERSION_STABLE]);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$utopia->get('/v1/health/db')
|
$utopia->get('/v1/health/db')
|
||||||
->desc('Get DB')
|
->desc('Get DB')
|
||||||
->label('scope', 'health.read')
|
->label('scope', 'health.read')
|
||||||
|
@ -124,7 +133,7 @@ $utopia->get('/v1/health/queue/tasks')
|
||||||
);
|
);
|
||||||
|
|
||||||
$utopia->get('/v1/health/queue/logs')
|
$utopia->get('/v1/health/queue/logs')
|
||||||
->desc('Get Logs Queue')
|
->desc('Get Logs Queue')
|
||||||
->label('scope', 'health.read')
|
->label('scope', 'health.read')
|
||||||
->label('sdk.platform', [APP_PLATFORM_SERVER])
|
->label('sdk.platform', [APP_PLATFORM_SERVER])
|
||||||
->label('sdk.namespace', 'health')
|
->label('sdk.namespace', 'health')
|
||||||
|
|
|
@ -10,6 +10,10 @@ $utopia->init(function () use ($utopia, $request, $response, $register, $user, $
|
||||||
|
|
||||||
$route = $utopia->match($request);
|
$route = $utopia->match($request);
|
||||||
|
|
||||||
|
if(empty($project->getId()) && $route->getLabel('abuse-limit', 0) > 0) { // Abuse limit requires an active project scope
|
||||||
|
throw new Exception('Missing or unknown project ID', 400);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abuse Check
|
* Abuse Check
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +37,7 @@ $utopia->init(function () use ($utopia, $request, $response, $register, $user, $
|
||||||
$abuse = new Abuse($timeLimit);
|
$abuse = new Abuse($timeLimit);
|
||||||
|
|
||||||
if ($timeLimit->limit()) {
|
if ($timeLimit->limit()) {
|
||||||
|
|
||||||
$response
|
$response
|
||||||
->addHeader('X-RateLimit-Limit', $timeLimit->limit())
|
->addHeader('X-RateLimit-Limit', $timeLimit->limit())
|
||||||
->addHeader('X-RateLimit-Remaining', $timeLimit->remaining())
|
->addHeader('X-RateLimit-Remaining', $timeLimit->remaining())
|
||||||
|
|
|
@ -279,9 +279,10 @@ $projectDB->setAdapter(new RedisAdapter(new MySQLAdapter($register), $register))
|
||||||
$projectDB->setNamespace('app_'.$project->getId());
|
$projectDB->setNamespace('app_'.$project->getId());
|
||||||
$projectDB->setMocks(Config::getParam('collections', []));
|
$projectDB->setMocks(Config::getParam('collections', []));
|
||||||
|
|
||||||
$user = $projectDB->getDocument(Auth::$unique);
|
if (APP_MODE_ADMIN !== $mode) {
|
||||||
|
$user = $projectDB->getDocument(Auth::$unique);
|
||||||
if (APP_MODE_ADMIN === $mode) {
|
}
|
||||||
|
else {
|
||||||
$user = $consoleDB->getDocument(Auth::$unique);
|
$user = $consoleDB->getDocument(Auth::$unique);
|
||||||
|
|
||||||
$user
|
$user
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite)
|
[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite)
|
||||||
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?v=1)
|
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?v=1)
|
||||||
![Version](https://img.shields.io/badge/api%20version-0.6.1-blue.svg?v=1)
|
![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1)
|
||||||
|
|
||||||
**This SDK is compatible with Appwrite server version 0.6.1. For older versions, please check previous releases.**
|
**This SDK is compatible with Appwrite server version 0.6.2. For older versions, please check previous releases.**
|
||||||
|
|
||||||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
|
||||||
Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
|
||||||
|
|
|
@ -10,7 +10,7 @@ void main() { // Init SDK
|
||||||
;
|
;
|
||||||
|
|
||||||
Future result = account.createOAuth2Session(
|
Future result = account.createOAuth2Session(
|
||||||
provider: 'bitbucket',
|
provider: 'amazon',
|
||||||
);
|
);
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import 'package:appwrite/appwrite.dart';
|
||||||
|
|
||||||
|
void main() { // Init SDK
|
||||||
|
Client client = Client();
|
||||||
|
Avatars avatars = Avatars(client);
|
||||||
|
|
||||||
|
client
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
;
|
||||||
|
|
||||||
|
String result = avatars.getInitials(
|
||||||
|
);
|
||||||
|
|
||||||
|
print(result); // Resource URL string
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
import 'package:appwrite/appwrite.dart';
|
||||||
|
|
||||||
|
void main() { // Init SDK
|
||||||
|
Client client = Client();
|
||||||
|
Locale locale = Locale(client);
|
||||||
|
|
||||||
|
client
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
;
|
||||||
|
|
||||||
|
Future result = locale.getLanguages( );
|
||||||
|
|
||||||
|
result
|
||||||
|
.then((response) {
|
||||||
|
print(response);
|
||||||
|
}).catchError((error) {
|
||||||
|
print(error.response);
|
||||||
|
});
|
||||||
|
}
|
|
@ -33,10 +33,10 @@ class Account extends Service {
|
||||||
///
|
///
|
||||||
/// Use this endpoint to allow a new user to register a new account in your
|
/// Use this endpoint to allow a new user to register a new account in your
|
||||||
/// project. After the user registration completes successfully, you can use
|
/// project. After the user registration completes successfully, you can use
|
||||||
/// the [/account/verfication](/docs/account#createVerification) route to start
|
/// the [/account/verfication](/docs/client/account#createVerification) route
|
||||||
/// verifying the user email address. To allow your new user to login to his
|
/// to start verifying the user email address. To allow your new user to login
|
||||||
/// new account, you need to create a new [account
|
/// to his new account, you need to create a new [account
|
||||||
/// session](/docs/account#createSession).
|
/// session](/docs/client/account#createSession).
|
||||||
///
|
///
|
||||||
Future<Response> create({@required String email, @required String password, String name = ''}) {
|
Future<Response> create({@required String email, @required String password, String name = ''}) {
|
||||||
final String path = '/account';
|
final String path = '/account';
|
||||||
|
@ -195,7 +195,7 @@ class Account extends Service {
|
||||||
/// When the user clicks the confirmation link he is redirected back to your
|
/// When the user clicks the confirmation link he is redirected back to your
|
||||||
/// app password reset URL with the secret key and email address values
|
/// app password reset URL with the secret key and email address values
|
||||||
/// attached to the URL query string. Use the query string params to submit a
|
/// attached to the URL query string. Use the query string params to submit a
|
||||||
/// request to the [PUT /account/recovery](/docs/account#updateRecovery)
|
/// request to the [PUT /account/recovery](/docs/client/account#updateRecovery)
|
||||||
/// endpoint to complete the process.
|
/// endpoint to complete the process.
|
||||||
///
|
///
|
||||||
Future<Response> createRecovery({@required String email, @required String url}) {
|
Future<Response> createRecovery({@required String email, @required String url}) {
|
||||||
|
@ -218,7 +218,7 @@ class Account extends Service {
|
||||||
/// Use this endpoint to complete the user account password reset. Both the
|
/// Use this endpoint to complete the user account password reset. Both the
|
||||||
/// **userId** and **secret** arguments will be passed as query parameters to
|
/// **userId** and **secret** arguments will be passed as query parameters to
|
||||||
/// the redirect URL you have provided when sending your request to the [POST
|
/// the redirect URL you have provided when sending your request to the [POST
|
||||||
/// /account/recovery](/docs/account#createRecovery) endpoint.
|
/// /account/recovery](/docs/client/account#createRecovery) endpoint.
|
||||||
///
|
///
|
||||||
/// Please note that in order to avoid a [Redirect
|
/// Please note that in order to avoid a [Redirect
|
||||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||||
|
@ -305,21 +305,36 @@ class Account extends Service {
|
||||||
/// first. Use the success and failure arguments to provide a redirect URL's
|
/// first. Use the success and failure arguments to provide a redirect URL's
|
||||||
/// back to your app when login is completed.
|
/// back to your app when login is completed.
|
||||||
///
|
///
|
||||||
Future createOAuth2Session({@required String provider, String success = 'https://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure'}) {
|
Future createOAuth2Session({@required String provider, String success = 'https://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) {
|
||||||
final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider);
|
final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider);
|
||||||
|
|
||||||
final Map<String, dynamic> params = {
|
final Map<String, dynamic> params = {
|
||||||
'success': success,
|
'success': success,
|
||||||
'failure': failure,
|
'failure': failure,
|
||||||
|
'scopes': scopes,
|
||||||
'project': client.config['project'],
|
'project': client.config['project'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
final List query = [];
|
||||||
|
|
||||||
|
params.forEach((key, value) {
|
||||||
|
if (value is List) {
|
||||||
|
for (var item in value) {
|
||||||
|
query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Uri endpoint = Uri.parse(client.endPoint);
|
Uri endpoint = Uri.parse(client.endPoint);
|
||||||
Uri url = new Uri(scheme: endpoint.scheme,
|
Uri url = new Uri(scheme: endpoint.scheme,
|
||||||
host: endpoint.host,
|
host: endpoint.host,
|
||||||
port: endpoint.port,
|
port: endpoint.port,
|
||||||
path: endpoint.path + path,
|
path: endpoint.path + path,
|
||||||
queryParameters:params,
|
query: query.join('&')
|
||||||
);
|
);
|
||||||
|
|
||||||
return FlutterWebAuth.authenticate(
|
return FlutterWebAuth.authenticate(
|
||||||
|
@ -361,7 +376,7 @@ class Account extends Service {
|
||||||
/// should redirect the user back for your app and allow you to complete the
|
/// should redirect the user back for your app and allow you to complete the
|
||||||
/// verification process by verifying both the **userId** and **secret**
|
/// verification process by verifying both the **userId** and **secret**
|
||||||
/// parameters. Learn more about how to [complete the verification
|
/// parameters. Learn more about how to [complete the verification
|
||||||
/// process](/docs/account#updateAccountVerification).
|
/// process](/docs/client/account#updateAccountVerification).
|
||||||
///
|
///
|
||||||
/// Please note that in order to avoid a [Redirect
|
/// Please note that in order to avoid a [Redirect
|
||||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||||
|
|
|
@ -145,6 +145,42 @@ class Avatars extends Service {
|
||||||
return location.toString();
|
return location.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get User Initials
|
||||||
|
///
|
||||||
|
/// Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
/// app. By default, this route will try to print your logged-in user name or
|
||||||
|
/// email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
/// parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
/// be returned.
|
||||||
|
///
|
||||||
|
/// You can use the color and background params to change the avatar colors. By
|
||||||
|
/// default, a random theme will be selected. The random theme will persist for
|
||||||
|
/// the user's initials when reloading the same theme will always return for
|
||||||
|
/// the same initials.
|
||||||
|
///
|
||||||
|
String getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) {
|
||||||
|
final String path = '/avatars/initials';
|
||||||
|
|
||||||
|
final Map<String, dynamic> params = {
|
||||||
|
'name': name,
|
||||||
|
'width': width,
|
||||||
|
'height': height,
|
||||||
|
'color': color,
|
||||||
|
'background': background,
|
||||||
|
'project': client.config['project'],
|
||||||
|
};
|
||||||
|
|
||||||
|
Uri endpoint = Uri.parse(client.endPoint);
|
||||||
|
Uri location = new Uri(scheme: endpoint.scheme,
|
||||||
|
host: endpoint.host,
|
||||||
|
port: endpoint.port,
|
||||||
|
path: endpoint.path + path,
|
||||||
|
queryParameters:params,
|
||||||
|
);
|
||||||
|
|
||||||
|
return location.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/// Get QR Code
|
/// Get QR Code
|
||||||
///
|
///
|
||||||
/// Converts a given plain text to a QR code image. You can use the query
|
/// Converts a given plain text to a QR code image. You can use the query
|
||||||
|
|
|
@ -41,7 +41,10 @@ class Database extends Service {
|
||||||
|
|
||||||
/// Create Document
|
/// Create Document
|
||||||
///
|
///
|
||||||
/// Create a new Document.
|
/// Create a new Document. Before using this route, you should create a new
|
||||||
|
/// collection resource using either a [server
|
||||||
|
/// integration](/docs/server/database?sdk=nodejs#createCollection) API or
|
||||||
|
/// directly from your database console.
|
||||||
///
|
///
|
||||||
Future<Response> createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) {
|
Future<Response> createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) {
|
||||||
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
|
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
|
||||||
|
|
|
@ -106,9 +106,9 @@ class Locale extends Service {
|
||||||
|
|
||||||
/// List Currencies
|
/// List Currencies
|
||||||
///
|
///
|
||||||
/// List of all currencies, including currency symol, name, plural, and decimal
|
/// List of all currencies, including currency symbol, name, plural, and
|
||||||
/// digits for all major and minor currencies. You can use the locale header to
|
/// decimal digits for all major and minor currencies. You can use the locale
|
||||||
/// get the data in a supported language.
|
/// header to get the data in a supported language.
|
||||||
///
|
///
|
||||||
Future<Response> getCurrencies() {
|
Future<Response> getCurrencies() {
|
||||||
final String path = '/locale/currencies';
|
final String path = '/locale/currencies';
|
||||||
|
@ -120,6 +120,24 @@ class Locale extends Service {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// List Languages
|
||||||
|
///
|
||||||
|
/// List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
/// in English, and name in the respective language.
|
||||||
|
///
|
||||||
|
Future<Response> getLanguages() {
|
||||||
|
final String path = '/locale/languages';
|
||||||
|
|
||||||
|
final Map<String, dynamic> params = {
|
||||||
|
};
|
||||||
|
|
||||||
|
final Map<String, String> headers = {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
};
|
||||||
|
|
||||||
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
return client.call(HttpMethod.get, path: path, params: params, headers: headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -115,10 +115,14 @@ class Teams extends Service {
|
||||||
/// Get team members by the team unique ID. All team members have read access
|
/// Get team members by the team unique ID. All team members have read access
|
||||||
/// for this list of resources.
|
/// for this list of resources.
|
||||||
///
|
///
|
||||||
Future<Response> getMemberships({@required String teamId}) {
|
Future<Response> getMemberships({@required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) {
|
||||||
final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
|
final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
|
||||||
|
|
||||||
final Map<String, dynamic> params = {
|
final Map<String, dynamic> params = {
|
||||||
|
'search': search,
|
||||||
|
'limit': limit,
|
||||||
|
'offset': offset,
|
||||||
|
'orderType': orderType.name(),
|
||||||
};
|
};
|
||||||
|
|
||||||
final Map<String, String> headers = {
|
final Map<String, String> headers = {
|
||||||
|
@ -136,8 +140,8 @@ class Teams extends Service {
|
||||||
///
|
///
|
||||||
/// Use the 'URL' parameter to redirect the user from the invitation email back
|
/// Use the 'URL' parameter to redirect the user from the invitation email back
|
||||||
/// to your app. When the user is redirected, use the [Update Team Membership
|
/// to your app. When the user is redirected, use the [Update Team Membership
|
||||||
/// Status](/docs/teams#updateMembershipStatus) endpoint to allow the user to
|
/// Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the
|
||||||
/// accept the invitation to the team.
|
/// user to accept the invitation to the team.
|
||||||
///
|
///
|
||||||
/// Please note that in order to avoid a [Redirect
|
/// Please note that in order to avoid a [Redirect
|
||||||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||||
|
|
10
app/sdks/client-web/docs/examples/avatars/get-initials.md
Normal file
10
app/sdks/client-web/docs/examples/avatars/get-initials.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
let sdk = new Appwrite();
|
||||||
|
|
||||||
|
sdk
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
;
|
||||||
|
|
||||||
|
let result = sdk.avatars.getInitials();
|
||||||
|
|
||||||
|
console.log(result); // Resource URL
|
14
app/sdks/client-web/docs/examples/locale/get-languages.md
Normal file
14
app/sdks/client-web/docs/examples/locale/get-languages.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
let sdk = new Appwrite();
|
||||||
|
|
||||||
|
sdk
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
;
|
||||||
|
|
||||||
|
let promise = sdk.locale.getLanguages();
|
||||||
|
|
||||||
|
promise.then(function (response) {
|
||||||
|
console.log(response); // Success
|
||||||
|
}, function (error) {
|
||||||
|
console.log(error); // Failure
|
||||||
|
});
|
|
@ -190,28 +190,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
request.onload = function () {
|
request.onload = function () {
|
||||||
|
let data = request.response;
|
||||||
|
let contentType = this.getResponseHeader('content-type') || '';
|
||||||
|
contentType = contentType.substring(0, contentType.indexOf(';'));
|
||||||
|
|
||||||
|
switch (contentType) {
|
||||||
|
case 'application/json':
|
||||||
|
data = JSON.parse(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
||||||
|
|
||||||
|
if(window.localStorage && cookieFallback) {
|
||||||
|
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
||||||
|
window.localStorage.setItem('cookieFallback', cookieFallback);
|
||||||
|
}
|
||||||
|
|
||||||
if (4 === request.readyState && 399 >= request.status) {
|
if (4 === request.readyState && 399 >= request.status) {
|
||||||
let data = request.response;
|
|
||||||
let contentType = this.getResponseHeader('content-type') || '';
|
|
||||||
contentType = contentType.substring(0, contentType.indexOf(';'));
|
|
||||||
|
|
||||||
switch (contentType) {
|
|
||||||
case 'application/json':
|
|
||||||
data = JSON.parse(data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
|
||||||
|
|
||||||
if(window.localStorage && cookieFallback) {
|
|
||||||
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
|
||||||
window.localStorage.setItem('cookieFallback', cookieFallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reject(new Error(request.statusText));
|
reject(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -709,10 +708,11 @@
|
||||||
* @param {string} provider
|
* @param {string} provider
|
||||||
* @param {string} success
|
* @param {string} success
|
||||||
* @param {string} failure
|
* @param {string} failure
|
||||||
|
* @param {string[]} scopes
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||||
if(provider === undefined) {
|
if(provider === undefined) {
|
||||||
throw new Error('Missing required parameter: "provider"');
|
throw new Error('Missing required parameter: "provider"');
|
||||||
}
|
}
|
||||||
|
@ -729,9 +729,28 @@
|
||||||
payload['failure'] = failure;
|
payload['failure'] = failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scopes) {
|
||||||
|
payload['scopes'] = scopes;
|
||||||
|
}
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -883,7 +902,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -926,7 +960,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -956,7 +1005,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -998,7 +1062,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1040,7 +1119,91 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get User Initials
|
||||||
|
*
|
||||||
|
* Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
* app. By default, this route will try to print your logged-in user name or
|
||||||
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
* parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* You can use the color and background params to change the avatar colors. By
|
||||||
|
* default, a random theme will be selected. The random theme will persist for
|
||||||
|
* the user's initials when reloading the same theme will always return for
|
||||||
|
* the same initials.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {number} width
|
||||||
|
* @param {number} height
|
||||||
|
* @param {string} color
|
||||||
|
* @param {string} background
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getInitials: function(name = '', width = 500, height = 500, color = '', background = '') {
|
||||||
|
let path = '/avatars/initials';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
|
if(name) {
|
||||||
|
payload['name'] = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(width) {
|
||||||
|
payload['width'] = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(height) {
|
||||||
|
payload['height'] = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(color) {
|
||||||
|
payload['color'] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(background) {
|
||||||
|
payload['background'] = background;
|
||||||
|
}
|
||||||
|
|
||||||
|
payload['project'] = config.project;
|
||||||
|
|
||||||
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1085,7 +1248,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
@ -1460,9 +1638,9 @@
|
||||||
/**
|
/**
|
||||||
* List Currencies
|
* List Currencies
|
||||||
*
|
*
|
||||||
* List of all currencies, including currency symol, name, plural, and decimal
|
* List of all currencies, including currency symbol, name, plural, and
|
||||||
* digits for all major and minor currencies. You can use the locale header to
|
* decimal digits for all major and minor currencies. You can use the locale
|
||||||
* get the data in a supported language.
|
* header to get the data in a supported language.
|
||||||
*
|
*
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
|
@ -1472,6 +1650,26 @@
|
||||||
|
|
||||||
let payload = {};
|
let payload = {};
|
||||||
|
|
||||||
|
return http
|
||||||
|
.get(path, {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
}, payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Languages
|
||||||
|
*
|
||||||
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
* in English, and name in the respective language.
|
||||||
|
*
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getLanguages: function() {
|
||||||
|
let path = '/locale/languages';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
return http
|
return http
|
||||||
.get(path, {
|
.get(path, {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
|
@ -1685,7 +1883,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1738,7 +1951,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1769,7 +1997,22 @@
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
|
45
app/sdks/client-web/src/sdk.min.js
vendored
45
app/sdks/client-web/src/sdk.min.js
vendored
|
@ -9,9 +9,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
||||||
switch(headers['content-type']){case 'application/json':params=JSON.stringify(params);break;case 'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param)});params=formData;break}
|
switch(headers['content-type']){case 'application/json':params=JSON.stringify(params);break;case 'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param)});params=formData;break}
|
||||||
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=!0;request.open(method,path,!0);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue}
|
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=!0;request.open(method,path,!0);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue}
|
||||||
request.setRequestHeader(key,headers[key])}}
|
request.setRequestHeader(key,headers[key])}}
|
||||||
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case 'application/json':data=JSON.parse(data);break}
|
request.onload=function(){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case 'application/json':data=JSON.parse(data);break}
|
||||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback)}
|
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback)}
|
||||||
resolve(data)}else{reject(new Error(request.statusText))}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)}
|
if(4===request.readyState&&399>=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)}
|
||||||
request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||||
let path='/account';let payload={};if(email){payload.email=email}
|
let path='/account';let payload={};if(email){payload.email=email}
|
||||||
|
@ -45,10 +45,12 @@ return http.put(path,{'content-type':'application/json',},payload)},getSessions:
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||||
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
||||||
if(password){payload.password=password}
|
if(password){payload.password=password}
|
||||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||||
if(failure){payload.failure=failure}
|
if(failure){payload.failure=failure}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
if(scopes){payload.scopes=scopes}
|
||||||
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/account/verification';let payload={};if(url){payload.url=url}
|
let path='/account/verification';let payload={};if(url){payload.url=url}
|
||||||
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||||
|
@ -59,26 +61,38 @@ return http.put(path,{'content-type':'application/json',},payload)}};let avatars
|
||||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
||||||
if(width){payload.width=width}
|
if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||||
|
if(width){payload.width=width}
|
||||||
|
if(height){payload.height=height}
|
||||||
|
if(color){payload.color=color}
|
||||||
|
if(background){payload.background=background}
|
||||||
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||||
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
||||||
if(size){payload.size=size}
|
if(size){payload.size=size}
|
||||||
if(margin){payload.margin=margin}
|
if(margin){payload.margin=margin}
|
||||||
if(download){payload.download=download}
|
if(download){payload.download=download}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||||
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters}
|
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters}
|
||||||
if(offset){payload.offset=offset}
|
if(offset){payload.offset=offset}
|
||||||
if(limit){payload.limit=limit}
|
if(limit){payload.limit=limit}
|
||||||
|
@ -110,7 +124,7 @@ if(read){payload.read=read}
|
||||||
if(write){payload.write=write}
|
if(write){payload.write=write}
|
||||||
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
|
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
|
||||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload.search=search}
|
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload.search=search}
|
||||||
if(limit){payload.limit=limit}
|
if(limit){payload.limit=limit}
|
||||||
if(offset){payload.offset=offset}
|
if(offset){payload.offset=offset}
|
||||||
if(orderType){payload.orderType=orderType}
|
if(orderType){payload.orderType=orderType}
|
||||||
|
@ -128,15 +142,18 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
||||||
if(write){payload.write=write}
|
if(write){payload.write=write}
|
||||||
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
if(background){payload.background=background}
|
if(background){payload.background=background}
|
||||||
if(output){payload.output=output}
|
if(output){payload.output=output}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
||||||
payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||||
if(limit){payload.limit=limit}
|
if(limit){payload.limit=limit}
|
||||||
if(offset){payload.offset=offset}
|
if(offset){payload.offset=offset}
|
||||||
if(orderType){payload.orderType=orderType}
|
if(orderType){payload.orderType=orderType}
|
||||||
|
|
44
app/sdks/client-web/types/index.d.ts
vendored
44
app/sdks/client-web/types/index.d.ts
vendored
|
@ -248,10 +248,11 @@ declare namespace Appwrite {
|
||||||
* @param {string} provider
|
* @param {string} provider
|
||||||
* @param {string} success
|
* @param {string} success
|
||||||
* @param {string} failure
|
* @param {string} failure
|
||||||
|
* @param {string[]} scopes
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
createOAuth2Session(provider: string, success: string, failure: string): Promise<object>;
|
createOAuth2Session(provider: string, success: string, failure: string, scopes: string[]): Promise<object>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete Account Session
|
* Delete Account Session
|
||||||
|
@ -386,6 +387,30 @@ declare namespace Appwrite {
|
||||||
*/
|
*/
|
||||||
getImage(url: string, width: number, height: number): string;
|
getImage(url: string, width: number, height: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get User Initials
|
||||||
|
*
|
||||||
|
* Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
* app. By default, this route will try to print your logged-in user name or
|
||||||
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
* parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* You can use the color and background params to change the avatar colors. By
|
||||||
|
* default, a random theme will be selected. The random theme will persist for
|
||||||
|
* the user's initials when reloading the same theme will always return for
|
||||||
|
* the same initials.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {number} width
|
||||||
|
* @param {number} height
|
||||||
|
* @param {string} color
|
||||||
|
* @param {string} background
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getInitials(name: string, width: number, height: number, color: string, background: string): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get QR Code
|
* Get QR Code
|
||||||
*
|
*
|
||||||
|
@ -555,15 +580,26 @@ declare namespace Appwrite {
|
||||||
/**
|
/**
|
||||||
* List Currencies
|
* List Currencies
|
||||||
*
|
*
|
||||||
* List of all currencies, including currency symol, name, plural, and decimal
|
* List of all currencies, including currency symbol, name, plural, and
|
||||||
* digits for all major and minor currencies. You can use the locale header to
|
* decimal digits for all major and minor currencies. You can use the locale
|
||||||
* get the data in a supported language.
|
* header to get the data in a supported language.
|
||||||
*
|
*
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
getCurrencies(): Promise<object>;
|
getCurrencies(): Promise<object>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Languages
|
||||||
|
*
|
||||||
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
* in English, and name in the respective language.
|
||||||
|
*
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getLanguages(): Promise<object>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Storage {
|
export interface Storage {
|
||||||
|
|
11
app/sdks/console-web/docs/examples/avatars/get-initials.md
Normal file
11
app/sdks/console-web/docs/examples/avatars/get-initials.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
let sdk = new Appwrite();
|
||||||
|
|
||||||
|
sdk
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||||
|
;
|
||||||
|
|
||||||
|
let result = sdk.avatars.getInitials();
|
||||||
|
|
||||||
|
console.log(result); // Resource URL
|
15
app/sdks/console-web/docs/examples/locale/get-languages.md
Normal file
15
app/sdks/console-web/docs/examples/locale/get-languages.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
let sdk = new Appwrite();
|
||||||
|
|
||||||
|
sdk
|
||||||
|
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||||
|
.setProject('5df5acd0d48c2') // Your project ID
|
||||||
|
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
|
||||||
|
;
|
||||||
|
|
||||||
|
let promise = sdk.locale.getLanguages();
|
||||||
|
|
||||||
|
promise.then(function (response) {
|
||||||
|
console.log(response); // Success
|
||||||
|
}, function (error) {
|
||||||
|
console.log(error); // Failure
|
||||||
|
});
|
|
@ -226,28 +226,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
request.onload = function () {
|
request.onload = function () {
|
||||||
|
let data = request.response;
|
||||||
|
let contentType = this.getResponseHeader('content-type') || '';
|
||||||
|
contentType = contentType.substring(0, contentType.indexOf(';'));
|
||||||
|
|
||||||
|
switch (contentType) {
|
||||||
|
case 'application/json':
|
||||||
|
data = JSON.parse(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
||||||
|
|
||||||
|
if(window.localStorage && cookieFallback) {
|
||||||
|
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
||||||
|
window.localStorage.setItem('cookieFallback', cookieFallback);
|
||||||
|
}
|
||||||
|
|
||||||
if (4 === request.readyState && 399 >= request.status) {
|
if (4 === request.readyState && 399 >= request.status) {
|
||||||
let data = request.response;
|
|
||||||
let contentType = this.getResponseHeader('content-type') || '';
|
|
||||||
contentType = contentType.substring(0, contentType.indexOf(';'));
|
|
||||||
|
|
||||||
switch (contentType) {
|
|
||||||
case 'application/json':
|
|
||||||
data = JSON.parse(data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
|
||||||
|
|
||||||
if(window.localStorage && cookieFallback) {
|
|
||||||
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
|
||||||
window.localStorage.setItem('cookieFallback', cookieFallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reject(new Error(request.statusText));
|
reject(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -745,10 +744,11 @@
|
||||||
* @param {string} provider
|
* @param {string} provider
|
||||||
* @param {string} success
|
* @param {string} success
|
||||||
* @param {string} failure
|
* @param {string} failure
|
||||||
|
* @param {string[]} scopes
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||||
if(provider === undefined) {
|
if(provider === undefined) {
|
||||||
throw new Error('Missing required parameter: "provider"');
|
throw new Error('Missing required parameter: "provider"');
|
||||||
}
|
}
|
||||||
|
@ -765,11 +765,30 @@
|
||||||
payload['failure'] = failure;
|
payload['failure'] = failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scopes) {
|
||||||
|
payload['scopes'] = scopes;
|
||||||
|
}
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -923,7 +942,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -968,7 +1002,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1000,7 +1049,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1044,7 +1108,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1088,7 +1167,93 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get User Initials
|
||||||
|
*
|
||||||
|
* Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
* app. By default, this route will try to print your logged-in user name or
|
||||||
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
* parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* You can use the color and background params to change the avatar colors. By
|
||||||
|
* default, a random theme will be selected. The random theme will persist for
|
||||||
|
* the user's initials when reloading the same theme will always return for
|
||||||
|
* the same initials.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {number} width
|
||||||
|
* @param {number} height
|
||||||
|
* @param {string} color
|
||||||
|
* @param {string} background
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getInitials: function(name = '', width = 500, height = 500, color = '', background = '') {
|
||||||
|
let path = '/avatars/initials';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
|
if(name) {
|
||||||
|
payload['name'] = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(width) {
|
||||||
|
payload['width'] = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(height) {
|
||||||
|
payload['height'] = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(color) {
|
||||||
|
payload['color'] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(background) {
|
||||||
|
payload['background'] = background;
|
||||||
|
}
|
||||||
|
|
||||||
|
payload['project'] = config.project;
|
||||||
|
|
||||||
|
payload['key'] = config.key;
|
||||||
|
|
||||||
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1135,7 +1300,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
@ -1979,9 +2159,9 @@
|
||||||
/**
|
/**
|
||||||
* List Currencies
|
* List Currencies
|
||||||
*
|
*
|
||||||
* List of all currencies, including currency symol, name, plural, and decimal
|
* List of all currencies, including currency symbol, name, plural, and
|
||||||
* digits for all major and minor currencies. You can use the locale header to
|
* decimal digits for all major and minor currencies. You can use the locale
|
||||||
* get the data in a supported language.
|
* header to get the data in a supported language.
|
||||||
*
|
*
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
|
@ -1991,6 +2171,26 @@
|
||||||
|
|
||||||
let payload = {};
|
let payload = {};
|
||||||
|
|
||||||
|
return http
|
||||||
|
.get(path, {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
}, payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Languages
|
||||||
|
*
|
||||||
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
* in English, and name in the respective language.
|
||||||
|
*
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getLanguages: function() {
|
||||||
|
let path = '/locale/languages';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
return http
|
return http
|
||||||
.get(path, {
|
.get(path, {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
|
@ -3492,7 +3692,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -3547,7 +3762,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -3580,7 +3810,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
|
45
app/sdks/console-web/src/sdk.min.js
vendored
45
app/sdks/console-web/src/sdk.min.js
vendored
|
@ -9,9 +9,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
||||||
switch(headers['content-type']){case 'application/json':params=JSON.stringify(params);break;case 'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param)});params=formData;break}
|
switch(headers['content-type']){case 'application/json':params=JSON.stringify(params);break;case 'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param)});params=formData;break}
|
||||||
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=!0;request.open(method,path,!0);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue}
|
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=!0;request.open(method,path,!0);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue}
|
||||||
request.setRequestHeader(key,headers[key])}}
|
request.setRequestHeader(key,headers[key])}}
|
||||||
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case 'application/json':data=JSON.parse(data);break}
|
request.onload=function(){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case 'application/json':data=JSON.parse(data);break}
|
||||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback)}
|
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback)}
|
||||||
resolve(data)}else{reject(new Error(request.statusText))}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)}
|
if(4===request.readyState&&399>=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)}
|
||||||
request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||||
let path='/account';let payload={};if(email){payload.email=email}
|
let path='/account';let payload={};if(email){payload.email=email}
|
||||||
|
@ -45,10 +45,12 @@ return http.put(path,{'content-type':'application/json',},payload)},getSessions:
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||||
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
let path='/account/sessions';let payload={};if(email){payload.email=email}
|
||||||
if(password){payload.password=password}
|
if(password){payload.password=password}
|
||||||
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success}
|
||||||
if(failure){payload.failure=failure}
|
if(failure){payload.failure=failure}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
if(scopes){payload.scopes=scopes}
|
||||||
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
|
||||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/account/verification';let payload={};if(url){payload.url=url}
|
let path='/account/verification';let payload={};if(url){payload.url=url}
|
||||||
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
return http.post(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||||
|
@ -59,26 +61,38 @@ return http.put(path,{'content-type':'application/json',},payload)}};let avatars
|
||||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||||
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
let path='/avatars/image';let payload={};if(url){payload.url=url}
|
||||||
if(width){payload.width=width}
|
if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload.name=name}
|
||||||
|
if(width){payload.width=width}
|
||||||
|
if(height){payload.height=height}
|
||||||
|
if(color){payload.color=color}
|
||||||
|
if(background){payload.background=background}
|
||||||
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
|
||||||
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
let path='/avatars/qr';let payload={};if(text){payload.text=text}
|
||||||
if(size){payload.size=size}
|
if(size){payload.size=size}
|
||||||
if(margin){payload.margin=margin}
|
if(margin){payload.margin=margin}
|
||||||
if(download){payload.download=download}
|
if(download){payload.download=download}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload.search=search}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload.search=search}
|
||||||
if(limit){payload.limit=limit}
|
if(limit){payload.limit=limit}
|
||||||
if(offset){payload.offset=offset}
|
if(offset){payload.offset=offset}
|
||||||
if(orderType){payload.orderType=orderType}
|
if(orderType){payload.orderType=orderType}
|
||||||
|
@ -133,7 +147,7 @@ if(write){payload.write=write}
|
||||||
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
|
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')}
|
||||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
|
||||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
|
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')}
|
||||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')}
|
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')}
|
||||||
let path='/projects';let payload={};if(name){payload.name=name}
|
let path='/projects';let payload={};if(name){payload.name=name}
|
||||||
if(teamId){payload.teamId=teamId}
|
if(teamId){payload.teamId=teamId}
|
||||||
|
@ -299,15 +313,18 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
||||||
if(write){payload.write=write}
|
if(write){payload.write=write}
|
||||||
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width}
|
||||||
if(height){payload.height=height}
|
if(height){payload.height=height}
|
||||||
if(quality){payload.quality=quality}
|
if(quality){payload.quality=quality}
|
||||||
if(background){payload.background=background}
|
if(background){payload.background=background}
|
||||||
if(output){payload.output=output}
|
if(output){payload.output=output}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')}
|
||||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as}
|
||||||
payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param))}}else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]))}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'')}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search}
|
||||||
if(limit){payload.limit=limit}
|
if(limit){payload.limit=limit}
|
||||||
if(offset){payload.offset=offset}
|
if(offset){payload.offset=offset}
|
||||||
if(orderType){payload.orderType=orderType}
|
if(orderType){payload.orderType=orderType}
|
||||||
|
|
44
app/sdks/console-web/types/index.d.ts
vendored
44
app/sdks/console-web/types/index.d.ts
vendored
|
@ -269,10 +269,11 @@ declare namespace Appwrite {
|
||||||
* @param {string} provider
|
* @param {string} provider
|
||||||
* @param {string} success
|
* @param {string} success
|
||||||
* @param {string} failure
|
* @param {string} failure
|
||||||
|
* @param {string[]} scopes
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
createOAuth2Session(provider: string, success: string, failure: string): Promise<object>;
|
createOAuth2Session(provider: string, success: string, failure: string, scopes: string[]): Promise<object>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete Account Session
|
* Delete Account Session
|
||||||
|
@ -407,6 +408,30 @@ declare namespace Appwrite {
|
||||||
*/
|
*/
|
||||||
getImage(url: string, width: number, height: number): string;
|
getImage(url: string, width: number, height: number): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get User Initials
|
||||||
|
*
|
||||||
|
* Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
* app. By default, this route will try to print your logged-in user name or
|
||||||
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
* parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* You can use the color and background params to change the avatar colors. By
|
||||||
|
* default, a random theme will be selected. The random theme will persist for
|
||||||
|
* the user's initials when reloading the same theme will always return for
|
||||||
|
* the same initials.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {number} width
|
||||||
|
* @param {number} height
|
||||||
|
* @param {string} color
|
||||||
|
* @param {string} background
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getInitials(name: string, width: number, height: number, color: string, background: string): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get QR Code
|
* Get QR Code
|
||||||
*
|
*
|
||||||
|
@ -792,15 +817,26 @@ declare namespace Appwrite {
|
||||||
/**
|
/**
|
||||||
* List Currencies
|
* List Currencies
|
||||||
*
|
*
|
||||||
* List of all currencies, including currency symol, name, plural, and decimal
|
* List of all currencies, including currency symbol, name, plural, and
|
||||||
* digits for all major and minor currencies. You can use the locale header to
|
* decimal digits for all major and minor currencies. You can use the locale
|
||||||
* get the data in a supported language.
|
* header to get the data in a supported language.
|
||||||
*
|
*
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
getCurrencies(): Promise<object>;
|
getCurrencies(): Promise<object>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Languages
|
||||||
|
*
|
||||||
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
* in English, and name in the respective language.
|
||||||
|
*
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getLanguages(): Promise<object>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Projects {
|
export interface Projects {
|
||||||
|
|
|
@ -5,8 +5,12 @@ require_once __DIR__.'/../init.php';
|
||||||
|
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
|
use Appwrite\ClamAV\Network;
|
||||||
|
use Appwrite\Storage\Device\Local;
|
||||||
|
use Appwrite\Storage\Storage;
|
||||||
use Utopia\CLI\CLI;
|
use Utopia\CLI\CLI;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
|
use Utopia\Domains\Domain;
|
||||||
|
|
||||||
$cli = new CLI();
|
$cli = new CLI();
|
||||||
|
|
||||||
|
@ -26,4 +30,227 @@ $cli
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$cli
|
||||||
|
->task('doctor')
|
||||||
|
->desc('Validate server health')
|
||||||
|
->action(function () use ($request, $register) {
|
||||||
|
Console::log(" __ ____ ____ _ _ ____ __ ____ ____ __ __
|
||||||
|
/ _\ ( _ \( _ \/ )( \( _ \( )(_ _)( __) ( )/ \
|
||||||
|
/ \ ) __/ ) __/\ /\ / ) / )( )( ) _) _ )(( O )
|
||||||
|
\_/\_/(__) (__) (_/\_)(__\_)(__) (__) (____)(_)(__)\__/ ");
|
||||||
|
|
||||||
|
Console::log("\n".'👩⚕️ Running '.APP_NAME.' Doctor for version '.$request->getServer('_APP_VERSION', 'UNKNOWN').' ...'."\n");
|
||||||
|
|
||||||
|
Console::log('Checking for production best practices...');
|
||||||
|
|
||||||
|
$domain = new Domain($request->getServer('_APP_DOMAIN'));
|
||||||
|
|
||||||
|
if(!$domain->isKnown() || $domain->isTest()) {
|
||||||
|
Console::log('🔴 Hostname has a public suffix');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 Hostname has a public suffix');
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = new Domain($request->getServer('_APP_DOMAIN_TARGET'));
|
||||||
|
|
||||||
|
if(!$domain->isKnown() || $domain->isTest()) {
|
||||||
|
Console::log('🔴 CNAME target has a public suffix');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 CNAME target has a public suffix');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->getServer('_APP_OPENSSL_KEY_V1', 'your-secret-key') === 'your-secret-key') {
|
||||||
|
Console::log('🔴 Using a unique secret key for encryption');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 Using a unique secret key for encryption');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->getServer('_APP_ENV', 'development') === 'development') {
|
||||||
|
Console::log('🔴 App enviornment is set for production');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 App enviornment is set for production');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->getServer('_APP_OPTIONS_ABUSE', 'disabled') === 'disabled') {
|
||||||
|
Console::log('🔴 Abuse protection is enabled');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 Abuse protection is enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
$authWhitelistEmails = $request->getServer('_APP_CONSOLE_WHITELIST_EMAILS', null);
|
||||||
|
$authWhitelistIPs = $request->getServer('_APP_CONSOLE_WHITELIST_IPS', null);
|
||||||
|
$authWhitelistDomains = $request->getServer('_APP_CONSOLE_WHITELIST_DOMAINS', null);
|
||||||
|
|
||||||
|
if(empty($authWhitelistEmails)
|
||||||
|
&& empty($authWhitelistDomains)
|
||||||
|
&& empty($authWhitelistIPs)
|
||||||
|
) {
|
||||||
|
Console::log('🔴 Console access limits are disabled');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 Console access limits are enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($request->getServer('_APP_OPTIONS_FORCE_HTTPS', null))) {
|
||||||
|
Console::log('🔴 HTTP force option is disabled');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::log('🟢 HTTP force option is enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(0.2);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Console::log("\n".'Checking connectivity...');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
//throw $th;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$register->get('db'); /* @var $db PDO */
|
||||||
|
Console::success('Database............connected 👍');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::error('Database.........disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$register->get('cache');
|
||||||
|
Console::success('Queue...............connected 👍');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::error('Queue............disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$register->get('cache');
|
||||||
|
Console::success('Cache...............connected 👍');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::error('Cache............disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->getServer('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
|
||||||
|
$antiVirus = new Network('clamav', 3310);
|
||||||
|
|
||||||
|
if((@$antiVirus->ping())) {
|
||||||
|
Console::success('AntiVirus...........connected 👍');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::error('AntiVirus........disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */
|
||||||
|
|
||||||
|
$mail->addAddress('demo@example.com', 'Example.com');
|
||||||
|
$mail->Subject = 'Test SMTP Connection';
|
||||||
|
$mail->Body = 'Hello World';
|
||||||
|
$mail->AltBody = 'Hello World';
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
Console::success('SMTP................connected 👍');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::error('SMTP.............disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
$host = $request->getServer('_APP_STATSD_HOST', 'telegraf');
|
||||||
|
$port = $request->getServer('_APP_STATSD_PORT', 8125);
|
||||||
|
|
||||||
|
if($fp = @fsockopen('udp://'.$host, $port, $errCode, $errStr, 2)){
|
||||||
|
Console::success('StatsD..............connected 👍');
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
Console::error('StatsD...........disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
$host = $request->getServer('_APP_INFLUXDB_HOST', '');
|
||||||
|
$port = $request->getServer('_APP_INFLUXDB_PORT', '');
|
||||||
|
|
||||||
|
if($fp = @fsockopen($host, $port, $errCode, $errStr, 2)){
|
||||||
|
Console::success('InfluxDB............connected 👍');
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
Console::error('InfluxDB.........disconnected 👎');
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(0.2);
|
||||||
|
|
||||||
|
Console::log('');
|
||||||
|
Console::log('Checking volumes...');
|
||||||
|
|
||||||
|
foreach ([
|
||||||
|
'Uploads' => APP_STORAGE_UPLOADS,
|
||||||
|
'Cache' => APP_STORAGE_CACHE,
|
||||||
|
'Config' => APP_STORAGE_CONFIG,
|
||||||
|
'Certs' => APP_STORAGE_CERTIFICATES
|
||||||
|
] as $key => $volume) {
|
||||||
|
$device = new Local($volume);
|
||||||
|
|
||||||
|
if (is_readable($device->getRoot())) {
|
||||||
|
Console::success('🟢 '.$key.' Volume is readable');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::error('🔴 '.$key.' Volume is unreadable');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_writable($device->getRoot())) {
|
||||||
|
Console::success('🟢 '.$key.' Volume is writeable');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::error('🔴 '.$key.' Volume is unwriteable');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(0.2);
|
||||||
|
|
||||||
|
Console::log('');
|
||||||
|
Console::log('Checking disk space usage...');
|
||||||
|
|
||||||
|
foreach ([
|
||||||
|
'Uploads' => APP_STORAGE_UPLOADS,
|
||||||
|
'Cache' => APP_STORAGE_CACHE,
|
||||||
|
'Config' => APP_STORAGE_CONFIG,
|
||||||
|
'Certs' => APP_STORAGE_CERTIFICATES
|
||||||
|
] as $key => $volume) {
|
||||||
|
$device = new Local($volume);
|
||||||
|
|
||||||
|
$percentage = (($device->getPartitionTotalSpace() - $device->getPartitionFreeSpace())
|
||||||
|
/ $device->getPartitionTotalSpace()) * 100;
|
||||||
|
|
||||||
|
$message = $key.' Volume has '.Storage::human($device->getPartitionFreeSpace()) . ' free space ('.round($percentage, 2).'% used)';
|
||||||
|
|
||||||
|
if ($percentage < 80) {
|
||||||
|
Console::success('🟢 ' . $message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::error('🔴 ' . $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Console::log('');
|
||||||
|
$version = json_decode(@file_get_contents($request->getServer('_APP_HOME', 'http://localhost').'/v1/health/version'), true);
|
||||||
|
|
||||||
|
if($version && isset($version['version'])) {
|
||||||
|
if(version_compare($version['version'], $request->getServer('_APP_VERSION', 'UNKNOWN')) === 0) {
|
||||||
|
Console::info('You are running the latest version of '.APP_NAME.'! 🥳');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::info('A new version ('.$version['version'].') is available! 🥳'."\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console::error('Failed to check for a newer version'."\n");
|
||||||
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::error('Failed to check for a newer version'."\n");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$cli->run();
|
$cli->run();
|
||||||
|
|
|
@ -341,7 +341,7 @@ $graph = $this->getParam('graph', false);
|
||||||
<input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />
|
<input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
|
<label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
|
||||||
<input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My Web App" />
|
<input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My iOS App" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
|
<label data-ls-attrs="for=key-{{platform.$id}}">Bundle ID <span class="tooltip large" data-tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode."><i class="icon-question"></i></span></label>
|
||||||
<input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.cpmpany.appname" data-ls-bind="{{platform.key}}" required />
|
<input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.cpmpany.appname" data-ls-bind="{{platform.key}}" required />
|
||||||
|
@ -371,7 +371,7 @@ $graph = $this->getParam('graph', false);
|
||||||
<input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />
|
<input type="hidden" name="platformId" data-ls-bind="{{platform.$id}}" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
|
<label data-ls-attrs="for=name-{{platform.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different apps."><i class="icon-question"></i></span></label>
|
||||||
<input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My Web App" />
|
<input type="text" class="full-width" data-ls-attrs="id=name-{{platform.$id}}" name="name" required autocomplete="off" data-ls-bind="{{platform.name}}" placeholder="My Android App" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=key-{{platform.$id}}">Package Name <span class="tooltip large" data-tooltip="Your package name is generally the applicationId in your app-level build.gradle file."><i class="icon-question"></i></span></label>
|
<label data-ls-attrs="for=key-{{platform.$id}}">Package Name <span class="tooltip large" data-tooltip="Your package name is generally the applicationId in your app-level build.gradle file."><i class="icon-question"></i></span></label>
|
||||||
<input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.cpmpany.appname" data-ls-bind="{{platform.key}}" required />
|
<input name="key" type="text" class="margin-bottom" autocomplete="off" placeholder="com.cpmpany.appname" data-ls-bind="{{platform.key}}" required />
|
||||||
|
@ -387,7 +387,7 @@ $graph = $this->getParam('graph', false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="template-flutter-android-update">
|
<script type="text/html" id="template-flutter-android-update">
|
||||||
<div data-ls-template="template-ios-update" data-type="script"></div>
|
<div data-ls-template="template-android-update" data-type="script"></div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="template-flutter-macos-update">
|
<script type="text/html" id="template-flutter-macos-update">
|
||||||
|
|
|
@ -49,7 +49,7 @@ $scopes = $this->getParam('scopes', []);
|
||||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||||
<input type="hidden" name="keyId" data-ls-bind="{{key.$id}}" />
|
<input type="hidden" name="keyId" data-ls-bind="{{key.$id}}" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=name-{{key.$id}}">Name</label>
|
<label data-ls-attrs="for=name-{{key.$id}}">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different API keys."><i class="icon-question"></i></span></label>
|
||||||
<input type="text" class="full-width" data-ls-attrs="id=name-{{key.$id}}" name="name" required autocomplete="off" data-ls-bind="{{key.name}}" />
|
<input type="text" class="full-width" data-ls-attrs="id=name-{{key.$id}}" name="name" required autocomplete="off" data-ls-bind="{{key.name}}" />
|
||||||
|
|
||||||
<label data-ls-attrs="for=scopes-{{key.$id}}">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
|
<label data-ls-attrs="for=scopes-{{key.$id}}">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
|
||||||
|
@ -144,7 +144,7 @@ $scopes = $this->getParam('scopes', []);
|
||||||
|
|
||||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||||
|
|
||||||
<label for="name">Name</label>
|
<label for="name">Name <span class="tooltip large" data-tooltip="Choose any name that will help you distinguish between your different API keys."><i class="icon-question"></i></span></label>
|
||||||
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
|
<input type="text" class="full-width" id="name" name="name" required autocomplete="off" />
|
||||||
|
|
||||||
<label for="scopes">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
|
<label for="scopes">Scopes (<a data-ls-attrs="href={{env.HOME}}/docs/keys" target="_blank" rel="noopener">Learn more</a>)</label>
|
||||||
|
|
|
@ -298,20 +298,20 @@ $providers = $this->getParam('providers', []);
|
||||||
<li data-state="/console/users/providers?project={{router.params.project}}">
|
<li data-state="/console/users/providers?project={{router.params.project}}">
|
||||||
<h2>OAuth2 Providers</h2>
|
<h2>OAuth2 Providers</h2>
|
||||||
|
|
||||||
<div class="box margin-bottom margin-top-large"
|
<div class="margin-bottom margin-top-large"
|
||||||
data-service="projects.get"
|
data-service="projects.get"
|
||||||
data-event="load,projects.create,projects.update,projects.deleteProject"
|
data-event="load,projects.create,projects.update,projects.deleteProject"
|
||||||
data-name="console-project"
|
data-name="console-project"
|
||||||
data-param-project-id="{{router.params.project}}"
|
data-param-project-id="{{router.params.project}}"
|
||||||
data-scope="console">
|
data-scope="console">
|
||||||
<ul class="list">
|
<ul class="tiles cell-3 margin-bottom-small">
|
||||||
<?php foreach ($providers as $provider => $data):
|
<?php foreach ($providers as $provider => $data):
|
||||||
if (isset($data['enabled']) && !$data['enabled']) { continue; }
|
if (isset($data['enabled']) && !$data['enabled']) { continue; }
|
||||||
if (isset($data['mock']) && $data['mock']) { continue; }
|
if (isset($data['mock']) && $data['mock']) { continue; }
|
||||||
$form = (isset($data['form'])) ? $data['form'] : false;
|
$form = (isset($data['form'])) ? $data['form'] : false;
|
||||||
$beta = (isset($data['beta'])) ? $data['beta'] : false;
|
$beta = (isset($data['beta'])) ? $data['beta'] : false;
|
||||||
?>
|
?>
|
||||||
<li class="clear <?php echo (isset($data['enabled']) && !$data['enabled']) ? 'dev-feature' : ''; ?>">
|
<li class="<?php echo (isset($data['enabled']) && !$data['enabled']) ? 'dev-feature' : ''; ?>">
|
||||||
<div data-ui-modal class="modal close" data-button-alias="none" data-open-event="provider-update-<?php echo $provider; ?>">
|
<div data-ui-modal class="modal close" data-button-alias="none" data-open-event="provider-update-<?php echo $provider; ?>">
|
||||||
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
|
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
|
||||||
|
|
||||||
|
@ -363,24 +363,29 @@ $providers = $this->getParam('providers', []);
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span data-ls-if="
|
<div class="box padding-small margin-bottom">
|
||||||
{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Appid}} &&
|
<span data-ls-if="
|
||||||
{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Secret}}">
|
{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Appid}} &&
|
||||||
<button class="switch on pull-end margin-top-small" data-ls-ui-trigger="provider-update-<?php echo $provider; ?>"></button>
|
{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Secret}}">
|
||||||
</span>
|
<button class="switch on pull-end" data-ls-ui-trigger="provider-update-<?php echo $provider; ?>"></button>
|
||||||
<span data-ls-if="
|
</span>
|
||||||
!{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Appid}} ||
|
|
||||||
!{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Secret}}">
|
|
||||||
<button class="switch pull-end margin-top-small" data-ls-ui-trigger="provider-update-<?php echo $this->escape($provider); ?>"></button>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<img src="/images/oauth2/<?php echo $this->escape(strtolower($provider)); ?>.png?buster=<?php echo APP_CACHE_BUSTER; ?>" alt="<?php echo $this->escape(ucfirst($provider)); ?> Logo" class="pull-start provider margin-end" />
|
<span data-ls-if="
|
||||||
<span>
|
!{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Appid}} ||
|
||||||
<?php echo ucfirst($provider); ?> <?php if($beta): ?>(beta)<?php endif; ?>
|
!{{console-project.usersOauth2<?php echo $this->escape(ucfirst($provider)); ?>Secret}}">
|
||||||
</span>
|
<button class="switch pull-end" data-ls-ui-trigger="provider-update-<?php echo $this->escape($provider); ?>"></button>
|
||||||
<p class="margin-bottom-no margin-top-small text-one-liner">
|
</span>
|
||||||
<a href="<?php echo $data['developers']; ?>" target="_blank" rel="noopener">OAuth2 Developer Docs<i class="icon-link-ext"></i></a>
|
|
||||||
</p>
|
<img src="/images/oauth2/<?php echo $this->escape(strtolower($provider)); ?>.png?buster=<?php echo APP_CACHE_BUSTER; ?>" alt="<?php echo $this->escape(ucfirst($provider)); ?> Logo" class="pull-start provider margin-end" />
|
||||||
|
|
||||||
|
<span class="text-size-small">
|
||||||
|
<?php echo ucfirst($provider); ?> <?php if($beta): ?>(beta)<?php endif; ?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<p class="margin-bottom-no text-one-liner text-size-small">
|
||||||
|
<a href="<?php echo $data['developers']; ?>" target="_blank" rel="noopener">OAuth2 Docs<i class="icon-link-ext"></i></a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
3
bin/doctor
Executable file
3
bin/doctor
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
php /usr/share/nginx/html/app/tasks/init.php doctor
|
|
@ -42,8 +42,7 @@
|
||||||
"utopia-php/registry": "0.2.*",
|
"utopia-php/registry": "0.2.*",
|
||||||
"utopia-php/domains": "0.2.*",
|
"utopia-php/domains": "0.2.*",
|
||||||
|
|
||||||
"chrisboulton/php-resque": "*",
|
"resque/php-resque": "1.3.6",
|
||||||
"chrisboulton/php-resque-scheduler": "*",
|
|
||||||
"geoip2/geoip2": "2.9.0",
|
"geoip2/geoip2": "2.9.0",
|
||||||
"piwik/device-detector": "3.5.1",
|
"piwik/device-detector": "3.5.1",
|
||||||
"dragonmantank/cron-expression": "2.2.0",
|
"dragonmantank/cron-expression": "2.2.0",
|
||||||
|
|
101
composer.lock
generated
101
composer.lock
generated
|
@ -195,16 +195,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "colinmollenhour/credis",
|
"name": "colinmollenhour/credis",
|
||||||
"version": "1.11.1",
|
"version": "1.11.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/colinmollenhour/credis.git",
|
"url": "https://github.com/colinmollenhour/credis.git",
|
||||||
"reference": "bd1da4698ab1918477f9e71e5ff0062b9a345008"
|
"reference": "b8b2bd6b87d2d4df67065f3510efb80d5f9c4e53"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/bd1da4698ab1918477f9e71e5ff0062b9a345008",
|
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/b8b2bd6b87d2d4df67065f3510efb80d5f9c4e53",
|
||||||
"reference": "bd1da4698ab1918477f9e71e5ff0062b9a345008",
|
"reference": "b8b2bd6b87d2d4df67065f3510efb80d5f9c4e53",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
],
|
],
|
||||||
"description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.",
|
"description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.",
|
||||||
"homepage": "https://github.com/colinmollenhour/credis",
|
"homepage": "https://github.com/colinmollenhour/credis",
|
||||||
"time": "2019-11-26T18:09:45+00:00"
|
"time": "2020-06-15T19:25:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
|
@ -485,12 +485,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/guzzle.git",
|
"url": "https://github.com/guzzle/guzzle.git",
|
||||||
"reference": "a4a1b6930528a8f7ee03518e6442ec7a44155d9d"
|
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/a4a1b6930528a8f7ee03518e6442ec7a44155d9d",
|
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
|
||||||
"reference": "a4a1b6930528a8f7ee03518e6442ec7a44155d9d",
|
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -498,7 +498,7 @@
|
||||||
"guzzlehttp/promises": "^1.0",
|
"guzzlehttp/promises": "^1.0",
|
||||||
"guzzlehttp/psr7": "^1.6.1",
|
"guzzlehttp/psr7": "^1.6.1",
|
||||||
"php": ">=5.5",
|
"php": ">=5.5",
|
||||||
"symfony/polyfill-intl-idn": "1.17.0"
|
"symfony/polyfill-intl-idn": "^1.17.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
|
@ -544,7 +544,7 @@
|
||||||
"rest",
|
"rest",
|
||||||
"web service"
|
"web service"
|
||||||
],
|
],
|
||||||
"time": "2020-05-25T19:35:05+00:00"
|
"time": "2020-06-16T21:01:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/promises",
|
"name": "guzzlehttp/promises",
|
||||||
|
@ -1137,16 +1137,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-intl-idn",
|
"name": "symfony/polyfill-intl-idn",
|
||||||
"version": "v1.17.0",
|
"version": "dev-master",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||||
"reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a"
|
"reference": "a57f8161502549a742a63c09f0a604997bf47027"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a",
|
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a57f8161502549a742a63c09f0a604997bf47027",
|
||||||
"reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a",
|
"reference": "a57f8161502549a742a63c09f0a604997bf47027",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1161,6 +1161,10 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.17-dev"
|
"dev-master": "1.17-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/polyfill",
|
||||||
|
"url": "https://github.com/symfony/polyfill"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -1195,7 +1199,7 @@
|
||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2020-05-12T16:47:27+00:00"
|
"time": "2020-06-06T08:46:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-mbstring",
|
"name": "symfony/polyfill-mbstring",
|
||||||
|
@ -1203,12 +1207,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c"
|
"reference": "7110338d81ce1cbc3e273136e4574663627037a7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c",
|
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7110338d81ce1cbc3e273136e4574663627037a7",
|
||||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c",
|
"reference": "7110338d81ce1cbc3e273136e4574663627037a7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1221,6 +1225,10 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.17-dev"
|
"dev-master": "1.17-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/polyfill",
|
||||||
|
"url": "https://github.com/symfony/polyfill"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -1254,7 +1262,7 @@
|
||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2020-05-12T16:47:27+00:00"
|
"time": "2020-06-06T08:46:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php72",
|
"name": "symfony/polyfill-php72",
|
||||||
|
@ -1262,12 +1270,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||||
"reference": "f048e612a3905f34931127360bdd2def19a5e582"
|
"reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582",
|
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a",
|
||||||
"reference": "f048e612a3905f34931127360bdd2def19a5e582",
|
"reference": "3d9c70ff1b9f6bb618f9954b2f7f760220c2b38a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1277,6 +1285,10 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.17-dev"
|
"dev-master": "1.17-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/polyfill",
|
||||||
|
"url": "https://github.com/symfony/polyfill"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -1309,7 +1321,7 @@
|
||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2020-05-12T16:47:27+00:00"
|
"time": "2020-06-06T08:46:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/abuse",
|
"name": "utopia-php/abuse",
|
||||||
|
@ -1741,7 +1753,7 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/appwrite/sdk-generator",
|
"url": "https://github.com/appwrite/sdk-generator",
|
||||||
"reference": "a1672098ecc6a08cc400314e373b0d1cd5885f79"
|
"reference": "0125b705aa78e4432972fdcc9de3c42b65ee2024"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
|
@ -1771,7 +1783,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||||
"time": "2020-05-30T11:38:32+00:00"
|
"time": "2020-06-17T10:09:35+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/instantiator",
|
"name": "doctrine/instantiator",
|
||||||
|
@ -1779,12 +1791,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/instantiator.git",
|
"url": "https://github.com/doctrine/instantiator.git",
|
||||||
"reference": "a390fde13fc9bc2ffb73340bb8f07201a8e85af8"
|
"reference": "3e7a22aed197e9333cc929e7f6b4300bdae91fcc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/a390fde13fc9bc2ffb73340bb8f07201a8e85af8",
|
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/3e7a22aed197e9333cc929e7f6b4300bdae91fcc",
|
||||||
"reference": "a390fde13fc9bc2ffb73340bb8f07201a8e85af8",
|
"reference": "3e7a22aed197e9333cc929e7f6b4300bdae91fcc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1827,7 +1839,7 @@
|
||||||
"constructor",
|
"constructor",
|
||||||
"instantiate"
|
"instantiate"
|
||||||
],
|
],
|
||||||
"time": "2020-05-30T16:47:47+00:00"
|
"time": "2020-06-15T18:51:04+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "matthiasmullie/minify",
|
"name": "matthiasmullie/minify",
|
||||||
|
@ -3207,12 +3219,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||||
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
|
"reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
|
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
|
||||||
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
|
"reference": "2edd75b8b35d62fd3eeabba73b26b8f1f60ce13d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3225,6 +3237,10 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.17-dev"
|
"dev-master": "1.17-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/polyfill",
|
||||||
|
"url": "https://github.com/symfony/polyfill"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -3257,7 +3273,7 @@
|
||||||
"polyfill",
|
"polyfill",
|
||||||
"portable"
|
"portable"
|
||||||
],
|
],
|
||||||
"time": "2020-05-12T16:14:59+00:00"
|
"time": "2020-06-06T08:46:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "theseer/tokenizer",
|
"name": "theseer/tokenizer",
|
||||||
|
@ -3305,12 +3321,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twigphp/Twig.git",
|
"url": "https://github.com/twigphp/Twig.git",
|
||||||
"reference": "5c6d49589687b4fe694059cab72da1ff5b7a5ece"
|
"reference": "3beabd64bdc91558b41f140cc4b14925f0416cb2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/5c6d49589687b4fe694059cab72da1ff5b7a5ece",
|
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3beabd64bdc91558b41f140cc4b14925f0416cb2",
|
||||||
"reference": "5c6d49589687b4fe694059cab72da1ff5b7a5ece",
|
"reference": "3beabd64bdc91558b41f140cc4b14925f0416cb2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3362,20 +3378,20 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"templating"
|
"templating"
|
||||||
],
|
],
|
||||||
"time": "2020-05-21T09:55:12+00:00"
|
"time": "2020-06-08T10:41:25+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webmozart/assert",
|
"name": "webmozart/assert",
|
||||||
"version": "1.8.0",
|
"version": "1.9.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/webmozart/assert.git",
|
"url": "https://github.com/webmozart/assert.git",
|
||||||
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
|
"reference": "9dc4f203e36f2b486149058bade43c851dd97451"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
|
"url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
|
||||||
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
|
"reference": "9dc4f203e36f2b486149058bade43c851dd97451",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3383,6 +3399,7 @@
|
||||||
"symfony/polyfill-ctype": "^1.8"
|
"symfony/polyfill-ctype": "^1.8"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
|
"phpstan/phpstan": "<0.12.20",
|
||||||
"vimeo/psalm": "<3.9.1"
|
"vimeo/psalm": "<3.9.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
@ -3410,7 +3427,7 @@
|
||||||
"check",
|
"check",
|
||||||
"validate"
|
"validate"
|
||||||
],
|
],
|
||||||
"time": "2020-04-18T12:12:48+00:00"
|
"time": "2020-06-16T10:16:42+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -3,6 +3,7 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
traefik:
|
traefik:
|
||||||
image: traefik:v2.1.4
|
image: traefik:v2.1.4
|
||||||
|
container_name: appwrite_traefik
|
||||||
command:
|
command:
|
||||||
- --log.level=DEBUG
|
- --log.level=DEBUG
|
||||||
- --api.insecure=true
|
- --api.insecure=true
|
||||||
|
@ -86,6 +87,7 @@ services:
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: appwrite/mariadb:1.0.3 # fix issues when upgrading using: mysql_upgrade -u root -p
|
image: appwrite/mariadb:1.0.3 # fix issues when upgrading using: mysql_upgrade -u root -p
|
||||||
|
container_name: appwrite_mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -102,6 +104,7 @@ services:
|
||||||
|
|
||||||
maildev:
|
maildev:
|
||||||
image: djfarrelly/maildev
|
image: djfarrelly/maildev
|
||||||
|
container_name: appwrite_maildev
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '1080:80'
|
- '1080:80'
|
||||||
|
@ -110,6 +113,7 @@ services:
|
||||||
|
|
||||||
# smtp:
|
# smtp:
|
||||||
# image: appwrite/smtp:1.0.1
|
# image: appwrite/smtp:1.0.1
|
||||||
|
# container_name: appwrite_smtp
|
||||||
# restart: unless-stopped
|
# restart: unless-stopped
|
||||||
# networks:
|
# networks:
|
||||||
# - appwrite
|
# - appwrite
|
||||||
|
@ -119,6 +123,7 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:5.0
|
image: redis:5.0
|
||||||
|
container_name: appwrite_redis
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -127,6 +132,7 @@ services:
|
||||||
|
|
||||||
clamav:
|
clamav:
|
||||||
image: appwrite/clamav:1.0.9
|
image: appwrite/clamav:1.0.9
|
||||||
|
container_name: appwrite_clamav
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -135,6 +141,7 @@ services:
|
||||||
|
|
||||||
influxdb:
|
influxdb:
|
||||||
image: influxdb:1.6
|
image: influxdb:1.6
|
||||||
|
container_name: appwrite_influxdb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -143,6 +150,7 @@ services:
|
||||||
|
|
||||||
telegraf:
|
telegraf:
|
||||||
image: appwrite/telegraf:1.0.0
|
image: appwrite/telegraf:1.0.0
|
||||||
|
container_name: appwrite_telegraf
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
@ -172,6 +180,7 @@ services:
|
||||||
|
|
||||||
chronograf:
|
chronograf:
|
||||||
image: chronograf:1.5
|
image: chronograf:1.5
|
||||||
|
container_name: appwrite_chronograf
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 0.2.3
|
||||||
|
|
||||||
|
- Added support for custom OAuth2 scopes
|
||||||
|
|
||||||
## 0.2.2
|
## 0.2.2
|
||||||
|
|
||||||
- Fixed an error that happend when the OAuth session creation request was sent before any other API call
|
- Fixed an error that happend when the OAuth session creation request was sent before any other API call
|
||||||
|
|
56
public/dist/scripts/app-all.js
vendored
56
public/dist/scripts/app-all.js
vendored
|
@ -15,9 +15,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
||||||
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});params=formData;break;}
|
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});params=formData;break;}
|
||||||
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
||||||
request.setRequestHeader(key,headers[key]);}}
|
request.setRequestHeader(key,headers[key]);}}
|
||||||
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
|
request.onload=function(){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
|
||||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
||||||
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
if(4===request.readyState&&399>=request.status){resolve(data);}else{reject(data);}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
||||||
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||||
let path='/account';let payload={};if(email){payload['email']=email;}
|
let path='/account';let payload={};if(email){payload['email']=email;}
|
||||||
|
@ -51,10 +51,13 @@ return http.put(path,{'content-type':'application/json',},payload);},getSessions
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||||
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
||||||
if(password){payload['password']=password;}
|
if(password){payload['password']=password;}
|
||||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
||||||
if(failure){payload['failure']=failure;}
|
if(failure){payload['failure']=failure;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
if(scopes){payload['scopes']=scopes;}
|
||||||
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
||||||
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||||
|
@ -65,26 +68,45 @@ return http.put(path,{'content-type':'application/json',},payload);}};let avatar
|
||||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
||||||
if(width){payload['width']=width;}
|
if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload['name']=name;}
|
||||||
|
if(width){payload['width']=width;}
|
||||||
|
if(height){payload['height']=height;}
|
||||||
|
if(color){payload['color']=color;}
|
||||||
|
if(background){payload['background']=background;}
|
||||||
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||||
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
||||||
if(size){payload['size']=size;}
|
if(size){payload['size']=size;}
|
||||||
if(margin){payload['margin']=margin;}
|
if(margin){payload['margin']=margin;}
|
||||||
if(download){payload['download']=download;}
|
if(download){payload['download']=download;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||||
if(limit){payload['limit']=limit;}
|
if(limit){payload['limit']=limit;}
|
||||||
if(offset){payload['offset']=offset;}
|
if(offset){payload['offset']=offset;}
|
||||||
if(orderType){payload['orderType']=orderType;}
|
if(orderType){payload['orderType']=orderType;}
|
||||||
|
@ -139,7 +161,7 @@ if(write){payload['write']=write;}
|
||||||
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
||||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
||||||
let path='/projects';let payload={};if(name){payload['name']=name;}
|
let path='/projects';let payload={};if(name){payload['name']=name;}
|
||||||
if(teamId){payload['teamId']=teamId;}
|
if(teamId){payload['teamId']=teamId;}
|
||||||
|
@ -305,15 +327,21 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
||||||
if(write){payload['write']=write;}
|
if(write){payload['write']=write;}
|
||||||
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
if(background){payload['background']=background;}
|
if(background){payload['background']=background;}
|
||||||
if(output){payload['output']=output;}
|
if(output){payload['output']=output;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||||
if(limit){payload['limit']=limit;}
|
if(limit){payload['limit']=limit;}
|
||||||
if(offset){payload['offset']=offset;}
|
if(offset){payload['offset']=offset;}
|
||||||
if(orderType){payload['orderType']=orderType;}
|
if(orderType){payload['orderType']=orderType;}
|
||||||
|
|
56
public/dist/scripts/app-dep.js
vendored
56
public/dist/scripts/app-dep.js
vendored
|
@ -15,9 +15,9 @@ if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=a
|
||||||
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});params=formData;break;}
|
switch(headers['content-type']){case'application/json':params=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();Object.keys(params).forEach(function(key){let param=params[key];formData.append(key+(Array.isArray(param)?'[]':''),param);});params=formData;break;}
|
||||||
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
return new Promise(function(resolve,reject){let request=new XMLHttpRequest(),key;request.withCredentials=true;request.open(method,path,true);for(key in headers){if(headers.hasOwnProperty(key)){if(key==='content-type'&&headers[key]==='multipart/form-data'){continue;}
|
||||||
request.setRequestHeader(key,headers[key]);}}
|
request.setRequestHeader(key,headers[key]);}}
|
||||||
request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
|
request.onload=function(){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;}
|
||||||
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
let cookieFallback=this.getResponseHeader('X-Fallback-Cookies')||'';if(window.localStorage&&cookieFallback){window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');window.localStorage.setItem('cookieFallback',cookieFallback);}
|
||||||
resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
if(4===request.readyState&&399>=request.status){resolve(data);}else{reject(data);}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);}
|
||||||
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||||
let path='/account';let payload={};if(email){payload['email']=email;}
|
let path='/account';let payload={};if(email){payload['email']=email;}
|
||||||
|
@ -51,10 +51,13 @@ return http.put(path,{'content-type':'application/json',},payload);},getSessions
|
||||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||||
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
|
||||||
if(password){payload['password']=password;}
|
if(password){payload['password']=password;}
|
||||||
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"');}
|
||||||
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;}
|
||||||
if(failure){payload['failure']=failure;}
|
if(failure){payload['failure']=failure;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
if(scopes){payload['scopes']=scopes;}
|
||||||
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');}
|
||||||
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
let path='/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
let path='/account/verification';let payload={};if(url){payload['url']=url;}
|
||||||
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||||
|
@ -65,26 +68,45 @@ return http.put(path,{'content-type':'application/json',},payload);}};let avatar
|
||||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
let path='/avatars/favicon';let payload={};if(url){payload['url']=url;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||||
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||||
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
let path='/avatars/image';let payload={};if(url){payload['url']=url;}
|
||||||
if(width){payload['width']=width;}
|
if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getInitials:function(name='',width=500,height=500,color='',background=''){let path='/avatars/initials';let payload={};if(name){payload['name']=name;}
|
||||||
|
if(width){payload['width']=width;}
|
||||||
|
if(height){payload['height']=height;}
|
||||||
|
if(color){payload['color']=color;}
|
||||||
|
if(background){payload['background']=background;}
|
||||||
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');}
|
||||||
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
let path='/avatars/qr';let payload={};if(text){payload['text']=text;}
|
||||||
if(size){payload['size']=size;}
|
if(size){payload['size']=size;}
|
||||||
if(margin){payload['margin']=margin;}
|
if(margin){payload['margin']=margin;}
|
||||||
if(download){payload['download']=download;}
|
if(download){payload['download']=download;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;}
|
||||||
if(limit){payload['limit']=limit;}
|
if(limit){payload['limit']=limit;}
|
||||||
if(offset){payload['offset']=offset;}
|
if(offset){payload['offset']=offset;}
|
||||||
if(orderType){payload['orderType']=orderType;}
|
if(orderType){payload['orderType']=orderType;}
|
||||||
|
@ -139,7 +161,7 @@ if(write){payload['write']=write;}
|
||||||
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||||
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');}
|
||||||
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');}
|
||||||
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getAntiVirus:function(){let path='/health/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueFunctions:function(){let path='/health/queue/functions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getLanguages:function(){let path='/locale/languages';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');}
|
||||||
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');}
|
||||||
let path='/projects';let payload={};if(name){payload['name']=name;}
|
let path='/projects';let payload={};if(name){payload['name']=name;}
|
||||||
if(teamId){payload['teamId']=teamId;}
|
if(teamId){payload['teamId']=teamId;}
|
||||||
|
@ -305,15 +327,21 @@ let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);le
|
||||||
if(write){payload['write']=write;}
|
if(write){payload['write']=write;}
|
||||||
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
return http.put(path,{'content-type':'application/json',},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;}
|
||||||
if(height){payload['height']=height;}
|
if(height){payload['height']=height;}
|
||||||
if(quality){payload['quality']=quality;}
|
if(quality){payload['quality']=quality;}
|
||||||
if(background){payload['background']=background;}
|
if(background){payload['background']=background;}
|
||||||
if(output){payload['output']=output;}
|
if(output){payload['output']=output;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');}
|
||||||
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;}
|
||||||
payload['project']=config.project;payload['key']=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
payload['project']=config.project;payload['key']=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index<payload[p].length;index++){let param=payload[p][index];query.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}}
|
||||||
|
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}}
|
||||||
|
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;}
|
||||||
if(limit){payload['limit']=limit;}
|
if(limit){payload['limit']=limit;}
|
||||||
if(offset){payload['offset']=offset;}
|
if(offset){payload['offset']=offset;}
|
||||||
if(orderType){payload['orderType']=orderType;}
|
if(orderType){payload['orderType']=orderType;}
|
||||||
|
|
|
@ -226,28 +226,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
request.onload = function () {
|
request.onload = function () {
|
||||||
|
let data = request.response;
|
||||||
|
let contentType = this.getResponseHeader('content-type') || '';
|
||||||
|
contentType = contentType.substring(0, contentType.indexOf(';'));
|
||||||
|
|
||||||
|
switch (contentType) {
|
||||||
|
case 'application/json':
|
||||||
|
data = JSON.parse(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
||||||
|
|
||||||
|
if(window.localStorage && cookieFallback) {
|
||||||
|
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
||||||
|
window.localStorage.setItem('cookieFallback', cookieFallback);
|
||||||
|
}
|
||||||
|
|
||||||
if (4 === request.readyState && 399 >= request.status) {
|
if (4 === request.readyState && 399 >= request.status) {
|
||||||
let data = request.response;
|
|
||||||
let contentType = this.getResponseHeader('content-type') || '';
|
|
||||||
contentType = contentType.substring(0, contentType.indexOf(';'));
|
|
||||||
|
|
||||||
switch (contentType) {
|
|
||||||
case 'application/json':
|
|
||||||
data = JSON.parse(data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || '';
|
|
||||||
|
|
||||||
if(window.localStorage && cookieFallback) {
|
|
||||||
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
|
||||||
window.localStorage.setItem('cookieFallback', cookieFallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reject(new Error(request.statusText));
|
reject(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -745,10 +744,11 @@
|
||||||
* @param {string} provider
|
* @param {string} provider
|
||||||
* @param {string} success
|
* @param {string} success
|
||||||
* @param {string} failure
|
* @param {string} failure
|
||||||
|
* @param {string[]} scopes
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
|
createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) {
|
||||||
if(provider === undefined) {
|
if(provider === undefined) {
|
||||||
throw new Error('Missing required parameter: "provider"');
|
throw new Error('Missing required parameter: "provider"');
|
||||||
}
|
}
|
||||||
|
@ -765,11 +765,30 @@
|
||||||
payload['failure'] = failure;
|
payload['failure'] = failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scopes) {
|
||||||
|
payload['scopes'] = scopes;
|
||||||
|
}
|
||||||
|
|
||||||
payload['project'] = config.project;
|
payload['project'] = config.project;
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
window.location = config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -923,7 +942,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -968,7 +1002,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1000,7 +1049,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1044,7 +1108,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1088,7 +1167,93 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get User Initials
|
||||||
|
*
|
||||||
|
* Use this endpoint to show your user initials avatar icon on your website or
|
||||||
|
* app. By default, this route will try to print your logged-in user name or
|
||||||
|
* email initials. You can also overwrite the user name if you pass the 'name'
|
||||||
|
* parameter. If no name is given and no user is logged, an empty avatar will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* You can use the color and background params to change the avatar colors. By
|
||||||
|
* default, a random theme will be selected. The random theme will persist for
|
||||||
|
* the user's initials when reloading the same theme will always return for
|
||||||
|
* the same initials.
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {number} width
|
||||||
|
* @param {number} height
|
||||||
|
* @param {string} color
|
||||||
|
* @param {string} background
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getInitials: function(name = '', width = 500, height = 500, color = '', background = '') {
|
||||||
|
let path = '/avatars/initials';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
|
if(name) {
|
||||||
|
payload['name'] = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(width) {
|
||||||
|
payload['width'] = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(height) {
|
||||||
|
payload['height'] = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(color) {
|
||||||
|
payload['color'] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(background) {
|
||||||
|
payload['background'] = background;
|
||||||
|
}
|
||||||
|
|
||||||
|
payload['project'] = config.project;
|
||||||
|
|
||||||
|
payload['key'] = config.key;
|
||||||
|
|
||||||
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -1135,7 +1300,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
@ -1979,9 +2159,9 @@
|
||||||
/**
|
/**
|
||||||
* List Currencies
|
* List Currencies
|
||||||
*
|
*
|
||||||
* List of all currencies, including currency symol, name, plural, and decimal
|
* List of all currencies, including currency symbol, name, plural, and
|
||||||
* digits for all major and minor currencies. You can use the locale header to
|
* decimal digits for all major and minor currencies. You can use the locale
|
||||||
* get the data in a supported language.
|
* header to get the data in a supported language.
|
||||||
*
|
*
|
||||||
* @throws {Error}
|
* @throws {Error}
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
|
@ -1991,6 +2171,26 @@
|
||||||
|
|
||||||
let payload = {};
|
let payload = {};
|
||||||
|
|
||||||
|
return http
|
||||||
|
.get(path, {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
}, payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Languages
|
||||||
|
*
|
||||||
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
||||||
|
* in English, and name in the respective language.
|
||||||
|
*
|
||||||
|
* @throws {Error}
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getLanguages: function() {
|
||||||
|
let path = '/locale/languages';
|
||||||
|
|
||||||
|
let payload = {};
|
||||||
|
|
||||||
return http
|
return http
|
||||||
.get(path, {
|
.get(path, {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
|
@ -3492,7 +3692,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -3547,7 +3762,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
},
|
},
|
||||||
|
@ -3580,7 +3810,22 @@
|
||||||
|
|
||||||
payload['key'] = config.key;
|
payload['key'] = config.key;
|
||||||
|
|
||||||
let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
|
|
||||||
|
let query = [];
|
||||||
|
|
||||||
|
for (let p in payload) {
|
||||||
|
if(Array.isArray(payload[p])) {
|
||||||
|
for (let index = 0; index < payload[p].length; index++) {
|
||||||
|
let param = payload[p][index];
|
||||||
|
query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.join("&");
|
||||||
|
|
||||||
return config.endpoint + path + ((query) ? '?' + query : '');
|
return config.endpoint + path + ((query) ? '?' + query : '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CNAME extends Validator
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
{
|
{
|
||||||
return 'Inavlid CNAME record';
|
return 'Invalid CNAME record';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,8 +85,8 @@ class Origin extends Validator
|
||||||
return 'Unsupported platform';
|
return 'Unsupported platform';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Inavlid Origin. Register your new client ('.$this->host.') as a new '
|
return 'Invalid Origin. Register your new client ('.$this->host.') as a new '
|
||||||
.$this->platforms[$this->client].' platform on your project console';
|
.$this->platforms[$this->client].' platform on your project console dashboard';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,19 +47,19 @@ class OriginTest extends TestCase
|
||||||
$this->assertEquals($validator->isValid('http://example.com:80'), false);
|
$this->assertEquals($validator->isValid('http://example.com:80'), false);
|
||||||
|
|
||||||
$this->assertEquals($validator->isValid('appwrite-ios://com.company.appname'), false);
|
$this->assertEquals($validator->isValid('appwrite-ios://com.company.appname'), false);
|
||||||
$this->assertEquals($validator->getDescription(), 'Inavlid Origin. Register your new client (com.company.appname) as a new iOS platform on your project console');
|
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new iOS platform on your project console dashboard');
|
||||||
|
|
||||||
$this->assertEquals($validator->isValid('appwrite-android://com.company.appname'), false);
|
$this->assertEquals($validator->isValid('appwrite-android://com.company.appname'), false);
|
||||||
$this->assertEquals($validator->getDescription(), 'Inavlid Origin. Register your new client (com.company.appname) as a new Android platform on your project console');
|
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new Android platform on your project console dashboard');
|
||||||
|
|
||||||
$this->assertEquals($validator->isValid('appwrite-macos://com.company.appname'), false);
|
$this->assertEquals($validator->isValid('appwrite-macos://com.company.appname'), false);
|
||||||
$this->assertEquals($validator->getDescription(), 'Inavlid Origin. Register your new client (com.company.appname) as a new macOS platform on your project console');
|
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new macOS platform on your project console dashboard');
|
||||||
|
|
||||||
$this->assertEquals($validator->isValid('appwrite-linux://com.company.appname'), false);
|
$this->assertEquals($validator->isValid('appwrite-linux://com.company.appname'), false);
|
||||||
$this->assertEquals($validator->getDescription(), 'Inavlid Origin. Register your new client (com.company.appname) as a new Linux platform on your project console');
|
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new Linux platform on your project console dashboard');
|
||||||
|
|
||||||
$this->assertEquals($validator->isValid('appwrite-windows://com.company.appname'), false);
|
$this->assertEquals($validator->isValid('appwrite-windows://com.company.appname'), false);
|
||||||
$this->assertEquals($validator->getDescription(), 'Inavlid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console');
|
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue