1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00

Merge branch '0.9.x' into feat-influx-env-variables

This commit is contained in:
Torsten Dittmann 2021-06-03 14:59:41 +02:00 committed by GitHub
commit 8825d95a4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
89 changed files with 6837 additions and 6441 deletions

View file

@ -1,3 +1,25 @@
# NOT PUBLISHED YET
## Features
- Added file created date to file info on the console
- Added file size to file info on the console
- Refactored Devices page in Console:
- Renamed *Devices* to *Sessions*
- Add Provider Icon to each Session
- Add Anonymous Account Placeholder
- Upgraded telegraf docker image version to v1.1.0
## Bugs
- Fixed bug when removing a project member on the Appwrite console (#1214)
- Fixed Swoole buffer output size to allow downloading files bigger than allowed size (#1189)
- Fixed ClamAV status when anti virus is not running (#1188)
- Fixed deleteSession which was removing cookieFallback from the localstorage on any logout instead of current session (#1206)
- Fixed Nepal flag (#1173)
- Fixed a bug in the Twitch OAuth adapter (#1209)
- Fixed missing session object when OAuth session creation event is triggered (#1208)
# Version 0.8.0 # Version 0.8.0
## Features ## Features
@ -35,6 +57,8 @@
- Fixed incorrect audit worker event names (#1143) - Fixed incorrect audit worker event names (#1143)
- Increased limit of memberships fetched in `createTeamMembership` to 2000 (#1143) - Increased limit of memberships fetched in `createTeamMembership` to 2000 (#1143)
- Fixed exception thrown when SSL certificate is already stored in the database (#1151) - Fixed exception thrown when SSL certificate is already stored in the database (#1151)
- Fixed user delete button in the Appwrite console (#1216)
- Fixed missing placeholder for user name when empty (#1220)
## Breaking Changes (Read before upgrading!) ## Breaking Changes (Read before upgrading!)

View file

@ -6,7 +6,7 @@ return [
'email-password' => [ 'email-password' => [
'name' => 'Email/Password', 'name' => 'Email/Password',
'key' => 'usersAuthEmailPassword', 'key' => 'usersAuthEmailPassword',
'icon' => '/images/users/email-password.png', 'icon' => '/images/users/email.png',
'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreateSession', 'docs' => 'https://appwrite.io/docs/client/account?sdk=web#accountCreateSession',
'enabled' => true, 'enabled' => true,
], ],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -56,13 +56,13 @@
.main { .main {
background: {{bg-content}}; background: {{bg-content}};
border-radius: 3px; border-radius: 10px;
width: 100%; width: 100%;
} }
.wrapper { .wrapper {
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 30px 30px 15px 30px;
} }
.content-block { .content-block {
@ -97,16 +97,15 @@
.btn table td { .btn table td {
background-color: {{bg-content}}; background-color: {{bg-content}};
border-radius: 5px; border-radius: 20px;
text-align: center; text-align: center;
} }
.btn a { .btn a {
background-color: {{bg-content}}; background-color: {{bg-content}};
border: solid 1px {{bg-cta}}; border-radius: 20px;
border-radius: 5px;
box-sizing: border-box; box-sizing: border-box;
color: #3498db; color: #577590;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
@ -123,45 +122,17 @@
.btn-primary a { .btn-primary a {
background-color: {{bg-cta}}; background-color: {{bg-cta}};
border-color: {{bg-cta}};
color: {{text-cta}}; color: {{text-cta}};
} }
@media only screen and (max-width: 620px) { @media only screen and (max-width: 620px) {
table[class=body] h1 { .container {
font-size: 28px !important; padding: 0;
margin-bottom: 10px !important; width: 100%;
} }
table[class=body] p { .btn-primary a {
font-size: 16px !important; font-size: 13px;
}
table[class=body] .wrapper {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
} }
} }
@ -198,12 +169,11 @@
} }
.btn-primary table td:hover { .btn-primary table td:hover {
background-color: {{bg-cta-hover}} !important; opacity: 0.7 !important;
} }
.btn-primary a:hover { .btn-primary a:hover {
background-color: {{bg-cta-hover}} !important; opacity: 0.7 !important;
border-color: {{bg-cta-hover}} !important;
} }
} }
</style> </style>
@ -220,15 +190,17 @@
<td class="wrapper"> <td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0"> <table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td> <td>{{content}}</td>
{{content}}
</td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<!-- <div style="text-align: center; line-height: 25px; margin: 15px 0; font-size: 12px; color: #40404c;">
<a href="https://appwrite.io" style="text-decoration: none; color: #40404c;">Powered by <img src="https://appwrite.io/images/appwrite-footer-light.svg" height="15" style="margin: -3px 0" /></a>
</div> -->
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>

View file

@ -1,7 +1,7 @@
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary"> <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
<tbody> <tbody>
<tr> <tr>
<td align="left"> <td>
<table role="presentation" border="0" cellpadding="0" cellspacing="0"> <table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tbody> <tbody>
<tr> <tr>
@ -18,9 +18,7 @@
</tbody> </tbody>
</table> </table>
<p> <p>
<small> <a href="{{redirect}}" target="_blank">
<a href="{{redirect}}" target="_blank"> {{redirect}}
{{redirect}} </a>
</a>
</small>
</p> </p>

View file

@ -1,4 +1,4 @@
<p> <p>
Hola {{name}}, Hola {{name}},
</p> </p>
<p> <p>
@ -12,4 +12,4 @@
Gracias, Gracias,
<br /> <br />
Equipo {{project}} Equipo {{project}}
</p> </p>

View file

@ -1,5 +1,5 @@
<p> <p>
Hola, Hola {{name}},
</p> </p>
<p> <p>
Te hemos enviado este correo porque <b>{{owner}}</b> quiere invitarte a formar parte del equipo <b>{{team}}</b> en {{project}}. Te hemos enviado este correo porque <b>{{owner}}</b> quiere invitarte a formar parte del equipo <b>{{team}}</b> en {{project}}.

View file

@ -2,7 +2,7 @@
שלום {{name}}, שלום {{name}},
</p> </p>
<p> <p>
נא ללחוץ על הקישור שלהלן כדי לאמת את החשבון שלך. אנא לחץ\י על הקישור שלהלן כדי לאמת את החשבון שלך.
</p> </p>
{{cta}} {{cta}}
<p> <p>

View file

@ -5,7 +5,7 @@
הודעת דוא״ל זו נשלחה אליך כי <b>{{owner}}</b> ביקש להזמינך להצטרף לצוות <b>{{team}}</b> ב־{{project}}. הודעת דוא״ל זו נשלחה אליך כי <b>{{owner}}</b> ביקש להזמינך להצטרף לצוות <b>{{team}}</b> ב־{{project}}.
</p> </p>
<p> <p>
כדי להצטרף לצוות <b>{{team}}</b>, נא ללחוץ על הקישור: כדי להצטרף לצוות <b>{{team}}</b>, אנא לחץ\י על הקישור:
</p> </p>
{{cta}} {{cta}}
<p> <p>

View file

@ -2,7 +2,7 @@
שלום {{name}}, שלום {{name}},
</p> </p>
<p> <p>
נא ללחוץ על הקישור שלהלן כדי לאפס את הסיסמה שלך ב־{{project}}. אנא לחץ\י על הקישור שלהלן כדי לאפס את הסיסמה שלך ב־{{project}}.
</p> </p>
{{cta}} {{cta}}
<p> <p>

View file

@ -15,7 +15,7 @@ return [
[ [
'key' => 'web', 'key' => 'web',
'name' => 'Web', 'name' => 'Web',
'version' => '3.0.0', 'version' => '3.0.4',
'url' => 'https://github.com/appwrite/sdk-for-web', 'url' => 'https://github.com/appwrite/sdk-for-web',
'package' => 'https://www.npmjs.com/package/appwrite', 'package' => 'https://www.npmjs.com/package/appwrite',
'enabled' => true, 'enabled' => true,
@ -62,7 +62,7 @@ return [
[ [
'key' => 'flutter', 'key' => 'flutter',
'name' => 'Flutter', 'name' => 'Flutter',
'version' => '0.6.0', 'version' => '0.6.2',
'url' => 'https://github.com/appwrite/sdk-for-flutter', 'url' => 'https://github.com/appwrite/sdk-for-flutter',
'package' => 'https://pub.dev/packages/appwrite', 'package' => 'https://pub.dev/packages/appwrite',
'enabled' => true, 'enabled' => true,
@ -178,7 +178,7 @@ return [
[ [
'key' => 'nodejs', 'key' => 'nodejs',
'name' => 'Node.js', 'name' => 'Node.js',
'version' => '2.2.1', 'version' => '2.2.2',
'url' => 'https://github.com/appwrite/sdk-for-node', 'url' => 'https://github.com/appwrite/sdk-for-node',
'package' => 'https://www.npmjs.com/package/node-appwrite', 'package' => 'https://www.npmjs.com/package/node-appwrite',
'enabled' => true, 'enabled' => true,
@ -195,7 +195,7 @@ return [
[ [
'key' => 'deno', 'key' => 'deno',
'name' => 'Deno', 'name' => 'Deno',
'version' => '0.2.0', 'version' => '0.2.1',
'url' => 'https://github.com/appwrite/sdk-for-deno', 'url' => 'https://github.com/appwrite/sdk-for-deno',
'package' => 'https://deno.land/x/appwrite', 'package' => 'https://deno.land/x/appwrite',
'enabled' => true, 'enabled' => true,
@ -212,7 +212,7 @@ return [
[ [
'key' => 'php', 'key' => 'php',
'name' => 'PHP', 'name' => 'PHP',
'version' => '2.1.0', 'version' => '2.1.1',
'url' => 'https://github.com/appwrite/sdk-for-php', 'url' => 'https://github.com/appwrite/sdk-for-php',
'package' => 'https://packagist.org/packages/appwrite/appwrite', 'package' => 'https://packagist.org/packages/appwrite/appwrite',
'enabled' => true, 'enabled' => true,
@ -229,7 +229,7 @@ return [
[ [
'key' => 'python', 'key' => 'python',
'name' => 'Python', 'name' => 'Python',
'version' => '0.2.0', 'version' => '0.2.1',
'url' => 'https://github.com/appwrite/sdk-for-python', 'url' => 'https://github.com/appwrite/sdk-for-python',
'package' => 'https://pypi.org/project/appwrite/', 'package' => 'https://pypi.org/project/appwrite/',
'enabled' => true, 'enabled' => true,
@ -246,7 +246,7 @@ return [
[ [
'key' => 'ruby', 'key' => 'ruby',
'name' => 'Ruby', 'name' => 'Ruby',
'version' => '2.1.0', 'version' => '2.1.1',
'url' => 'https://github.com/appwrite/sdk-for-ruby', 'url' => 'https://github.com/appwrite/sdk-for-ruby',
'package' => 'https://rubygems.org/gems/appwrite', 'package' => 'https://rubygems.org/gems/appwrite',
'enabled' => true, 'enabled' => true,
@ -314,7 +314,7 @@ return [
[ [
'key' => 'dart', 'key' => 'dart',
'name' => 'Dart', 'name' => 'Dart',
'version' => '0.6.0', 'version' => '0.6.1',
'url' => 'https://github.com/appwrite/sdk-for-dart', 'url' => 'https://github.com/appwrite/sdk-for-dart',
'package' => 'https://pub.dev/packages/dart_appwrite', 'package' => 'https://pub.dev/packages/dart_appwrite',
'enabled' => true, 'enabled' => true,
@ -331,7 +331,7 @@ return [
[ [
'key' => 'cli', 'key' => 'cli',
'name' => 'Command Line', 'name' => 'Command Line',
'version' => '0.10.0', 'version' => '0.10.1',
'url' => 'https://github.com/appwrite/sdk-for-cli', 'url' => 'https://github.com/appwrite/sdk-for-cli',
'package' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://github.com/appwrite/sdk-for-cli',
'enabled' => true, 'enabled' => true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -386,7 +386,8 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->inject('projectDB') ->inject('projectDB')
->inject('geodb') ->inject('geodb')
->inject('audits') ->inject('audits')
->action(function ($provider, $code, $state, $request, $response, $project, $user, $projectDB, $geodb, $audits) use ($oauthDefaultSuccess) { ->inject('events')
->action(function ($provider, $code, $state, $request, $response, $project, $user, $projectDB, $geodb, $audits, $events) use ($oauthDefaultSuccess) {
/** @var Utopia\Swoole\Request $request */ /** @var Utopia\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Document $project */ /** @var Appwrite\Database\Document $project */
@ -579,6 +580,8 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->setParam('data', ['provider' => $provider]) ->setParam('data', ['provider' => $provider])
; ;
$events->setParam('eventData', $response->output($session, Response::MODEL_SESSION));
if (!Config::getParam('domainVerification')) { if (!Config::getParam('domainVerification')) {
$response $response
->addHeader('X-Fallback-Cookies', \json_encode([Auth::$cookieName => Auth::encodeSession($user->getId(), $secret)])) ->addHeader('X-Fallback-Cookies', \json_encode([Auth::$cookieName => Auth::encodeSession($user->getId(), $secret)]))
@ -714,10 +717,16 @@ App::post('/v1/account/sessions/anonymous')
$detector->getDevice() $detector->getDevice()
)); ));
$user->setAttribute('sessions', $session, Document::SET_TYPE_APPEND);
Authorization::setRole('user:'.$user->getId()); Authorization::setRole('user:'.$user->getId());
$session = $projectDB->createDocument($session->getArrayCopy());
if (false === $session) {
throw new Exception('Failed saving session to DB', 500);
}
$user->setAttribute('sessions', $session, Document::SET_TYPE_APPEND);
$user = $projectDB->updateDocument($user->getArrayCopy()); $user = $projectDB->updateDocument($user->getArrayCopy());
if (false === $user) { if (false === $user) {
@ -1266,16 +1275,16 @@ App::delete('/v1/account/sessions/:sessionId')
->setParam('resource', '/user/'.$user->getId()) ->setParam('resource', '/user/'.$user->getId())
; ;
if (!Config::getParam('domainVerification')) {
$response
->addHeader('X-Fallback-Cookies', \json_encode([]))
;
}
$session->setAttribute('current', false); $session->setAttribute('current', false);
if ($session->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too if ($session->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too
$session->setAttribute('current', true); $session->setAttribute('current', true);
if (!Config::getParam('domainVerification')) {
$response
->addHeader('X-Fallback-Cookies', \json_encode([]))
;
}
$response $response
->addCookie(Auth::$cookieName.'_legacy', '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, null) ->addCookie(Auth::$cookieName.'_legacy', '', \time() - 3600, '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, null)
@ -1453,17 +1462,16 @@ App::post('/v1/account/recovery')
$cta = new Template(__DIR__.'/../../config/locale/templates/email-cta.tpl'); $cta = new Template(__DIR__.'/../../config/locale/templates/email-cta.tpl');
$body $body
->setParam('{{content}}', $content->render()) ->setParam('{{content}}', $content->render(false))
->setParam('{{cta}}', $cta->render()) ->setParam('{{cta}}', $cta->render())
->setParam('{{title}}', $locale->getText('account.emails.recovery.title')) ->setParam('{{title}}', $locale->getText('account.emails.recovery.title'))
->setParam('{{direction}}', $locale->getText('settings.direction')) ->setParam('{{direction}}', $locale->getText('settings.direction'))
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]'])) ->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
->setParam('{{name}}', $profile->getAttribute('name')) ->setParam('{{name}}', $profile->getAttribute('name'))
->setParam('{{redirect}}', $url) ->setParam('{{redirect}}', $url)
->setParam('{{bg-body}}', '#f6f6f6') ->setParam('{{bg-body}}', '#f7f7f7')
->setParam('{{bg-content}}', '#ffffff') ->setParam('{{bg-content}}', '#ffffff')
->setParam('{{bg-cta}}', '#3498db') ->setParam('{{bg-cta}}', '#073b4c')
->setParam('{{bg-cta-hover}}', '#34495e')
->setParam('{{text-content}}', '#000000') ->setParam('{{text-content}}', '#000000')
->setParam('{{text-cta}}', '#ffffff') ->setParam('{{text-cta}}', '#ffffff')
; ;
@ -1656,17 +1664,16 @@ App::post('/v1/account/verification')
$cta = new Template(__DIR__.'/../../config/locale/templates/email-cta.tpl'); $cta = new Template(__DIR__.'/../../config/locale/templates/email-cta.tpl');
$body $body
->setParam('{{content}}', $content->render()) ->setParam('{{content}}', $content->render(false))
->setParam('{{cta}}', $cta->render()) ->setParam('{{cta}}', $cta->render())
->setParam('{{title}}', $locale->getText('account.emails.verification.title')) ->setParam('{{title}}', $locale->getText('account.emails.verification.title'))
->setParam('{{direction}}', $locale->getText('settings.direction')) ->setParam('{{direction}}', $locale->getText('settings.direction'))
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]'])) ->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
->setParam('{{name}}', $user->getAttribute('name')) ->setParam('{{name}}', $user->getAttribute('name'))
->setParam('{{redirect}}', $url) ->setParam('{{redirect}}', $url)
->setParam('{{bg-body}}', '#f6f6f6') ->setParam('{{bg-body}}', '#f7f7f7')
->setParam('{{bg-content}}', '#ffffff') ->setParam('{{bg-content}}', '#ffffff')
->setParam('{{bg-cta}}', '#3498db') ->setParam('{{bg-cta}}', '#073b4c')
->setParam('{{bg-cta-hover}}', '#34495e')
->setParam('{{text-content}}', '#000000') ->setParam('{{text-content}}', '#000000')
->setParam('{{text-cta}}', '#ffffff') ->setParam('{{text-cta}}', '#ffffff')
; ;

View file

@ -6,6 +6,7 @@ use Utopia\Storage\Device\Local;
use Utopia\Storage\Storage; use Utopia\Storage\Storage;
use Appwrite\ClamAV\Network; use Appwrite\ClamAV\Network;
use Appwrite\Event\Event; use Appwrite\Event\Event;
use RuntimeException;
App::get('/v1/health') App::get('/v1/health')
->desc('Get HTTP') ->desc('Get HTTP')
@ -262,11 +263,17 @@ App::get('/v1/health/anti-virus')
$antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'), $antiVirus = new Network(App::getEnv('_APP_STORAGE_ANTIVIRUS_HOST', 'clamav'),
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
try {
$response->json([ $response->json([
'status' => (@$antiVirus->ping()) ? 'online' : 'offline', 'status' => (@$antiVirus->ping()) ? 'online' : 'offline',
'version' => @$antiVirus->version(), 'version' => @$antiVirus->version(),
]); ]);
} catch( RuntimeException $e) {
$response->json([
'status' => 'offline',
'version' => '',
]);
}
}); });
App::get('/v1/health/stats') // Currently only used internally App::get('/v1/health/stats') // Currently only used internally

View file

@ -1268,7 +1268,7 @@ App::post('/v1/projects/:projectId/platforms')
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_PLATFORM) ->label('sdk.response.model', Response::MODEL_PLATFORM)
->param('projectId', null, new UID(), 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('type', null, new WhiteList(['web', 'flutter-ios', 'flutter-android', 'ios', 'android', 'unity'], true), 'Platform type.') ->param('type', null, new WhiteList(['web', 'flutter-ios', 'flutter-android', 'flutter-linux', 'flutter-macos', 'flutter-windows', 'ios', 'android', 'unity'], true), 'Platform type.')
->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.')
->param('key', '', new Text(256), 'Package name for android or bundle ID for iOS. Max length: 256 chars.', true) ->param('key', '', new Text(256), 'Package name for android or bundle ID for iOS. Max length: 256 chars.', true)
->param('store', '', new Text(256), 'App store or Google Play store ID. Max length: 256 chars.', true) ->param('store', '', new Text(256), 'App store or Google Play store ID. Max length: 256 chars.', true)

View file

@ -22,6 +22,7 @@ use Utopia\Image\Image;
use Appwrite\OpenSSL\OpenSSL; use Appwrite\OpenSSL\OpenSSL;
use Appwrite\Utopia\Response; use Appwrite\Utopia\Response;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Validator\Numeric;
App::post('/v1/storage/files') App::post('/v1/storage/files')
->desc('Create File') ->desc('Create File')
@ -245,7 +246,7 @@ App::get('/v1/storage/files/:fileId/preview')
->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true) ->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true)
->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true) ->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true)
->param('borderRadius', 0, new Range(0, 4000), 'Preview image border radius in pixels. Pass an integer between 0 to 4000.', true) ->param('borderRadius', 0, new Range(0, 4000), 'Preview image border radius in pixels. Pass an integer between 0 to 4000.', true)
->param('opacity', 1, new Range(0,1), 'Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.', true) ->param('opacity', 1, new Range(0,1, Range::TYPE_FLOAT), 'Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.', true)
->param('rotation', 0, new Range(0,360), 'Preview image rotation in degrees. Pass an integer between 0 and 360.', true) ->param('rotation', 0, new Range(0,360), 'Preview image rotation in degrees. Pass an integer between 0 and 360.', true)
->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true) ->param('background', '', new HexColor(), 'Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.', true)
->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true) ->param('output', '', new WhiteList(\array_keys(Config::getParam('storage-outputs')), true), 'Output format type (jpeg, jpg, png, gif and webp).', true)

View file

@ -433,7 +433,7 @@ App::post('/v1/teams/:teamId/memberships')
$title = \sprintf($locale->getText('account.emails.invitation.title'), $team->getAttribute('name', '[TEAM-NAME]'), $project->getAttribute('name', ['[APP-NAME]'])); $title = \sprintf($locale->getText('account.emails.invitation.title'), $team->getAttribute('name', '[TEAM-NAME]'), $project->getAttribute('name', ['[APP-NAME]']));
$body $body
->setParam('{{content}}', $content->render()) ->setParam('{{content}}', $content->render(false))
->setParam('{{cta}}', $cta->render()) ->setParam('{{cta}}', $cta->render())
->setParam('{{title}}', $title) ->setParam('{{title}}', $title)
->setParam('{{direction}}', $locale->getText('settings.direction')) ->setParam('{{direction}}', $locale->getText('settings.direction'))
@ -441,10 +441,9 @@ App::post('/v1/teams/:teamId/memberships')
->setParam('{{team}}', $team->getAttribute('name', '[TEAM-NAME]')) ->setParam('{{team}}', $team->getAttribute('name', '[TEAM-NAME]'))
->setParam('{{owner}}', $user->getAttribute('name', '')) ->setParam('{{owner}}', $user->getAttribute('name', ''))
->setParam('{{redirect}}', $url) ->setParam('{{redirect}}', $url)
->setParam('{{bg-body}}', '#f6f6f6') ->setParam('{{bg-body}}', '#f7f7f7')
->setParam('{{bg-content}}', '#ffffff') ->setParam('{{bg-content}}', '#ffffff')
->setParam('{{bg-cta}}', '#3498db') ->setParam('{{bg-cta}}', '#073b4c')
->setParam('{{bg-cta-hover}}', '#34495e')
->setParam('{{text-content}}', '#000000') ->setParam('{{text-content}}', '#000000')
->setParam('{{text-cta}}', '#ffffff') ->setParam('{{text-cta}}', '#ffffff')
; ;
@ -784,7 +783,7 @@ App::delete('/v1/teams/:teamId/memberships/:membershipId')
if ($membership->getAttribute('confirm')) { // Count only confirmed members if ($membership->getAttribute('confirm')) { // Count only confirmed members
$team = $projectDB->updateDocument(\array_merge($team->getArrayCopy(), [ $team = $projectDB->updateDocument(\array_merge($team->getArrayCopy(), [
'sum' => $team->getAttribute('sum', 0) - 1, 'sum' => \max($team->getAttribute('sum', 0) - 1, 0), // Ensure that sum >= 0
])); ]));
} }

View file

@ -8,6 +8,7 @@ use Utopia\Validator\WhiteList;
use Appwrite\Network\Validator\Email; use Appwrite\Network\Validator\Email;
use Utopia\Validator\Text; use Utopia\Validator\Text;
use Utopia\Validator\Range; use Utopia\Validator\Range;
use Utopia\Validator\Boolean;
use Utopia\Audit\Audit; use Utopia\Audit\Audit;
use Utopia\Audit\Adapters\MySQL as AuditAdapter; use Utopia\Audit\Adapters\MySQL as AuditAdapter;
use Appwrite\Auth\Auth; use Appwrite\Auth\Auth;
@ -368,6 +369,43 @@ App::patch('/v1/users/:userId/status')
$response->dynamic($user, Response::MODEL_USER); $response->dynamic($user, Response::MODEL_USER);
}); });
App::patch('/v1/users/:userId/verification')
->desc('Update Email Verification')
->groups(['api', 'users'])
->label('event', 'users.update.verification')
->label('scope', 'users.write')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
->label('sdk.namespace', 'users')
->label('sdk.method', 'updateVerification')
->label('sdk.description', '/docs/references/users/update-user-verification.md')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_USER)
->param('userId', '', new UID(), 'User unique ID.')
->param('emailVerification', false, new Boolean(), 'User Email Verification Status.')
->inject('response')
->inject('projectDB')
->action(function ($userId, $emailVerification, $response, $projectDB) {
/** @var Appwrite\Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */
$user = $projectDB->getDocument($userId);
if (empty($user->getId()) || Database::SYSTEM_COLLECTION_USERS != $user->getCollection()) {
throw new Exception('User not found', 404);
}
$user = $projectDB->updateDocument(\array_merge($user->getArrayCopy(), [
'emailVerification' => $emailVerification,
]));
if (false === $user) {
throw new Exception('Failed saving user to DB', 500);
}
$response->dynamic($user, Response::MODEL_USER);
});
App::patch('/v1/users/:userId/prefs') App::patch('/v1/users/:userId/prefs')
->desc('Update User Preferences') ->desc('Update User Preferences')
->groups(['api', 'users']) ->groups(['api', 'users'])

View file

@ -191,6 +191,31 @@ App::delete('/v1/mock/tests/bar')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
App::get('/v1/mock/tests/general/download')
->desc('Download File')
->groups(['mock'])
->label('scope', 'public')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
->label('sdk.namespace', 'general')
->label('sdk.method', 'download')
->label('sdk.methodType', 'location')
->label('sdk.description', 'Mock a file download request.')
->label('sdk.response.type', '*/*')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.mock', true)
->inject('response')
->action(function ($response) {
/** @var Utopia\Swoole\Request $request */
$response
->setContentType('text/plain')
->addHeader('Content-Disposition', 'attachment; filename="test.txt"')
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT') // 45 days cache
->addHeader('X-Peak', \memory_get_peak_usage())
->send("Download test passed.")
;
});
App::post('/v1/mock/tests/general/upload') App::post('/v1/mock/tests/general/upload')
->desc('Upload File') ->desc('Upload File')
->groups(['mock']) ->groups(['mock'])

View file

@ -48,7 +48,9 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e
//TODO make sure we get array here //TODO make sure we get array here
foreach ($request->getParams() as $key => $value) { // Set request params as potential abuse keys foreach ($request->getParams() as $key => $value) { // Set request params as potential abuse keys
$timeLimit->setParam('{param-'.$key.'}', (\is_array($value)) ? \json_encode($value) : $value); if(!empty($value)) {
$timeLimit->setParam('{param-'.$key.'}', (\is_array($value)) ? \json_encode($value) : $value);
}
} }
$abuse = new Abuse($timeLimit); $abuse = new Abuse($timeLimit);

View file

@ -35,6 +35,7 @@ $http
'http_compression' => true, 'http_compression' => true,
'http_compression_level' => 6, 'http_compression_level' => 6,
'package_max_length' => $payloadSize, 'package_max_length' => $payloadSize,
'buffer_output_size' => $payloadSize,
]) ])
; ;

View file

@ -193,8 +193,8 @@
</div> </div>
</div> </div>
</li> </li>
<li data-state="/console/account/devices"> <li data-state="/console/account/sessions">
<h2>Devices</h2> <h2>Sessions</h2>
<div class="box margin-bottom" <div class="box margin-bottom"
data-service="account.getSessions" data-service="account.getSessions"
@ -250,7 +250,13 @@
</form> </form>
</span> </span>
<img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{session.clientCode|lowercase}}?width=120&height=120&project={{env.PROJECT}},title={{session.clientName}},alt={{session.clientName}}" class="avatar trans pull-start margin-end" /> <div class="pull-start margin-end avatar-container">
<img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{session.clientCode|lowercase}}?width=60&height=60&project={{env.PROJECT}},title={{session.clientName}},alt={{session.clientName}}" class="avatar" loading="lazy" width="60" height="60" />
<div data-ls-if="{{session.provider}} !== 'email'" class="corner">
<img data-ls-attrs="src=/images/users/{{session.provider}}.png?buster=<?php echo APP_CACHE_BUSTER; ?>,title={{session.provider}},alt={{session.provider}}" class="avatar xs" loading="lazy" width="30" height="30" />
</div>
</div>
<span data-ls-if="(!{{log.clientName}})">Unknown</span> <span data-ls-if="(!{{log.clientName}})">Unknown</span>
<span data-ls-if="({{log.clientName}})" data-ls-bind="{{session.clientName}}"></span> <span data-ls-bind="{{session.clientVersion}}"></span> on <span data-ls-bind="{{session.deviceModel}}"></span> <span data-ls-bind="{{session.osName}}"></span> <span data-ls-bind="{{session.osVersion}}"></span> <span data-ls-if="({{log.clientName}})" data-ls-bind="{{session.clientName}}"></span> <span data-ls-bind="{{session.clientVersion}}"></span> on <span data-ls-bind="{{session.deviceModel}}"></span> <span data-ls-bind="{{session.osName}}"></span> <span data-ls-bind="{{session.osVersion}}"></span>
@ -283,7 +289,7 @@
data-failure-param-alert-text="Logout from All Sessions Failed" data-failure-param-alert-text="Logout from All Sessions Failed"
data-failure-param-alert-classname="error"> data-failure-param-alert-classname="error">
<input type="hidden" name="id" value="0"> <input type="hidden" name="id" value="0">
<button class="danger">Logout from all devices</button> <button class="danger">Logout from all sessions</button>
</form> </form>
</li> </li>
<li data-state="/console/account/activity"> <li data-state="/console/account/activity">

View file

@ -184,11 +184,23 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
<img src="" data-ls-attrs="src=/images/clients/{{platform.type}}.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Platform Logo" class="avatar" loading="lazy" width="60" height="60" /> <img src="" data-ls-attrs="src=/images/clients/{{platform.type}}.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Platform Logo" class="avatar" loading="lazy" width="60" height="60" />
<div data-ls-if="{{platform.type}} === 'flutter-ios'" class="corner"> <div data-ls-if="{{platform.type}} === 'flutter-ios'" class="corner">
<img src="" data-ls-attrs="src=/images/clients/ios.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="iOS Logo" class="avatar xs" loading="lazy" width="30" height="30" /> <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="iOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
</div> </div>
<div data-ls-if="{{platform.type}} === 'flutter-android'" class="corner"> <div data-ls-if="{{platform.type}} === 'flutter-android'" class="corner">
<img src="" data-ls-attrs="src=/images/clients/android.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Android Logo" class="avatar xs" loading="lazy" width="30" height="30" /> <img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Android Logo" class="avatar xs" loading="lazy" width="30" height="30" />
</div>
<div data-ls-if="{{platform.type}} === 'flutter-linux'" class="corner">
<img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Linux Logo" class="avatar xs" loading="lazy" width="30" height="30" />
</div>
<div data-ls-if="{{platform.type}} === 'flutter-macos'" class="corner">
<img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="MacOS Logo" class="avatar xs" loading="lazy" width="30" height="30" />
</div>
<div data-ls-if="{{platform.type}} === 'flutter-windows'" class="corner">
<img src="" data-ls-attrs="src=/images/clients/flutter.png?v=<?php echo APP_CACHE_BUSTER; ?>" alt="Windows Logo" class="avatar xs" loading="lazy" width="30" height="30" />
</div> </div>
</div> </div>
<span class="text-one-liner" data-ls-bind="{{platform.name}}"></span> <span class="text-one-liner" data-ls-bind="{{platform.name}}"></span>
@ -317,7 +329,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
</form> </form>
</script> </script>
<div data-ui-modal class="modal box close" data-button-alias=".flutter-new"> <div data-ui-modal class="modal box close width-large" data-button-alias=".flutter-new">
<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>
<h1 class="margin-bottom-xl">Register your Flutter App</h1> <h1 class="margin-bottom-xl">Register your Flutter App</h1>
@ -387,6 +399,105 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled',true);
<hr /> <hr />
<button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
</form>
</li>
<li>
<h2 style="display: none">&nbsp;&nbsp;Linux&nbsp;&nbsp;</h2>
<form
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Project Platform (Flutter / Linux)"
data-service="projects.createPlatform"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Registered new platform successfully"
data-success-param-trigger-events="projects.createPlatform"
data-failure="alert"
data-failure-param-alert-text="Failed to register platform"
data-failure-param-alert-classname="error">
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
<input type="hidden" name="type" data-ls-bind="flutter-linux" />
<label for="name">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" name="name" required autocomplete="off" placeholder="My Linux App" maxlength="128" />
<label for="key">Package Name <span class="tooltip large" data-tooltip="Your application name"><i class="icon-question"></i></span></label>
<input type="text" class="full-width" name="key" required autocomplete="off" placeholder="appname" />
<hr />
<button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
</form>
</li>
<li>
<h2 style="display: none">&nbsp;&nbsp;MacOS&nbsp;&nbsp;</h2>
<form
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Project Platform (Flutter / Mac OS)"
data-service="projects.createPlatform"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Registered new platform successfully"
data-success-param-trigger-events="projects.createPlatform"
data-failure="alert"
data-failure-param-alert-text="Failed to register platform"
data-failure-param-alert-classname="error">
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
<input type="hidden" name="type" data-ls-bind="flutter-macos" />
<label for="name">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" name="name" required autocomplete="off" placeholder="My Mac OS App" maxlength="128" />
<label for="key">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 type="text" class="full-width" name="key" required autocomplete="off" placeholder="com.company.appname" />
<hr />
<button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
</form>
</li>
<li>
<h2 style="display: none">&nbsp;&nbsp;Windows&nbsp;&nbsp;</h2>
<form
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Project Platform (Flutter / Windows)"
data-service="projects.createPlatform"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Registered new platform successfully"
data-success-param-trigger-events="projects.createPlatform"
data-failure="alert"
data-failure-param-alert-text="Failed to register platform"
data-failure-param-alert-classname="error">
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
<input type="hidden" name="type" data-ls-bind="flutter-windows" />
<label for="name">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" name="name" required autocomplete="off" placeholder="My Windows App" maxlength="128" />
<label for="key">Package Name <span class="tooltip large" data-tooltip="Your application name"><i class="icon-question"></i></span></label>
<input type="text" class="full-width" name="key" required autocomplete="off" placeholder="appname" />
<hr />
<button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button> <button type="submit">Register</button> &nbsp; <button data-ui-modal-close="" type="button" class="reverse">Back</button>
</form> </form>
</li> </li>

View file

@ -134,7 +134,7 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
<input type="hidden" name="fileId" data-ls-bind="{{file.$id}}" /> <input type="hidden" name="fileId" data-ls-bind="{{file.$id}}" />
</form> </form>
</div> </div>
<div class="col span-4"> <div class="col span-4 text-size-small">
<div class="margin-bottom-small">File Preview</div> <div class="margin-bottom-small">File Preview</div>
<div class="margin-bottom-small"> <div class="margin-bottom-small">
@ -145,9 +145,20 @@ $fileLimitHuman = $this->getParam('fileLimitHuman', 0);
<a href="" data-ls-attrs="href={{env.ENDPOINT}}/v1/storage/files/{{file.$id}}/view?project={{router.params.project}}&mode=admin" target="_blank" rel="noopener"><i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> New Window <i class="icon-link-ext"></i></a> <a href="" data-ls-attrs="href={{env.ENDPOINT}}/v1/storage/files/{{file.$id}}/view?project={{router.params.project}}&mode=admin" target="_blank" rel="noopener"><i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> New Window <i class="icon-link-ext"></i></a>
</div> </div>
<div class="margin-bottom"> <div class="margin-bottom-small">
<a href="" data-ls-attrs="href={{env.ENDPOINT}}/v1/storage/files/{{file.$id}}/download?project={{router.params.project}}&mode=admin" target="_blank" rel="noopener"><i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Download <i class="icon-link-ext"></i></a> <a href="" data-ls-attrs="href={{env.ENDPOINT}}/v1/storage/files/{{file.$id}}/download?project={{router.params.project}}&mode=admin" target="_blank" rel="noopener"><i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Download <i class="icon-link-ext"></i></a>
</div> </div>
<div class="margin-bottom-tiny">
<i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Type: <span data-ls-bind="{{file.mimeType}}"></span>
</div>
<div class="margin-bottom-tiny">
<i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Size: <span data-ls-bind="{{file.sizeOriginal|humanFileSize}}"></span>
<span data-ls-bind="{{file.sizeOriginal|humanFileUnit}}"></span>
</div>
<div class="margin-bottom">
<i class="icon-angle-circled-right margin-start-negative-tiny margin-end-tiny"></i> Created at: <span data-ls-bind="{{file.dateCreated|dateText}}"></span>
</div>
</div> </div>
</div> </div>

View file

@ -77,7 +77,8 @@ $auth = $this->getParam('auth', []);
<td data-title="Name: "> <td data-title="Name: ">
<a data-ls-attrs="href=/console/users/user?id={{user.$id}}&project={{router.params.project}}"> <a data-ls-attrs="href=/console/users/user?id={{user.$id}}&project={{router.params.project}}">
<span data-ls-bind="{{user.name}}"></span> <span data-ls-bind="{{user.name}}"></span>
<span data-ls-if="{{user.name|escape}} === ''">-----</span> <span data-ls-if="{{user.name|escape}} === '' && {{user.email}} !== ''">Unknown</span>
<span data-ls-if="{{user.name|escape}} === '' && {{user.email}} === ''">Anonymous User</span>
</a> </a>
</td> </td>
<td data-title="Email: "> <td data-title="Email: ">
@ -479,7 +480,7 @@ $auth = $this->getParam('auth', []);
<button class="switch pull-end" data-ls-ui-trigger="provider-update-<?php echo $this->escape($provider); ?>"></button> <button class="switch pull-end" data-ls-ui-trigger="provider-update-<?php echo $this->escape($provider); ?>"></button>
</span> </span>
<img src="/images/users/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" /> <img src="/images/users/<?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"> <span class="text-size-small">
<?php echo $this->escape($name); ?> <?php if($sandbox): ?><span class="text-size-xs text-fade">sandbox</span><?php endif; ?> <?php if($beta): ?><span class="text-size-xs text-fade">beta</span><?php endif; ?> <?php echo $this->escape($name); ?> <?php if($sandbox): ?><span class="text-size-xs text-fade">sandbox</span><?php endif; ?> <?php if($beta): ?><span class="text-size-xs text-fade">beta</span><?php endif; ?>

View file

@ -12,7 +12,7 @@
<br /> <br />
<span data-ls-bind="{{team.name}}">&nbsp;</span> <span data-ls-bind="{{team.name}}">&nbsp;</span>
<span data-ls-if="{{team.name}} === ''">Unknown</span> <span data-ls-if="{{team.name|escape}} === ''">Unknown</span>
</h1> </h1>
</div> </div>

View file

@ -12,7 +12,8 @@
<br /> <br />
<span data-ls-bind="{{user.name}}">&nbsp;</span> <span data-ls-bind="{{user.name}}">&nbsp;</span>
<span data-ls-if="{{user.name}} === ''">Unknown</span> <span data-ls-if="{{user.name|escape}} === '' && {{user.email}} !== ''">Unknown</span>
<span data-ls-if="{{user.name|escape}} === '' && {{user.email}} === ''">Anonymous User</span>
</h1> </h1>
</div> </div>
@ -96,7 +97,7 @@
<h3 class="text-danger">Danger Zone</h3> <h3 class="text-danger">Danger Zone</h3>
<div class="box danger"> <div class="box danger margin-bottom">
<p>This is the area where you can delete this user.</p> <p>This is the area where you can delete this user.</p>
<p>By deleting this user you will lose all data associated with this user.</p> <p>By deleting this user you will lose all data associated with this user.</p>
@ -109,7 +110,7 @@
data-analytics-event="submit" data-analytics-event="submit"
data-analytics-category="console" data-analytics-category="console"
data-analytics-label="Delete User" data-analytics-label="Delete User"
data-service="users.deleteUser" data-service="users.delete"
data-event="submit" data-event="submit"
data-param-user-id="{{router.params.id}}" data-param-user-id="{{router.params.id}}"
data-success="alert,trigger,redirect" data-success="alert,trigger,redirect"
@ -180,8 +181,8 @@
</div> </div>
</div> </div>
</li> </li>
<li data-state="/console/users/user/devices?id={{router.params.id}}&project={{router.params.project}}"> <li data-state="/console/users/user/sessions?id={{router.params.id}}&project={{router.params.project}}">
<h2>Devices</h2> <h2>Sessions</h2>
<div <div
data-service="users.getSessions" data-service="users.getSessions"
@ -216,13 +217,18 @@
<input type="hidden" name="sessionId" data-ls-bind="{{session.$id}}"> <input type="hidden" name="sessionId" data-ls-bind="{{session.$id}}">
<button class="danger">Logout</button> <button class="danger">Logout</button>
</form> </form>
<div class="pull-start margin-end avatar-container">
<img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{session.clientCode|lowercase}}?width=120&height=120&project={{env.PROJECT}},title={{session.clientName}},alt={{session.clientName}}" class="avatar trans pull-start margin-end" /> <img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-attrs="src={{env.API}}/avatars/browsers/{{session.clientCode|lowercase}}?width=120&height=120&project={{env.PROJECT}},title={{session.clientName}},alt={{session.clientName}}" class="avatar" loading="lazy" width="60" height="60" />
<div data-ls-if="{{session.provider}} !== 'email'" class="corner">
<img data-ls-attrs="src=/images/users/{{session.provider}}.png?buster=<?php echo APP_CACHE_BUSTER; ?>,title={{session.provider}},alt={{session.provider}}" class="avatar xs" loading="lazy" width="30" height="30" />
</div>
</div>
<span data-ls-bind="{{session.clientName}}"></span> <span data-ls-bind="{{session.clientVersion}}"></span> on <span data-ls-bind="{{session.deviceModel}}"></span> <span data-ls-bind="{{session.osName}}"></span> <span data-ls-bind="{{session.osVersion}}"></span> <span data-ls-bind="{{session.clientName}}"></span> <span data-ls-bind="{{session.clientVersion}}"></span> on <span data-ls-bind="{{session.deviceModel}}"></span> <span data-ls-bind="{{session.osName}}"></span> <span data-ls-bind="{{session.osVersion}}"></span>
<div class="margin-top-small"> <div class="margin-top-small">
<img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-if="{{session.countryCode}} !== '--'" data-ls-attrs="src={{env.API}}/avatars/flags/{{session.countryCode}}?width=80&height=80&project={{env.PROJECT}}" class="avatar xxs margin-end-small inline" /> <img onerror="this.onerror=null;this.src='/images/unknown.svg'" data-ls-if="{{session.countryCode}} !== '--'" data-ls-attrs="src={{env.API}}/avatars/flags/{{session.countryCode}}?width=120&height=120&project={{env.PROJECT}}" class="avatar xxs margin-end-small inline" />
<small data-ls-bind="{{session.ip}}"></small> / <small data-ls-bind="{{session.countryName}}"></small> <small data-ls-bind="{{session.ip}}"></small> / <small data-ls-bind="{{session.countryName}}"></small>
</div> </div>
</li> </li>
@ -244,7 +250,7 @@
data-failure-param-alert-text="Failed to logout all sessions" data-failure-param-alert-text="Failed to logout all sessions"
data-failure-param-alert-classname="error"> data-failure-param-alert-classname="error">
<button class="danger">Logout from all devices</button> <button class="danger">Logout from all sessions</button>
</form> </form>
</div> </div>
</div> </div>
@ -259,11 +265,11 @@
data-param-user-id="{{router.params.id}}" data-param-user-id="{{router.params.id}}"
data-event="load,logs-load"> data-event="load,logs-load">
<div data-ls-if="{{logs.length}} === 0" style="display: none" class="margin-top-xxl margin-bottom-xxl text-align-center"> <div data-ls-if="{{logs.logs.length}} === 0" style="display: none" class="margin-top-xxl margin-bottom-xxl text-align-center">
No logs available. No logs available.
</div> </div>
<div class="box" data-ls-if="{{logs.length}} !== 0" style="display: none"> <div class="box" data-ls-if="{{logs.logs.length}} !== 0" style="display: none">
<table class="vertical small"> <table class="vertical small">
<thead> <thead>
<tr> <tr>

View file

@ -9,7 +9,7 @@
data-scope="console" data-scope="console"
data-event="submit" data-event="submit"
data-param-team-id="{{router.params.teamId}}" data-param-team-id="{{router.params.teamId}}"
data-param-invite-id="{{router.params.membershipId}}" data-param-membership-id="{{router.params.membershipId}}"
data-param-user-id="{{router.params.userId}}" data-param-user-id="{{router.params.userId}}"
data-param-secret="{{router.params.secret}}" data-param-secret="{{router.params.secret}}"
data-success="redirect,alert,trigger" data-success="redirect,alert,trigger"

View file

@ -31,8 +31,8 @@ class DeletesV1
} }
public function perform() public function perform()
{ {
$projectId = $this->args['projectId']; $projectId = isset($this->args['projectId']) ? $this->args['projectId'] : '';
$type = $this->args['type']; $type = $this->args['type'];
switch (strval($type)) { switch (strval($type)) {
@ -127,11 +127,22 @@ class DeletesV1
} }
} }
// Delete Memberships // Delete Memberships and decrement team membership counts
$this->deleteByGroup([ $this->deleteByGroup([
'$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS, '$collection='.Database::SYSTEM_COLLECTION_MEMBERSHIPS,
'userId='.$document->getId(), 'userId='.$document->getId(),
], $this->getProjectDB($projectId)); ], $this->getProjectDB($projectId), function(Document $document) use ($projectId) {
if ($document->getAttribute('confirm')) { // Count only confirmed members
$teamId = $document->getAttribute('teamId');
$team = $this->getProjectDB($projectId)->getDocument($teamId);
if(!$team->isEmpty()) {
$team = $this->getProjectDB($projectId)->updateDocument(\array_merge($team->getArrayCopy(), [
'sum' => \max($team->getAttribute('sum', 0) - 1, 0), // Ensure that sum >= 0
]));
}
}
});
} }
protected function deleteExecutionLogs($timestamp) protected function deleteExecutionLogs($timestamp)

View file

@ -62,7 +62,7 @@
"slickdeals/statsd": "3.0.2" "slickdeals/statsd": "3.0.2"
}, },
"require-dev": { "require-dev": {
"appwrite/sdk-generator": "0.10.3", "appwrite/sdk-generator": "0.10.6",
"swoole/ide-helper": "4.6.6", "swoole/ide-helper": "4.6.6",
"phpunit/phpunit": "9.5.4", "phpunit/phpunit": "9.5.4",
"vimeo/psalm": "4.7.2" "vimeo/psalm": "4.7.2"

52
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c569da48f33b0ae0f5cf529f2e00a447", "content-hash": "e433ce62dd355a107816e8967d5c769d",
"packages": [ "packages": [
{ {
"name": "adhocore/jwt", "name": "adhocore/jwt",
@ -1693,16 +1693,16 @@
}, },
{ {
"name": "utopia-php/framework", "name": "utopia-php/framework",
"version": "0.14.0", "version": "0.14.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/utopia-php/framework.git", "url": "https://github.com/utopia-php/framework.git",
"reference": "92d4a36f3b0e22393a31877c5317c96e01760339" "reference": "632113288bebe41cbef79f0d355bd91609767b8c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/92d4a36f3b0e22393a31877c5317c96e01760339", "url": "https://api.github.com/repos/utopia-php/framework/zipball/632113288bebe41cbef79f0d355bd91609767b8c",
"reference": "92d4a36f3b0e22393a31877c5317c96e01760339", "reference": "632113288bebe41cbef79f0d355bd91609767b8c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1736,9 +1736,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/utopia-php/framework/issues", "issues": "https://github.com/utopia-php/framework/issues",
"source": "https://github.com/utopia-php/framework/tree/0.14.0" "source": "https://github.com/utopia-php/framework/tree/0.14.1"
}, },
"time": "2021-04-15T21:01:44+00:00" "time": "2021-05-21T06:41:45+00:00"
}, },
{ {
"name": "utopia-php/image", "name": "utopia-php/image",
@ -2340,16 +2340,16 @@
}, },
{ {
"name": "appwrite/sdk-generator", "name": "appwrite/sdk-generator",
"version": "0.10.3", "version": "0.10.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/appwrite/sdk-generator.git", "url": "https://github.com/appwrite/sdk-generator.git",
"reference": "3c3cc58fa6949d889158e64a41229b7bfa2d3411" "reference": "ab4adb0b9126c617e11c8fdf4352c8aa9a715ecc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3c3cc58fa6949d889158e64a41229b7bfa2d3411", "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ab4adb0b9126c617e11c8fdf4352c8aa9a715ecc",
"reference": "3c3cc58fa6949d889158e64a41229b7bfa2d3411", "reference": "ab4adb0b9126c617e11c8fdf4352c8aa9a715ecc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2383,22 +2383,22 @@
"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",
"support": { "support": {
"issues": "https://github.com/appwrite/sdk-generator/issues", "issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.10.3" "source": "https://github.com/appwrite/sdk-generator/tree/0.10.6"
}, },
"time": "2021-05-20T08:43:46+00:00" "time": "2021-05-24T14:32:40+00:00"
}, },
{ {
"name": "composer/package-versions-deprecated", "name": "composer/package-versions-deprecated",
"version": "1.11.99.1", "version": "1.11.99.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/package-versions-deprecated.git", "url": "https://github.com/composer/package-versions-deprecated.git",
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" "reference": "c6522afe5540d5fc46675043d3ed5a45a740b27c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/c6522afe5540d5fc46675043d3ed5a45a740b27c",
"reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", "reference": "c6522afe5540d5fc46675043d3ed5a45a740b27c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2442,7 +2442,7 @@
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"support": { "support": {
"issues": "https://github.com/composer/package-versions-deprecated/issues", "issues": "https://github.com/composer/package-versions-deprecated/issues",
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.2"
}, },
"funding": [ "funding": [
{ {
@ -2458,20 +2458,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-11-11T10:22:58+00:00" "time": "2021-05-24T07:46:03+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
"version": "3.2.4", "version": "3.2.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/semver.git", "url": "https://github.com/composer/semver.git",
"reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9",
"reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2523,7 +2523,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues", "issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.2.4" "source": "https://github.com/composer/semver/tree/3.2.5"
}, },
"funding": [ "funding": [
{ {
@ -2539,7 +2539,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-11-13T08:59:24+00:00" "time": "2021-05-24T12:41:47+00:00"
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
@ -5958,4 +5958,4 @@
"php": "8.0" "php": "8.0"
}, },
"plugin-api-version": "2.0.0" "plugin-api-version": "2.0.0"
} }

View file

@ -0,0 +1 @@
Update the user email verification status by its unique ID.

View file

@ -1,3 +1,7 @@
## 0.6.1
- Fix for image preview param types
## 0.6.0 ## 0.6.0
- Upgraded to Null-safety, minimum Dart SDK required 2.12.0 - Upgraded to Null-safety, minimum Dart SDK required 2.12.0

View file

@ -1,3 +1,11 @@
## 0.6.2
- Fixed deployment bug
## 0.6.1
- Fix for image preview param types
## 0.6.0 ## 0.6.0
- Upgraded to Null-safety, minimum Dart SDK required 2.12.0 - Upgraded to Null-safety, minimum Dart SDK required 2.12.0

View file

@ -10,12 +10,11 @@ Initialize your SDK code with your project ID which can be found in your project
```js ```js
// Init your Web SDK // Init your Web SDK
const appwrite = new Appwrite(); const sdk = new Appwrite();
appwrite sdk
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint .setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') // Your project ID .setProject('455x34dfkj') // Your project ID
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
; ;
``` ```
@ -24,35 +23,32 @@ Once your SDK object is set, access any of the Appwrite services and choose any
```js ```js
// Register User // Register User
appwrite sdk.account.create('me@example.com', 'password', 'Jane Doe')
.account.create('me@example.com', 'password', 'Jane Doe') .then(function (response) {
.then(function (response) { console.log(response);
console.log(response); }, function (error) {
}, function (error) { console.log(error);
console.log(error); });
});
``` ```
### Full Example ### Full Example
```js ```js
// Init your Web SDK // Init your Web SDK
const appwrite = new Appwrite(); const sdk = new Appwrite();
appwrite sdk
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint .setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') .setProject('455x34dfkj')
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
; ;
// Register User // Register User
appwrite sdk.account.create('me@example.com', 'password', 'Jane Doe')
.account.create('me@example.com', 'password', 'Jane Doe') .then(function (response) {
.then(function (response) { console.log(response);
console.log(response); }, function (error) {
}, function (error) { console.log(error);
console.log(error); });
});
``` ```
### Learn more ### Learn more

View file

@ -25,7 +25,7 @@ Make sure to fill all data needed and that your provider array key name:
### Add Provider Logo ### Add Provider Logo
Add a logo image to your new provider in this path: `./public/images/oauth2`. Your logo should be a png 100×100px file with the name of your provider (all lowercase). Please make sure to leave about 30px padding around the logo to be consistent with other logos. Add a logo image to your new provider in this path: `./public/images/users`. Your logo should be a png 100×100px file with the name of your provider (all lowercase). Please make sure to leave about 30px padding around the logo to be consistent with other logos.
### Add Provider Class ### Add Provider Class

17
package-lock.json generated
View file

@ -1563,6 +1563,7 @@
"yallist" "yallist"
], ],
"dev": true, "dev": true,
"hasInstallScript": true,
"optional": true, "optional": true,
"os": [ "os": [
"darwin" "darwin"
@ -1806,6 +1807,16 @@
"license": "ISC", "license": "ISC",
"optional": true "optional": true
}, },
"node_modules/fsevents/node_modules/ini": {
"version": "1.3.5",
"dev": true,
"inBundle": true,
"license": "ISC",
"optional": true,
"engines": {
"node": "*"
}
},
"node_modules/fsevents/node_modules/is-fullwidth-code-point": { "node_modules/fsevents/node_modules/is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"dev": true, "dev": true,
@ -7028,6 +7039,12 @@
"dev": true, "dev": true,
"optional": true "optional": true
}, },
"ini": {
"version": "1.3.5",
"bundled": true,
"dev": true,
"optional": true
},
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,

File diff suppressed because one or more lines are too long

View file

@ -1,463 +1,461 @@
(function(window){'use strict';window.Appwrite=function(){let config={endpoint:'https://appwrite.io/v1',project:'',key:'',locale:'',mode:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this;};let setProject=function(value) var Appwrite=(function(exports,isomorphicFormData,crossFetch){'use strict';function __awaiter(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}
{http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this;};let setKey=function(value) return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}
{http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this;};let setLocale=function(value) function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}
{http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this;};let setMode=function(value) function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected);}
{http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this;};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&amp;|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href;};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;index<params[p].length;index++){let param=params[p][index];str.push(encodeURIComponent(p+'[]')+"="+encodeURIComponent(param));}} step((generator=generator.apply(thisArg,_arguments||[])).next());});}
else{str.push(encodeURIComponent(p)+"="+encodeURIComponent(params[p]));}} class AppwriteException extends Error{constructor(message,code=0,response=''){super(message);this.name='AppwriteException';this.message=message;this.code=code;this.response=response;}}
return str.join("&");};let addGlobalHeader=function(key,value){globalHeaders[key]={key:key.toLowerCase(),value:value.toLowerCase()};};let addGlobalParam=function(key,value){globalParams.push({key:key,value:value});};addGlobalHeader('x-sdk-version','appwrite:web:1.0.0');addGlobalHeader('content-type','');let call=function(method,path,headers={},params={},progress=null){let i;path=config.endpoint+path;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name');} class Appwrite{constructor(){this.config={endpoint:'https://appwrite.io/v1',project:'',key:'',jwt:'',locale:'',mode:'',};this.headers={'x-sdk-version':'appwrite:web:2.0.0','X-Appwrite-Response-Format':'0.8.0',};this.account={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(email,password,name='')=>__awaiter(this,void 0,void 0,function*(){if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
if(typeof path!=='string'){throw new Error('var path must be of type string');} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
if(typeof headers!=='object'){throw new Error('var headers must be of type object');} let path='/account';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
for(i=0;i<globalParams.length;i++){path=addParam(path,globalParams[i].key,globalParams[i].value);} if(typeof password!=='undefined'){payload['password']=password;}
if(window.localStorage&&window.localStorage.getItem('cookieFallback')){headers['X-Fallback-Cookies']=window.localStorage.getItem('cookieFallback');} if(typeof name!=='undefined'){payload['name']=name;}
for(let key in globalHeaders){if(globalHeaders.hasOwnProperty(key)){if(!headers[globalHeaders[key].key]){headers[globalHeaders[key].key]=globalHeaders[key].value;}}} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),delete:()=>__awaiter(this,void 0,void 0,function*(){let path='/account';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateEmail:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
if(method==='GET'){for(let param in params){if(param.hasOwnProperty(key)){path=addParam(path,key+(Array.isArray(param)?'[]':''),params[key]);}}} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
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;} let path='/account/email';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
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;} if(typeof password!=='undefined'){payload['password']=password;}
request.setRequestHeader(key,headers[key]);}} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createJWT:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/jwt';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getLogs:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/logs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateName:(name)=>__awaiter(this,void 0,void 0,function*(){if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
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 path='/account/name';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
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);} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updatePassword:(password,oldPassword='')=>__awaiter(this,void 0,void 0,function*(){if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
if(4===request.readyState&&399>=request.status){resolve(data);}else{reject(data);}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);} let path='/account/password';let payload={};if(typeof password!=='undefined'){payload['password']=password;}
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(typeof oldPassword!=='undefined'){payload['oldPassword']=oldPassword;}
if(password===undefined){throw new Error('Missing required parameter: "password"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getPrefs:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/prefs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(prefs)=>__awaiter(this,void 0,void 0,function*(){if(prefs===undefined){throw new AppwriteException('Missing required parameter: "prefs"');}
let path='/account';let payload={};if(email){payload['email']=email;} let path='/account/prefs';let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;}
if(password){payload['password']=password;} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),createRecovery:(email,url)=>__awaiter(this,void 0,void 0,function*(){if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
if(name){payload['name']=name;} if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
return http.post(path,{'content-type':'application/json',},payload);},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"');} let path='/account/recovery';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
if(password===undefined){throw new Error('Missing required parameter: "password"');} if(typeof url!=='undefined'){payload['url']=url;}
let path='/account/email';let payload={};if(email){payload['email']=email;} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateRecovery:(userId,secret,password,passwordAgain)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(password){payload['password']=password;} if(secret===undefined){throw new AppwriteException('Missing required parameter: "secret"');}
return http.patch(path,{'content-type':'application/json',},payload);},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"');} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
let path='/account/name';let payload={};if(name){payload['name']=name;} if(passwordAgain===undefined){throw new AppwriteException('Missing required parameter: "passwordAgain"');}
return http.patch(path,{'content-type':'application/json',},payload);},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"');} let path='/account/recovery';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"');} if(typeof secret!=='undefined'){payload['secret']=secret;}
let path='/account/password';let payload={};if(password){payload['password']=password;} if(typeof password!=='undefined'){payload['password']=password;}
if(oldPassword){payload['oldPassword']=oldPassword;} if(typeof passwordAgain!=='undefined'){payload['passwordAgain']=passwordAgain;}
return http.patch(path,{'content-type':'application/json',},payload);},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),getSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createSession:(email,password)=>__awaiter(this,void 0,void 0,function*(){if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
let path='/account/prefs';let payload={};if(prefs){payload['prefs']=prefs;} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
return http.patch(path,{'content-type':'application/json',},payload);},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"');} let path='/account/sessions';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
if(url===undefined){throw new Error('Missing required parameter: "url"');} if(typeof password!=='undefined'){payload['password']=password;}
let path='/account/recovery';let payload={};if(email){payload['email']=email;} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),deleteSessions:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createAnonymousSession:()=>__awaiter(this,void 0,void 0,function*(){let path='/account/sessions/anonymous';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),createOAuth2Session:(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[])=>{if(provider===undefined){throw new AppwriteException('Missing required parameter: "provider"');}
if(url){payload['url']=url;} let path='/account/sessions/oauth2/{provider}'.replace('{provider}',provider);let payload={};if(success){payload['success']=success;}
return http.post(path,{'content-type':'application/json',},payload);},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
if(secret===undefined){throw new Error('Missing required parameter: "secret"');}
if(password===undefined){throw new Error('Missing required parameter: "password"');}
if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"');}
let path='/account/recovery';let payload={};if(userId){payload['userId']=userId;}
if(secret){payload['secret']=secret;}
if(password){payload['password']=password;}
if(passwordAgain){payload['passwordAgain']=passwordAgain;}
return http.put(path,{'content-type':'application/json',},payload);},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"');}
if(password===undefined){throw new Error('Missing required parameter: "password"');}
let path='/account/sessions';let payload={};if(email){payload['email']=email;}
if(password){payload['password']=password;}
return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuth2Session:function(provider,success='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;}
if(failure){payload['failure']=failure;} if(failure){payload['failure']=failure;}
if(scopes){payload['scopes']=scopes;} 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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} if(typeof window!=='undefined'&&(window===null||window===void 0?void 0:window.location)){window.location.href=uri.toString();}
query=query.join("&");window.location=config.endpoint+path+((query)?'?'+query:'');},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');} else{return uri;}},deleteSession:(sessionId)=>__awaiter(this,void 0,void 0,function*(){if(sessionId===undefined){throw new AppwriteException('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('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),createVerification:(url)=>__awaiter(this,void 0,void 0,function*(){if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
let path='/account/verification';let payload={};if(url){payload['url']=url;} let path='/account/verification';let payload={};if(typeof url!=='undefined'){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"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateVerification:(userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(secret===undefined){throw new Error('Missing required parameter: "secret"');} if(secret===undefined){throw new AppwriteException('Missing required parameter: "secret"');}
let path='/account/verification';let payload={};if(userId){payload['userId']=userId;} let path='/account/verification';let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
if(secret){payload['secret']=secret;} if(typeof secret!=='undefined'){payload['secret']=secret;}
return http.put(path,{'content-type':'application/json',},payload);}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);})};this.avatars={getBrowser:(code,width=100,height=100,quality=100)=>{if(code===undefined){throw new AppwriteException('Missing required parameter: "code"');}
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;} let path='/avatars/browsers/{code}'.replace('{code}',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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getCreditCard:(code,width=100,height=100,quality=100)=>{if(code===undefined){throw new AppwriteException('Missing required parameter: "code"');}
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('{code}',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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getFavicon:(url)=>{if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getFlag:(code,width=100,height=100,quality=100)=>{if(code===undefined){throw new AppwriteException('Missing required parameter: "code"');}
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('{code}',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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getImage:(url,width=400,height=400)=>{if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getInitials:(name='',width=500,height=500,color='',background='')=>{let path='/avatars/initials';let payload={};if(name){payload['name']=name;}
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(width){payload['width']=width;}
if(height){payload['height']=height;} if(height){payload['height']=height;}
if(color){payload['color']=color;} if(color){payload['color']=color;}
if(background){payload['background']=background;} 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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getQR:(text,size=400,margin=1,download=false)=>{if(text===undefined){throw new AppwriteException('Missing required parameter: "text"');}
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getQR:function(text,size=400,margin=1,download=false){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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;}};this.database={listCollections:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){let path='/database/collections';let payload={};if(search){payload['search']=search;}
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;}
return http.get(path,{'content-type':'application/json',},payload);},createCollection:function(name,read,write,rules){if(name===undefined){throw new Error('Missing required parameter: "name"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createCollection:(name,read,write,rules)=>__awaiter(this,void 0,void 0,function*(){if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(read===undefined){throw new Error('Missing required parameter: "read"');} if(read===undefined){throw new AppwriteException('Missing required parameter: "read"');}
if(write===undefined){throw new Error('Missing required parameter: "write"');} if(write===undefined){throw new AppwriteException('Missing required parameter: "write"');}
if(rules===undefined){throw new Error('Missing required parameter: "rules"');} if(rules===undefined){throw new AppwriteException('Missing required parameter: "rules"');}
let path='/database/collections';let payload={};if(name){payload['name']=name;} let path='/database/collections';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(read){payload['read']=read;} if(typeof read!=='undefined'){payload['read']=read;}
if(write){payload['write']=write;} if(typeof write!=='undefined'){payload['write']=write;}
if(rules){payload['rules']=rules;} if(typeof rules!=='undefined'){payload['rules']=rules;}
return http.post(path,{'content-type':'application/json',},payload);},getCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getCollection:(collectionId)=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateCollection:function(collectionId,name,read,write,rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} let path='/database/collections/{collectionId}'.replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateCollection:(collectionId,name,read=[],write=[],rules=[])=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(read===undefined){throw new Error('Missing required parameter: "read"');} let path='/database/collections/{collectionId}'.replace('{collectionId}',collectionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(write===undefined){throw new Error('Missing required parameter: "write"');} if(typeof read!=='undefined'){payload['read']=read;}
let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(name){payload['name']=name;} if(typeof write!=='undefined'){payload['write']=write;}
if(read){payload['read']=read;} if(typeof rules!=='undefined'){payload['rules']=rules;}
if(write){payload['write']=write;} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteCollection:(collectionId)=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(rules){payload['rules']=rules;} let path='/database/collections/{collectionId}'.replace('{collectionId}',collectionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listDocuments:(collectionId,filters=[],limit=25,offset=0,orderField='',orderType='ASC',orderCast='string',search='')=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
return http.put(path,{'content-type':'application/json',},payload);},deleteCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} let path='/database/collections/{collectionId}/documents'.replace('{collectionId}',collectionId);let payload={};if(filters){payload['filters']=filters;}
let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listDocuments:function(collectionId,filters=[],limit=25,offset=0,orderField='',orderType='ASC',orderCast='string',search=''){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;}
if(limit){payload['limit']=limit;} if(limit){payload['limit']=limit;}
if(offset){payload['offset']=offset;} if(offset){payload['offset']=offset;}
if(orderField){payload['orderField']=orderField;} if(orderField){payload['orderField']=orderField;}
if(orderType){payload['orderType']=orderType;} if(orderType){payload['orderType']=orderType;}
if(orderCast){payload['orderCast']=orderCast;} if(orderCast){payload['orderCast']=orderCast;}
if(search){payload['search']=search;} if(search){payload['search']=search;}
return http.get(path,{'content-type':'application/json',},payload);},createDocument:function(collectionId,data,read,write,parentDocument='',parentProperty='',parentPropertyType='assign'){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDocument:(collectionId,data,read=[],write=[],parentDocument='',parentProperty='',parentPropertyType='assign')=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(data===undefined){throw new Error('Missing required parameter: "data"');} if(data===undefined){throw new AppwriteException('Missing required parameter: "data"');}
if(read===undefined){throw new Error('Missing required parameter: "read"');} let path='/database/collections/{collectionId}/documents'.replace('{collectionId}',collectionId);let payload={};if(typeof data!=='undefined'){payload['data']=data;}
if(write===undefined){throw new Error('Missing required parameter: "write"');} if(typeof read!=='undefined'){payload['read']=read;}
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(data){payload['data']=data;} if(typeof write!=='undefined'){payload['write']=write;}
if(read){payload['read']=read;} if(typeof parentDocument!=='undefined'){payload['parentDocument']=parentDocument;}
if(write){payload['write']=write;} if(typeof parentProperty!=='undefined'){payload['parentProperty']=parentProperty;}
if(parentDocument){payload['parentDocument']=parentDocument;} if(typeof parentPropertyType!=='undefined'){payload['parentPropertyType']=parentPropertyType;}
if(parentProperty){payload['parentProperty']=parentProperty;} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDocument:(collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(parentPropertyType){payload['parentPropertyType']=parentPropertyType;} if(documentId===undefined){throw new AppwriteException('Missing required parameter: "documentId"');}
return http.post(path,{'content-type':'application/json',},payload);},getDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} let path='/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateDocument:(collectionId,documentId,data,read=[],write=[])=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('Missing required parameter: "collectionId"');}
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');} if(documentId===undefined){throw new AppwriteException('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.get(path,{'content-type':'application/json',},payload);},updateDocument:function(collectionId,documentId,data,read,write){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(data===undefined){throw new AppwriteException('Missing required parameter: "data"');}
if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');} let path='/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};if(typeof data!=='undefined'){payload['data']=data;}
if(data===undefined){throw new Error('Missing required parameter: "data"');} if(typeof read!=='undefined'){payload['read']=read;}
if(read===undefined){throw new Error('Missing required parameter: "read"');} if(typeof write!=='undefined'){payload['write']=write;}
if(write===undefined){throw new Error('Missing required parameter: "write"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteDocument:(collectionId,documentId)=>__awaiter(this,void 0,void 0,function*(){if(collectionId===undefined){throw new AppwriteException('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={};if(data){payload['data']=data;} if(documentId===undefined){throw new AppwriteException('Missing required parameter: "documentId"');}
if(read){payload['read']=read;} let path='/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}',collectionId).replace('{documentId}',documentId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);})};this.functions={list:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){let path='/functions';let payload={};if(search){payload['search']=search;}
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"');}
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 functions={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/functions';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;}
return http.get(path,{'content-type':'application/json',},payload);},create:function(name,execute,env,vars={},events=[],schedule='',timeout=15){if(name===undefined){throw new Error('Missing required parameter: "name"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(name,execute,env,vars={},events=[],schedule='',timeout=15)=>__awaiter(this,void 0,void 0,function*(){if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(execute===undefined){throw new Error('Missing required parameter: "execute"');} if(execute===undefined){throw new AppwriteException('Missing required parameter: "execute"');}
if(env===undefined){throw new Error('Missing required parameter: "env"');} if(env===undefined){throw new AppwriteException('Missing required parameter: "env"');}
let path='/functions';let payload={};if(name){payload['name']=name;} let path='/functions';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(execute){payload['execute']=execute;} if(typeof execute!=='undefined'){payload['execute']=execute;}
if(env){payload['env']=env;} if(typeof env!=='undefined'){payload['env']=env;}
if(vars){payload['vars']=vars;} if(typeof vars!=='undefined'){payload['vars']=vars;}
if(events){payload['events']=events;} if(typeof events!=='undefined'){payload['events']=events;}
if(schedule){payload['schedule']=schedule;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(timeout){payload['timeout']=timeout;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
return http.post(path,{'content-type':'application/json',},payload);},get:function(functionId){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace(new RegExp('{functionId}','g'),functionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(functionId,name,execute,vars={},events=[],schedule='',timeout=15){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(functionId,name,execute,vars={},events=[],schedule='',timeout=15)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(execute===undefined){throw new Error('Missing required parameter: "execute"');} if(execute===undefined){throw new AppwriteException('Missing required parameter: "execute"');}
let path='/functions/{functionId}'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(name){payload['name']=name;} let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(execute){payload['execute']=execute;} if(typeof execute!=='undefined'){payload['execute']=execute;}
if(vars){payload['vars']=vars;} if(typeof vars!=='undefined'){payload['vars']=vars;}
if(events){payload['events']=events;} if(typeof events!=='undefined'){payload['events']=events;}
if(schedule){payload['schedule']=schedule;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(timeout){payload['timeout']=timeout;} if(typeof timeout!=='undefined'){payload['timeout']=timeout;}
return http.put(path,{'content-type':'application/json',},payload);},delete:function(functionId){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(functionId)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}'.replace(new RegExp('{functionId}','g'),functionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listExecutions:function(functionId,search='',limit=25,offset=0,orderType='ASC'){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} let path='/functions/{functionId}'.replace('{functionId}',functionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listExecutions:(functionId,search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/executions'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(search){payload['search']=search;} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);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;}
return http.get(path,{'content-type':'application/json',},payload);},createExecution:function(functionId,data){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createExecution:(functionId,data='')=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/executions'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(data){payload['data']=data;} let path='/functions/{functionId}/executions'.replace('{functionId}',functionId);let payload={};if(typeof data!=='undefined'){payload['data']=data;}
return http.post(path,{'content-type':'application/json',},payload);},getExecution:function(functionId,executionId){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getExecution:(functionId,executionId)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(executionId===undefined){throw new Error('Missing required parameter: "executionId"');} if(executionId===undefined){throw new AppwriteException('Missing required parameter: "executionId"');}
let path='/functions/{functionId}/executions/{executionId}'.replace(new RegExp('{functionId}','g'),functionId).replace(new RegExp('{executionId}','g'),executionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateTag:function(functionId,tag){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} let path='/functions/{functionId}/executions/{executionId}'.replace('{functionId}',functionId).replace('{executionId}',executionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateTag:(functionId,tag)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(tag===undefined){throw new Error('Missing required parameter: "tag"');} if(tag===undefined){throw new AppwriteException('Missing required parameter: "tag"');}
let path='/functions/{functionId}/tag'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(tag){payload['tag']=tag;} let path='/functions/{functionId}/tag'.replace('{functionId}',functionId);let payload={};if(typeof tag!=='undefined'){payload['tag']=tag;}
return http.patch(path,{'content-type':'application/json',},payload);},listTags:function(functionId,search='',limit=25,offset=0,orderType='ASC'){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listTags:(functionId,search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/tags'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(search){payload['search']=search;} let path='/functions/{functionId}/tags'.replace('{functionId}',functionId);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;}
return http.get(path,{'content-type':'application/json',},payload);},createTag:function(functionId,command,code){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createTag:(functionId,command,code)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(command===undefined){throw new Error('Missing required parameter: "command"');} if(command===undefined){throw new AppwriteException('Missing required parameter: "command"');}
if(code===undefined){throw new Error('Missing required parameter: "code"');} if(code===undefined){throw new AppwriteException('Missing required parameter: "code"');}
let path='/functions/{functionId}/tags'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(command){payload['command']=command;} let path='/functions/{functionId}/tags'.replace('{functionId}',functionId);let payload={};if(typeof command!=='undefined'){payload['command']=command;}
if(code){payload['code']=code;} if(typeof code!=='undefined'){payload['code']=code;}
return http.post(path,{'content-type':'multipart/form-data',},payload);},getTag:function(functionId,tagId){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);}),getTag:(functionId,tagId)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(tagId===undefined){throw new Error('Missing required parameter: "tagId"');} if(tagId===undefined){throw new AppwriteException('Missing required parameter: "tagId"');}
let path='/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}','g'),functionId).replace(new RegExp('{tagId}','g'),tagId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},deleteTag:function(functionId,tagId){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} let path='/functions/{functionId}/tags/{tagId}'.replace('{functionId}',functionId).replace('{tagId}',tagId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteTag:(functionId,tagId)=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
if(tagId===undefined){throw new Error('Missing required parameter: "tagId"');} if(tagId===undefined){throw new AppwriteException('Missing required parameter: "tagId"');}
let path='/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}','g'),functionId).replace(new RegExp('{tagId}','g'),tagId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getUsage:function(functionId,range='30d'){if(functionId===undefined){throw new Error('Missing required parameter: "functionId"');} let path='/functions/{functionId}/tags/{tagId}'.replace('{functionId}',functionId).replace('{tagId}',tagId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getUsage:(functionId,range='30d')=>__awaiter(this,void 0,void 0,function*(){if(functionId===undefined){throw new AppwriteException('Missing required parameter: "functionId"');}
let path='/functions/{functionId}/usage'.replace(new RegExp('{functionId}','g'),functionId);let payload={};if(range){payload['range']=range;} let path='/functions/{functionId}/usage'.replace('{functionId}',functionId);let payload={};if(range){payload['range']=range;}
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(search='',limit=25,offset=0,orderType='ASC'){let path='/projects';let payload={};if(search){payload['search']=search;} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.health={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/health';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getAntiVirus:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/anti-virus';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCache:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/cache';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getDB:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/db';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueCertificates:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/certificates';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueFunctions:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/functions';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueLogs:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/logs';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueTasks:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/tasks';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueUsage:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/usage';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getQueueWebhooks:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/queue/webhooks';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getStorageLocal:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/storage/local';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getTime:()=>__awaiter(this,void 0,void 0,function*(){let path='/health/time';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.locale={get:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getContinents:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/continents';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountries:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesEU:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/eu';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCountriesPhones:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/countries/phones';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getCurrencies:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/currencies';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getLanguages:()=>__awaiter(this,void 0,void 0,function*(){let path='/locale/languages';let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);})};this.projects={list:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){let path='/projects';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;}
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"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId='')=>__awaiter(this,void 0,void 0,function*(){if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/projects';let payload={};if(name){payload['name']=name;} let path='/projects';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(teamId){payload['teamId']=teamId;} if(typeof teamId!=='undefined'){payload['teamId']=teamId;}
if(description){payload['description']=description;} if(typeof description!=='undefined'){payload['description']=description;}
if(logo){payload['logo']=logo;} if(typeof logo!=='undefined'){payload['logo']=logo;}
if(url){payload['url']=url;} if(typeof url!=='undefined'){payload['url']=url;}
if(legalName){payload['legalName']=legalName;} if(typeof legalName!=='undefined'){payload['legalName']=legalName;}
if(legalCountry){payload['legalCountry']=legalCountry;} if(typeof legalCountry!=='undefined'){payload['legalCountry']=legalCountry;}
if(legalState){payload['legalState']=legalState;} if(typeof legalState!=='undefined'){payload['legalState']=legalState;}
if(legalCity){payload['legalCity']=legalCity;} if(typeof legalCity!=='undefined'){payload['legalCity']=legalCity;}
if(legalAddress){payload['legalAddress']=legalAddress;} if(typeof legalAddress!=='undefined'){payload['legalAddress']=legalAddress;}
if(legalTaxId){payload['legalTaxId']=legalTaxId;} if(typeof legalTaxId!=='undefined'){payload['legalTaxId']=legalTaxId;}
return http.post(path,{'content-type':'application/json',},payload);},get:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(projectId,name,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(projectId,name,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(description){payload['description']=description;} if(typeof description!=='undefined'){payload['description']=description;}
if(logo){payload['logo']=logo;} if(typeof logo!=='undefined'){payload['logo']=logo;}
if(url){payload['url']=url;} if(typeof url!=='undefined'){payload['url']=url;}
if(legalName){payload['legalName']=legalName;} if(typeof legalName!=='undefined'){payload['legalName']=legalName;}
if(legalCountry){payload['legalCountry']=legalCountry;} if(typeof legalCountry!=='undefined'){payload['legalCountry']=legalCountry;}
if(legalState){payload['legalState']=legalState;} if(typeof legalState!=='undefined'){payload['legalState']=legalState;}
if(legalCity){payload['legalCity']=legalCity;} if(typeof legalCity!=='undefined'){payload['legalCity']=legalCity;}
if(legalAddress){payload['legalAddress']=legalAddress;} if(typeof legalAddress!=='undefined'){payload['legalAddress']=legalAddress;}
if(legalTaxId){payload['legalTaxId']=legalTaxId;} if(typeof legalTaxId!=='undefined'){payload['legalTaxId']=legalTaxId;}
return http.patch(path,{'content-type':'application/json',},payload);},delete:function(projectId,password){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),delete:(projectId,password)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(password===undefined){throw new Error('Missing required parameter: "password"');} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(password){payload['password']=password;} let path='/projects/{projectId}'.replace('{projectId}',projectId);let payload={};if(typeof password!=='undefined'){payload['password']=password;}
return http.delete(path,{'content-type':'application/json',},payload);},updateAuthLimit:function(projectId,limit){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateAuthLimit:(projectId,limit)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(limit===undefined){throw new Error('Missing required parameter: "limit"');} if(limit===undefined){throw new AppwriteException('Missing required parameter: "limit"');}
let path='/projects/{projectId}/auth/limit'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;} let path='/projects/{projectId}/auth/limit'.replace('{projectId}',projectId);let payload={};if(typeof limit!=='undefined'){payload['limit']=limit;}
return http.patch(path,{'content-type':'application/json',},payload);},updateAuthStatus:function(projectId,method,status){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),updateAuthStatus:(projectId,method,status)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(method===undefined){throw new Error('Missing required parameter: "method"');} if(method===undefined){throw new AppwriteException('Missing required parameter: "method"');}
if(status===undefined){throw new Error('Missing required parameter: "status"');} if(status===undefined){throw new AppwriteException('Missing required parameter: "status"');}
let path='/projects/{projectId}/auth/{method}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{method}','g'),method);let payload={};if(status){payload['status']=status;} let path='/projects/{projectId}/auth/{method}'.replace('{projectId}',projectId).replace('{method}',method);let payload={};if(typeof status!=='undefined'){payload['status']=status;}
return http.patch(path,{'content-type':'application/json',},payload);},listDomains:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listDomains:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/domains'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createDomain:function(projectId,domain){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createDomain:(projectId,domain)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(domain===undefined){throw new Error('Missing required parameter: "domain"');} if(domain===undefined){throw new AppwriteException('Missing required parameter: "domain"');}
let path='/projects/{projectId}/domains'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(domain){payload['domain']=domain;} let path='/projects/{projectId}/domains'.replace('{projectId}',projectId);let payload={};if(typeof domain!=='undefined'){payload['domain']=domain;}
return http.post(path,{'content-type':'application/json',},payload);},getDomain:function(projectId,domainId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(domainId===undefined){throw new Error('Missing required parameter: "domainId"');} if(domainId===undefined){throw new AppwriteException('Missing required parameter: "domainId"');}
let path='/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{domainId}','g'),domainId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},deleteDomain:function(projectId,domainId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteDomain:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(domainId===undefined){throw new Error('Missing required parameter: "domainId"');} if(domainId===undefined){throw new AppwriteException('Missing required parameter: "domainId"');}
let path='/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{domainId}','g'),domainId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateDomainVerification:function(projectId,domainId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/domains/{domainId}'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateDomainVerification:(projectId,domainId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(domainId===undefined){throw new Error('Missing required parameter: "domainId"');} if(domainId===undefined){throw new AppwriteException('Missing required parameter: "domainId"');}
let path='/projects/{projectId}/domains/{domainId}/verification'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{domainId}','g'),domainId);let payload={};return http.patch(path,{'content-type':'application/json',},payload);},listKeys:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/domains/{domainId}/verification'.replace('{projectId}',projectId).replace('{domainId}',domainId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listKeys:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createKey:function(projectId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createKey:(projectId,name,scopes)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(scopes===undefined){throw new Error('Missing required parameter: "scopes"');} if(scopes===undefined){throw new AppwriteException('Missing required parameter: "scopes"');}
let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/keys'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(scopes){payload['scopes']=scopes;} if(typeof scopes!=='undefined'){payload['scopes']=scopes;}
return http.post(path,{'content-type':'application/json',},payload);},getKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} if(keyId===undefined){throw new AppwriteException('Missing required parameter: "keyId"');}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateKey:function(projectId,keyId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateKey:(projectId,keyId,name,scopes)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} if(keyId===undefined){throw new AppwriteException('Missing required parameter: "keyId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(scopes===undefined){throw new Error('Missing required parameter: "scopes"');} if(scopes===undefined){throw new AppwriteException('Missing required parameter: "scopes"');}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(scopes){payload['scopes']=scopes;} if(typeof scopes!=='undefined'){payload['scopes']=scopes;}
return http.put(path,{'content-type':'application/json',},payload);},deleteKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteKey:(projectId,keyId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} if(keyId===undefined){throw new AppwriteException('Missing required parameter: "keyId"');}
let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateOAuth2:function(projectId,provider,appId='',secret=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/keys/{keyId}'.replace('{projectId}',projectId).replace('{keyId}',keyId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateOAuth2:(projectId,provider,appId='',secret='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(provider===undefined){throw new Error('Missing required parameter: "provider"');} if(provider===undefined){throw new AppwriteException('Missing required parameter: "provider"');}
let path='/projects/{projectId}/oauth2'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(provider){payload['provider']=provider;} let path='/projects/{projectId}/oauth2'.replace('{projectId}',projectId);let payload={};if(typeof provider!=='undefined'){payload['provider']=provider;}
if(appId){payload['appId']=appId;} if(typeof appId!=='undefined'){payload['appId']=appId;}
if(secret){payload['secret']=secret;} if(typeof secret!=='undefined'){payload['secret']=secret;}
return http.patch(path,{'content-type':'application/json',},payload);},listPlatforms:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),listPlatforms:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createPlatform:function(projectId,type,name,key='',store='',hostname=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createPlatform:(projectId,type,name,key='',store='',hostname='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(type===undefined){throw new Error('Missing required parameter: "type"');} if(type===undefined){throw new AppwriteException('Missing required parameter: "type"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(type){payload['type']=type;} let path='/projects/{projectId}/platforms'.replace('{projectId}',projectId);let payload={};if(typeof type!=='undefined'){payload['type']=type;}
if(name){payload['name']=name;} if(typeof name!=='undefined'){payload['name']=name;}
if(key){payload['key']=key;} if(typeof key!=='undefined'){payload['key']=key;}
if(store){payload['store']=store;} if(typeof store!=='undefined'){payload['store']=store;}
if(hostname){payload['hostname']=hostname;} if(typeof hostname!=='undefined'){payload['hostname']=hostname;}
return http.post(path,{'content-type':'application/json',},payload);},getPlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getPlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} if(platformId===undefined){throw new AppwriteException('Missing required parameter: "platformId"');}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePlatform:function(projectId,platformId,name,key='',store='',hostname=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePlatform:(projectId,platformId,name,key='',store='',hostname='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} if(platformId===undefined){throw new AppwriteException('Missing required parameter: "platformId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(key){payload['key']=key;} if(typeof key!=='undefined'){payload['key']=key;}
if(store){payload['store']=store;} if(typeof store!=='undefined'){payload['store']=store;}
if(hostname){payload['hostname']=hostname;} if(typeof hostname!=='undefined'){payload['hostname']=hostname;}
return http.put(path,{'content-type':'application/json',},payload);},deletePlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deletePlatform:(projectId,platformId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} if(platformId===undefined){throw new AppwriteException('Missing required parameter: "platformId"');}
let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listTasks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/platforms/{platformId}'.replace('{projectId}',projectId).replace('{platformId}',platformId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),listTasks:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createTask:function(projectId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/tasks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createTask:(projectId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(status===undefined){throw new Error('Missing required parameter: "status"');} if(status===undefined){throw new AppwriteException('Missing required parameter: "status"');}
if(schedule===undefined){throw new Error('Missing required parameter: "schedule"');} if(schedule===undefined){throw new AppwriteException('Missing required parameter: "schedule"');}
if(security===undefined){throw new Error('Missing required parameter: "security"');} if(security===undefined){throw new AppwriteException('Missing required parameter: "security"');}
if(httpMethod===undefined){throw new Error('Missing required parameter: "httpMethod"');} if(httpMethod===undefined){throw new AppwriteException('Missing required parameter: "httpMethod"');}
if(httpUrl===undefined){throw new Error('Missing required parameter: "httpUrl"');} if(httpUrl===undefined){throw new AppwriteException('Missing required parameter: "httpUrl"');}
let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/tasks'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(status){payload['status']=status;} if(typeof status!=='undefined'){payload['status']=status;}
if(schedule){payload['schedule']=schedule;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(security){payload['security']=security;} if(typeof security!=='undefined'){payload['security']=security;}
if(httpMethod){payload['httpMethod']=httpMethod;} if(typeof httpMethod!=='undefined'){payload['httpMethod']=httpMethod;}
if(httpUrl){payload['httpUrl']=httpUrl;} if(typeof httpUrl!=='undefined'){payload['httpUrl']=httpUrl;}
if(httpHeaders){payload['httpHeaders']=httpHeaders;} if(typeof httpHeaders!=='undefined'){payload['httpHeaders']=httpHeaders;}
if(httpUser){payload['httpUser']=httpUser;} if(typeof httpUser!=='undefined'){payload['httpUser']=httpUser;}
if(httpPass){payload['httpPass']=httpPass;} if(typeof httpPass!=='undefined'){payload['httpPass']=httpPass;}
return http.post(path,{'content-type':'application/json',},payload);},getTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getTask:(projectId,taskId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} if(taskId===undefined){throw new AppwriteException('Missing required parameter: "taskId"');}
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateTask:function(projectId,taskId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/tasks/{taskId}'.replace('{projectId}',projectId).replace('{taskId}',taskId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateTask:(projectId,taskId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} if(taskId===undefined){throw new AppwriteException('Missing required parameter: "taskId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(status===undefined){throw new Error('Missing required parameter: "status"');} if(status===undefined){throw new AppwriteException('Missing required parameter: "status"');}
if(schedule===undefined){throw new Error('Missing required parameter: "schedule"');} if(schedule===undefined){throw new AppwriteException('Missing required parameter: "schedule"');}
if(security===undefined){throw new Error('Missing required parameter: "security"');} if(security===undefined){throw new AppwriteException('Missing required parameter: "security"');}
if(httpMethod===undefined){throw new Error('Missing required parameter: "httpMethod"');} if(httpMethod===undefined){throw new AppwriteException('Missing required parameter: "httpMethod"');}
if(httpUrl===undefined){throw new Error('Missing required parameter: "httpUrl"');} if(httpUrl===undefined){throw new AppwriteException('Missing required parameter: "httpUrl"');}
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/tasks/{taskId}'.replace('{projectId}',projectId).replace('{taskId}',taskId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(status){payload['status']=status;} if(typeof status!=='undefined'){payload['status']=status;}
if(schedule){payload['schedule']=schedule;} if(typeof schedule!=='undefined'){payload['schedule']=schedule;}
if(security){payload['security']=security;} if(typeof security!=='undefined'){payload['security']=security;}
if(httpMethod){payload['httpMethod']=httpMethod;} if(typeof httpMethod!=='undefined'){payload['httpMethod']=httpMethod;}
if(httpUrl){payload['httpUrl']=httpUrl;} if(typeof httpUrl!=='undefined'){payload['httpUrl']=httpUrl;}
if(httpHeaders){payload['httpHeaders']=httpHeaders;} if(typeof httpHeaders!=='undefined'){payload['httpHeaders']=httpHeaders;}
if(httpUser){payload['httpUser']=httpUser;} if(typeof httpUser!=='undefined'){payload['httpUser']=httpUser;}
if(httpPass){payload['httpPass']=httpPass;} if(typeof httpPass!=='undefined'){payload['httpPass']=httpPass;}
return http.put(path,{'content-type':'application/json',},payload);},deleteTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteTask:(projectId,taskId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} if(taskId===undefined){throw new AppwriteException('Missing required parameter: "taskId"');}
let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getUsage:function(projectId,range='30d'){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/tasks/{taskId}'.replace('{projectId}',projectId).replace('{taskId}',taskId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getUsage:(projectId,range='30d')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(range){payload['range']=range;} let path='/projects/{projectId}/usage'.replace('{projectId}',projectId);let payload={};if(range){payload['range']=range;}
return http.get(path,{'content-type':'application/json',},payload);},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),listWebhooks:(projectId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createWebhook:function(projectId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createWebhook:(projectId,name,events,url,security,httpUser='',httpPass='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(events===undefined){throw new Error('Missing required parameter: "events"');} if(events===undefined){throw new AppwriteException('Missing required parameter: "events"');}
if(url===undefined){throw new Error('Missing required parameter: "url"');} if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
if(security===undefined){throw new Error('Missing required parameter: "security"');} if(security===undefined){throw new AppwriteException('Missing required parameter: "security"');}
let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/webhooks'.replace('{projectId}',projectId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(events){payload['events']=events;} if(typeof events!=='undefined'){payload['events']=events;}
if(url){payload['url']=url;} if(typeof url!=='undefined'){payload['url']=url;}
if(security){payload['security']=security;} if(typeof security!=='undefined'){payload['security']=security;}
if(httpUser){payload['httpUser']=httpUser;} if(typeof httpUser!=='undefined'){payload['httpUser']=httpUser;}
if(httpPass){payload['httpPass']=httpPass;} if(typeof httpPass!=='undefined'){payload['httpPass']=httpPass;}
return http.post(path,{'content-type':'application/json',},payload);},getWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),getWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} if(webhookId===undefined){throw new AppwriteException('Missing required parameter: "webhookId"');}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateWebhook:function(projectId,webhookId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateWebhook:(projectId,webhookId,name,events,url,security,httpUser='',httpPass='')=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} if(webhookId===undefined){throw new AppwriteException('Missing required parameter: "webhookId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
if(events===undefined){throw new Error('Missing required parameter: "events"');} if(events===undefined){throw new AppwriteException('Missing required parameter: "events"');}
if(url===undefined){throw new Error('Missing required parameter: "url"');} if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
if(security===undefined){throw new Error('Missing required parameter: "security"');} if(security===undefined){throw new AppwriteException('Missing required parameter: "security"');}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};if(name){payload['name']=name;} let path='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(events){payload['events']=events;} if(typeof events!=='undefined'){payload['events']=events;}
if(url){payload['url']=url;} if(typeof url!=='undefined'){payload['url']=url;}
if(security){payload['security']=security;} if(typeof security!=='undefined'){payload['security']=security;}
if(httpUser){payload['httpUser']=httpUser;} if(typeof httpUser!=='undefined'){payload['httpUser']=httpUser;}
if(httpPass){payload['httpPass']=httpPass;} if(typeof httpPass!=='undefined'){payload['httpPass']=httpPass;}
return http.put(path,{'content-type':'application/json',},payload);},deleteWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteWebhook:(projectId,webhookId)=>__awaiter(this,void 0,void 0,function*(){if(projectId===undefined){throw new AppwriteException('Missing required parameter: "projectId"');}
if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} if(webhookId===undefined){throw new AppwriteException('Missing required parameter: "webhookId"');}
let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.delete(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='/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}',projectId).replace('{webhookId}',webhookId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);})};this.storage={listFiles:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){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;}
return http.get(path,{'content-type':'application/json',},payload);},createFile:function(file,read,write){if(file===undefined){throw new Error('Missing required parameter: "file"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createFile:(file,read=[],write=[])=>__awaiter(this,void 0,void 0,function*(){if(file===undefined){throw new AppwriteException('Missing required parameter: "file"');}
if(read===undefined){throw new Error('Missing required parameter: "read"');} let path='/storage/files';let payload={};if(typeof file!=='undefined'){payload['file']=file;}
if(write===undefined){throw new Error('Missing required parameter: "write"');} if(typeof read!=='undefined'){payload['read']=read;}
let path='/storage/files';let payload={};if(file){payload['file']=file;} if(typeof write!=='undefined'){payload['write']=write;}
if(read){payload['read']=read;} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'multipart/form-data',},payload);}),getFile:(fileId)=>__awaiter(this,void 0,void 0,function*(){if(fileId===undefined){throw new AppwriteException('Missing required parameter: "fileId"');}
if(write){payload['write']=write;} let path='/storage/files/{fileId}'.replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updateFile:(fileId,read,write)=>__awaiter(this,void 0,void 0,function*(){if(fileId===undefined){throw new AppwriteException('Missing required parameter: "fileId"');}
return http.post(path,{'content-type':'multipart/form-data',},payload);},getFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} if(read===undefined){throw new AppwriteException('Missing required parameter: "read"');}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateFile:function(fileId,read,write){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} if(write===undefined){throw new AppwriteException('Missing required parameter: "write"');}
if(read===undefined){throw new Error('Missing required parameter: "read"');} let path='/storage/files/{fileId}'.replace('{fileId}',fileId);let payload={};if(typeof read!=='undefined'){payload['read']=read;}
if(write===undefined){throw new Error('Missing required parameter: "write"');} if(typeof write!=='undefined'){payload['write']=write;}
let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(read){payload['read']=read;} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),deleteFile:(fileId)=>__awaiter(this,void 0,void 0,function*(){if(fileId===undefined){throw new AppwriteException('Missing required parameter: "fileId"');}
if(write){payload['write']=write;} let path='/storage/files/{fileId}'.replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getFileDownload:(fileId)=>{if(fileId===undefined){throw new AppwriteException('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}/download'.replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
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"');} return uri;},getFilePreview:(fileId,width=0,height=0,quality=100,borderWidth=0,borderColor='',borderRadius=0,opacity=1,rotation=0,background='',output='')=>{if(fileId===undefined){throw new AppwriteException('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));}} let path='/storage/files/{fileId}/preview'.replace('{fileId}',fileId);let payload={};if(width){payload['width']=width;}
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;}
if(height){payload['height']=height;} if(height){payload['height']=height;}
if(quality){payload['quality']=quality;} if(quality){payload['quality']=quality;}
if(borderWidth){payload['borderWidth']=borderWidth;}
if(borderColor){payload['borderColor']=borderColor;}
if(borderRadius){payload['borderRadius']=borderRadius;}
if(opacity){payload['opacity']=opacity;}
if(rotation){payload['rotation']=rotation;}
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=[];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));}} const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
else{query.push(encodeURIComponent(p)+"="+encodeURIComponent(payload[p]));}} return uri;},getFileView:(fileId)=>{if(fileId===undefined){throw new AppwriteException('Missing required parameter: "fileId"');}
query=query.join("&");return config.endpoint+path+((query)?'?'+query:'');},getFileView:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} let path='/storage/files/{fileId}/view'.replace('{fileId}',fileId);let payload={};const uri=new URL(this.config.endpoint+path);payload['project']=this.config.project;for(const[key,value]of Object.entries(this.flatten(payload))){uri.searchParams.append(key,value);}
let path='/storage/files/{fileId}/view'.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));}} return uri;}};this.teams={list:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){let path='/teams';let payload={};if(search){payload['search']=search;}
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;}
return http.get(path,{'content-type':'application/json',},payload);},create:function(name,roles=["owner"]){if(name===undefined){throw new Error('Missing required parameter: "name"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(name,roles=["owner"])=>__awaiter(this,void 0,void 0,function*(){if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
let path='/teams';let payload={};if(name){payload['name']=name;} let path='/teams';let payload={};if(typeof name!=='undefined'){payload['name']=name;}
if(roles){payload['roles']=roles;} if(typeof roles!=='undefined'){payload['roles']=roles;}
return http.post(path,{'content-type':'application/json',},payload);},get:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(teamId,name){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),update:(teamId,name)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
if(name===undefined){throw new Error('Missing required parameter: "name"');} if(name===undefined){throw new AppwriteException('Missing required parameter: "name"');}
let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(name){payload['name']=name;} let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};if(typeof name!=='undefined'){payload['name']=name;}
return http.put(path,{'content-type':'application/json',},payload);},delete:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('put',uri,{'content-type':'application/json',},payload);}),delete:(teamId)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getMemberships:function(teamId,search='',limit=25,offset=0,orderType='ASC'){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} let path='/teams/{teamId}'.replace('{teamId}',teamId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getMemberships:(teamId,search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(search){payload['search']=search;} let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);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;}
return http.get(path,{'content-type':'application/json',},payload);},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),createMembership:(teamId,email,roles,url,name='')=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
if(email===undefined){throw new Error('Missing required parameter: "email"');} if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
if(roles===undefined){throw new Error('Missing required parameter: "roles"');} if(roles===undefined){throw new AppwriteException('Missing required parameter: "roles"');}
if(url===undefined){throw new Error('Missing required parameter: "url"');} if(url===undefined){throw new AppwriteException('Missing required parameter: "url"');}
let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(email){payload['email']=email;} let path='/teams/{teamId}/memberships'.replace('{teamId}',teamId);let payload={};if(typeof email!=='undefined'){payload['email']=email;}
if(name){payload['name']=name;} if(typeof name!=='undefined'){payload['name']=name;}
if(roles){payload['roles']=roles;} if(typeof roles!=='undefined'){payload['roles']=roles;}
if(url){payload['url']=url;} if(typeof url!=='undefined'){payload['url']=url;}
return http.post(path,{'content-type':'application/json',},payload);},deleteMembership:function(teamId,inviteId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),updateMembershipRoles:(teamId,membershipId,roles)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"');} if(membershipId===undefined){throw new AppwriteException('Missing required parameter: "membershipId"');}
let path='/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateMembershipStatus:function(teamId,inviteId,userId,secret){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(roles===undefined){throw new AppwriteException('Missing required parameter: "roles"');}
if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"');} let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof roles!=='undefined'){payload['roles']=roles;}
if(userId===undefined){throw new Error('Missing required parameter: "userId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),deleteMembership:(teamId,membershipId)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
if(secret===undefined){throw new Error('Missing required parameter: "secret"');} if(membershipId===undefined){throw new AppwriteException('Missing required parameter: "membershipId"');}
let path='/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};if(userId){payload['userId']=userId;} let path='/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateMembershipStatus:(teamId,membershipId,userId,secret)=>__awaiter(this,void 0,void 0,function*(){if(teamId===undefined){throw new AppwriteException('Missing required parameter: "teamId"');}
if(secret){payload['secret']=secret;} if(membershipId===undefined){throw new AppwriteException('Missing required parameter: "membershipId"');}
return http.patch(path,{'content-type':'application/json',},payload);}};let users={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/users';let payload={};if(search){payload['search']=search;} if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(secret===undefined){throw new AppwriteException('Missing required parameter: "secret"');}
let path='/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}',teamId).replace('{membershipId}',membershipId);let payload={};if(typeof userId!=='undefined'){payload['userId']=userId;}
if(typeof secret!=='undefined'){payload['secret']=secret;}
const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};this.users={list:(search='',limit=25,offset=0,orderType='ASC')=>__awaiter(this,void 0,void 0,function*(){let path='/users';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;}
return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');} const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),create:(email,password,name='')=>__awaiter(this,void 0,void 0,function*(){if(email===undefined){throw new AppwriteException('Missing required parameter: "email"');}
if(password===undefined){throw new Error('Missing required parameter: "password"');} if(password===undefined){throw new AppwriteException('Missing required parameter: "password"');}
let path='/users';let payload={};if(email){payload['email']=email;} let path='/users';let payload={};if(typeof email!=='undefined'){payload['email']=email;}
if(password){payload['password']=password;} if(typeof password!=='undefined'){payload['password']=password;}
if(name){payload['name']=name;} if(typeof name!=='undefined'){payload['name']=name;}
return http.post(path,{'content-type':'application/json',},payload);},get:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('post',uri,{'content-type':'application/json',},payload);}),get:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},deleteUser:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),delete:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getLogs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),getLogs:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/logs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},getPrefs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}/logs'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),getPrefs:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePrefs:function(userId,prefs){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),updatePrefs:(userId,prefs)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(prefs===undefined){throw new Error('Missing required parameter: "prefs"');} if(prefs===undefined){throw new AppwriteException('Missing required parameter: "prefs"');}
let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};if(prefs){payload['prefs']=prefs;} let path='/users/{userId}/prefs'.replace('{userId}',userId);let payload={};if(typeof prefs!=='undefined'){payload['prefs']=prefs;}
return http.patch(path,{'content-type':'application/json',},payload);},getSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);}),getSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},deleteSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('get',uri,{'content-type':'application/json',},payload);}),deleteSessions:(userId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},deleteSession:function(userId,sessionId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}/sessions'.replace('{userId}',userId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),deleteSession:(userId,sessionId)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');} if(sessionId===undefined){throw new AppwriteException('Missing required parameter: "sessionId"');}
let path='/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}','g'),userId).replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} let path='/users/{userId}/sessions/{sessionId}'.replace('{userId}',userId).replace('{sessionId}',sessionId);let payload={};const uri=new URL(this.config.endpoint+path);return yield this.call('delete',uri,{'content-type':'application/json',},payload);}),updateStatus:(userId,status)=>__awaiter(this,void 0,void 0,function*(){if(userId===undefined){throw new AppwriteException('Missing required parameter: "userId"');}
if(status===undefined){throw new Error('Missing required parameter: "status"');} if(status===undefined){throw new AppwriteException('Missing required parameter: "status"');}
let path='/users/{userId}/status'.replace(new RegExp('{userId}','g'),userId);let payload={};if(status){payload['status']=status;} let path='/users/{userId}/status'.replace('{userId}',userId);let payload={};if(typeof status!=='undefined'){payload['status']=status;}
return http.patch(path,{'content-type':'application/json',},payload);}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,avatars:avatars,database:database,functions:functions,health:health,locale:locale,projects:projects,storage:storage,teams:teams,users:users};};if(typeof module!=="undefined"){module.exports=window.Appwrite;}})((typeof window!=="undefined")?window:{});(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;} const uri=new URL(this.config.endpoint+path);return yield this.call('patch',uri,{'content-type':'application/json',},payload);})};}
setEndpoint(endpoint){this.config.endpoint=endpoint;return this;}
setProject(value){this.headers['X-Appwrite-Project']=value;this.config.project=value;return this;}
setKey(value){this.headers['X-Appwrite-Key']=value;this.config.key=value;return this;}
setJWT(value){this.headers['X-Appwrite-JWT']=value;this.config.jwt=value;return this;}
setLocale(value){this.headers['X-Appwrite-Locale']=value;this.config.locale=value;return this;}
setMode(value){this.headers['X-Appwrite-Mode']=value;this.config.mode=value;return this;}
call(method,url,headers={},params={}){var _a,_b;return __awaiter(this,void 0,void 0,function*(){method=method.toUpperCase();headers=Object.assign(Object.assign({},headers),this.headers);let options={method,headers,credentials:'include'};if(typeof window!=='undefined'&&window.localStorage){headers['X-Fallback-Cookies']=(_a=window.localStorage.getItem('cookieFallback'))!==null&&_a!==void 0?_a:"";}
if(method==='GET'){for(const[key,value]of Object.entries(this.flatten(params))){url.searchParams.append(key,value);}}
else{switch(headers['content-type']){case'application/json':options.body=JSON.stringify(params);break;case'multipart/form-data':let formData=new FormData();for(const key in params){if(Array.isArray(params[key])){formData.append(key+'[]',params[key].join(','));}
else{formData.append(key,params[key]);}}
options.body=formData;delete headers['content-type'];break;}}
try{let data=null;const response=yield crossFetch.fetch(url.toString(),options);if((_b=response.headers.get("content-type"))===null||_b===void 0?void 0:_b.includes("application/json")){data=yield response.json();}
else{data={message:yield response.text()};}
if(400<=response.status){throw new AppwriteException(data===null||data===void 0?void 0:data.message,response.status,data);}
const cookieFallback=response.headers.get('X-Fallback-Cookies');if(typeof window!=='undefined'&&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);}
return data;}
catch(e){throw new AppwriteException(e.message);}});}
flatten(data,prefix=''){let output={};for(const key in data){let value=data[key];let finalKey=prefix?`${prefix}[${key}]`:key;if(Array.isArray(value)){output=Object.assign(output,this.flatten(value,finalKey));}
else{output[finalKey]=value;}}
return output;}}
exports.Appwrite=Appwrite;return exports;}({},null,window));(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory(function(){try{return require('moment');}catch(e){}}()):typeof define==='function'&&define.amd?define(['require'],function(require){return factory(function(){try{return require('moment');}catch(e){}}());}):(global=global||self,global.Chart=factory(global.moment));}(this,(function(moment){'use strict';moment=moment&&moment.hasOwnProperty('default')?moment['default']:moment;function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;}
function getCjsExportFromNamespace(n){return n&&n['default']||n;} function getCjsExportFromNamespace(n){return n&&n['default']||n;}
var colorName={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};var conversions=createCommonjsModule(function(module){var reverseKeywords={};for(var key in colorName){if(colorName.hasOwnProperty(key)){reverseKeywords[colorName[key]]=key;}} var colorName={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};var conversions=createCommonjsModule(function(module){var reverseKeywords={};for(var key in colorName){if(colorName.hasOwnProperty(key)){reverseKeywords[colorName[key]]=key;}}
var convert=module.exports={rgb:{channels:3,labels:'rgb'},hsl:{channels:3,labels:'hsl'},hsv:{channels:3,labels:'hsv'},hwb:{channels:3,labels:'hwb'},cmyk:{channels:4,labels:'cmyk'},xyz:{channels:3,labels:'xyz'},lab:{channels:3,labels:'lab'},lch:{channels:3,labels:'lch'},hex:{channels:1,labels:['hex']},keyword:{channels:1,labels:['keyword']},ansi16:{channels:1,labels:['ansi16']},ansi256:{channels:1,labels:['ansi256']},hcg:{channels:3,labels:['h','c','g']},apple:{channels:3,labels:['r16','g16','b16']},gray:{channels:1,labels:['gray']}};for(var model in convert){if(convert.hasOwnProperty(model)){if(!('channels'in convert[model])){throw new Error('missing channels property: '+model);} var convert=module.exports={rgb:{channels:3,labels:'rgb'},hsl:{channels:3,labels:'hsl'},hsv:{channels:3,labels:'hsv'},hwb:{channels:3,labels:'hwb'},cmyk:{channels:4,labels:'cmyk'},xyz:{channels:3,labels:'xyz'},lab:{channels:3,labels:'lab'},lch:{channels:3,labels:'lch'},hex:{channels:1,labels:['hex']},keyword:{channels:1,labels:['keyword']},ansi16:{channels:1,labels:['ansi16']},ansi256:{channels:1,labels:['ansi256']},hcg:{channels:3,labels:['h','c','g']},apple:{channels:3,labels:['r16','g16','b16']},gray:{channels:1,labels:['gray']}};for(var model in convert){if(convert.hasOwnProperty(model)){if(!('channels'in convert[model])){throw new Error('missing channels property: '+model);}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6 KiB

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,10 +2,10 @@
"use strict"; "use strict";
window.ls.container.set('console', function (window) { window.ls.container.set('console', function (window) {
var sdk = new window.Appwrite(); var sdk = new window.Appwrite.Appwrite();
sdk sdk
.setEndpoint(APP_ENV.API) .setEndpoint(APP_ENV.ENDPOINT + APP_ENV.API)
.setProject('console') .setProject('console')
.setLocale(APP_ENV.LOCALE) .setLocale(APP_ENV.LOCALE)
; ;

View file

@ -2,10 +2,10 @@
"use strict"; "use strict";
window.ls.container.set('sdk', function (window, router) { window.ls.container.set('sdk', function (window, router) {
var sdk = new window.Appwrite(); var sdk = new window.Appwrite.Appwrite();
sdk sdk
.setEndpoint(APP_ENV.API) .setEndpoint(APP_ENV.ENDPOINT + APP_ENV.API)
.setProject(router.params.project || '') .setProject(router.params.project || '')
.setLocale(APP_ENV.LOCALE) .setLocale(APP_ENV.LOCALE)
.setMode('admin') .setMode('admin')

View file

@ -24,7 +24,7 @@ class Twitch extends OAuth2
* @var array * @var array
*/ */
protected $scopes = [ protected $scopes = [
'user:read:email', 'user:read:email',
]; ];
/** /**
@ -65,9 +65,7 @@ class Twitch extends OAuth2
{ {
$result = \json_decode($this->request( $result = \json_decode($this->request(
'POST', 'POST',
$this->endpoint . 'token', $this->endpoint . 'token?'. \http_build_query([
[],
\http_build_query([
"client_id" => $this->appID, "client_id" => $this->appID,
"client_secret" => $this->appSecret, "client_secret" => $this->appSecret,
"code" => $code, "code" => $code,
@ -139,11 +137,15 @@ class Twitch extends OAuth2
protected function getUser(string $accessToken) protected function getUser(string $accessToken)
{ {
if (empty($this->user)) { if (empty($this->user)) {
$this->user = \json_decode($this->request( $response = \json_decode($this->request(
'GET', 'GET',
$this->resourceEndpoint, $this->resourceEndpoint , [
['Authorization: Bearer '.\urlencode($accessToken)] 'Authorization: Bearer '.\urlencode($accessToken),
), true)['data']['0']; 'Client-Id: '. \urlencode($this->appID)
]
), true);
$this->user = $response['data']['0'] ?? [];
} }
return $this->user; return $this->user;

View file

@ -5,6 +5,7 @@ namespace Appwrite\Specification\Format;
use Appwrite\Specification\Format; use Appwrite\Specification\Format;
use Appwrite\Template\Template; use Appwrite\Template\Template;
use stdClass; use stdClass;
use Utopia\Validator;
class OpenAPI3 extends Format class OpenAPI3 extends Format
{ {
@ -230,24 +231,24 @@ class OpenAPI3 extends Format
switch ((!empty($validator)) ? \get_class($validator) : '') { switch ((!empty($validator)) ? \get_class($validator) : '') {
case 'Utopia\Validator\Text': case 'Utopia\Validator\Text':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; $node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
break; break;
case 'Utopia\Validator\Boolean': case 'Utopia\Validator\Boolean':
$node['schema']['type'] = 'boolean'; $node['schema']['type'] = $validator->getType();
$node['schema']['x-example'] = false; $node['schema']['x-example'] = false;
break; break;
case 'Appwrite\Database\Validator\UID': case 'Appwrite\Database\Validator\UID':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; $node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
break; break;
case 'Appwrite\Network\Validator\Email': case 'Appwrite\Network\Validator\Email':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'email'; $node['schema']['format'] = 'email';
$node['schema']['x-example'] = 'email@example.com'; $node['schema']['x-example'] = 'email@example.com';
break; break;
case 'Appwrite\Network\Validator\URL': case 'Appwrite\Network\Validator\URL':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'url'; $node['schema']['format'] = 'url';
$node['schema']['x-example'] = 'https://example.com'; $node['schema']['x-example'] = 'https://example.com';
break; break;
@ -261,7 +262,7 @@ class OpenAPI3 extends Format
break; break;
case 'Utopia\Storage\Validator\File': case 'Utopia\Storage\Validator\File':
$consumes = ['multipart/form-data']; $consumes = ['multipart/form-data'];
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'binary'; $node['schema']['format'] = 'binary';
break; break;
case 'Utopia\Validator\ArrayList': case 'Utopia\Validator\ArrayList':
@ -271,24 +272,24 @@ class OpenAPI3 extends Format
]; ];
break; break;
case 'Appwrite\Auth\Validator\Password': case 'Appwrite\Auth\Validator\Password':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'format'; $node['schema']['format'] = 'password';
$node['schema']['x-example'] = 'password'; $node['schema']['x-example'] = 'password';
break; break;
case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */
$node['schema']['type'] = 'integer'; $node['schema']['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['schema']['format'] = 'int32'; $node['schema']['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float';
$node['schema']['x-example'] = $validator->getMin(); $node['schema']['x-example'] = $validator->getMin();
break; break;
case 'Utopia\Validator\Numeric': case 'Utopia\Validator\Numeric':
$node['schema']['type'] = 'integer'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'int32'; $node['schema']['format'] = 'int32';
break; break;
case 'Utopia\Validator\Length': case 'Utopia\Validator\Length':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
break; break;
case 'Appwrite\Network\Validator\Host': case 'Appwrite\Network\Validator\Host':
$node['schema']['type'] = 'string'; $node['schema']['type'] = $validator->getType();
$node['schema']['format'] = 'url'; $node['schema']['format'] = 'url';
$node['schema']['x-example'] = 'https://example.com'; $node['schema']['x-example'] = 'https://example.com';
break; break;

View file

@ -6,6 +6,7 @@ use Appwrite\Specification\Format;
use Appwrite\Template\Template; use Appwrite\Template\Template;
use Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response\Model;
use stdClass; use stdClass;
use Utopia\Validator;
class Swagger2 extends Format class Swagger2 extends Format
{ {
@ -227,24 +228,24 @@ class Swagger2 extends Format
switch ((!empty($validator)) ? \get_class($validator) : '') { switch ((!empty($validator)) ? \get_class($validator) : '') {
case 'Utopia\Validator\Text': case 'Utopia\Validator\Text':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; $node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
break; break;
case 'Utopia\Validator\Boolean': case 'Utopia\Validator\Boolean':
$node['type'] = 'boolean'; $node['type'] = $validator->getType();
$node['x-example'] = false; $node['x-example'] = false;
break; break;
case 'Appwrite\Database\Validator\UID': case 'Appwrite\Database\Validator\UID':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; $node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']';
break; break;
case 'Appwrite\Network\Validator\Email': case 'Appwrite\Network\Validator\Email':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['format'] = 'email'; $node['format'] = 'email';
$node['x-example'] = 'email@example.com'; $node['x-example'] = 'email@example.com';
break; break;
case 'Appwrite\Network\Validator\URL': case 'Appwrite\Network\Validator\URL':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['format'] = 'url'; $node['format'] = 'url';
$node['x-example'] = 'https://example.com'; $node['x-example'] = 'https://example.com';
break; break;
@ -268,24 +269,24 @@ class Swagger2 extends Format
]; ];
break; break;
case 'Appwrite\Auth\Validator\Password': case 'Appwrite\Auth\Validator\Password':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['format'] = 'format'; $node['format'] = 'password';
$node['x-example'] = 'password'; $node['x-example'] = 'password';
break; break;
case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */
$node['type'] = 'integer'; $node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number': $validator->getType();
$node['format'] = 'int32'; $node['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float';
$node['x-example'] = $validator->getMin(); $node['x-example'] = $validator->getMin();
break; break;
case 'Utopia\Validator\Numeric': case 'Utopia\Validator\Numeric':
$node['type'] = 'integer'; $node['type'] = $validator->getType();
$node['format'] = 'int32'; $node['format'] = 'int32';
break; break;
case 'Utopia\Validator\Length': case 'Utopia\Validator\Length':
$node['type'] = 'string'; $node['type'] = $validator->getType();
break; break;
case 'Appwrite\Network\Validator\Host': case 'Appwrite\Network\Validator\Host':
$node['type'] = 'string'; $node['type'] = $validator->getType();
$node['format'] = 'url'; $node['format'] = 'url';
$node['x-example'] = 'https://example.com'; $node['x-example'] = 'https://example.com';
break; break;

View file

@ -240,6 +240,10 @@ class AccountCustomClientTest extends Scope
]); ]);
$this->assertEquals(201, $response['headers']['status-code']); $this->assertEquals(201, $response['headers']['status-code']);
$this->assertIsArray($response['body']);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertNotEmpty($response['body']['userId']);
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']]; $session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];

View file

@ -168,5 +168,55 @@ trait TeamsBaseServer
$this->assertEquals(401, $response['headers']['status-code']); $this->assertEquals(401, $response['headers']['status-code']);
return $data;
}
/**
* @depends testUpdateMembershipRoles
*/
public function testDeleteUserUpdatesTeamMembershipCount($data) {
$teamUid = $data['teamUid'] ?? '';
$userUid = $data['userUid'] ?? '';
/** Get Team Count */
$response = $this->client->call(Client::METHOD_GET, '/teams/'.$teamUid, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals('Arsenal', $response['body']['name']);
$this->assertEquals(1, $response['body']['sum']);
$this->assertIsInt($response['body']['sum']);
$this->assertIsInt($response['body']['dateCreated']);
/** Delete User */
$user = $this->client->call(Client::METHOD_DELETE, '/users/' . $userUid, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals($user['headers']['status-code'], 204);
/** Wait for deletes worker to delete membership and update team membership count */
sleep(5);
/** Get Team Count */
$response = $this->client->call(Client::METHOD_GET, '/teams/'.$teamUid, array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertEquals('Arsenal', $response['body']['name']);
$this->assertEquals(0, $response['body']['sum']);
$this->assertIsInt($response['body']['sum']);
$this->assertIsInt($response['body']['dateCreated']);
} }
} }

View file

@ -122,6 +122,35 @@ trait UsersBase
return $data; return $data;
} }
/**
* @depends testGetUser
*/
public function testUpdateEmailVerification(array $data):array
{
/**
* Test for SUCCESS
*/
$user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/verification', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'emailVerification' => true,
]);
$this->assertEquals($user['headers']['status-code'], 200);
$this->assertEquals($user['body']['emailVerification'], true);
$user = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'], array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals($user['headers']['status-code'], 200);
$this->assertEquals($user['body']['emailVerification'], true);
return $data;
}
/** /**
* @depends testGetUser * @depends testGetUser
*/ */

View file

@ -346,7 +346,7 @@ services:
- appwrite-influxdb:/var/lib/influxdb:rw - appwrite-influxdb:/var/lib/influxdb:rw
telegraf: telegraf:
image: appwrite/telegraf:1.0.0 image: appwrite/telegraf:1.1.0
container_name: appwrite-telegraf container_name: appwrite-telegraf
restart: unless-stopped restart: unless-stopped
networks: networks: