1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

Test preloading of all validators

This commit is contained in:
Eldad Fux 2020-09-10 17:40:14 +03:00
parent 8cbc30daba
commit ca95ee803e
12 changed files with 371 additions and 371 deletions

View file

@ -51,9 +51,9 @@ App::post('/v1/account')
->label('sdk.method', 'create') ->label('sdk.method', 'create')
->label('sdk.description', '/docs/references/account/create.md') ->label('sdk.description', '/docs/references/account/create.md')
->label('abuse-limit', 10) ->label('abuse-limit', 10)
->param('email', '', function () { return new Email(); }, 'User email.') ->param('email', '', new Email(), 'User email.')
->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.')
->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.', true) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true)
->action(function ($email, $password, $name, $request, $response, $project, $projectDB, $webhooks, $audits) use ($oauth2Keys) { ->action(function ($email, $password, $name, $request, $response, $project, $projectDB, $webhooks, $audits) use ($oauth2Keys) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -157,8 +157,8 @@ App::post('/v1/account/sessions')
->label('sdk.description', '/docs/references/account/create-session.md') ->label('sdk.description', '/docs/references/account/create-session.md')
->label('abuse-limit', 10) ->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}') ->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () { return new Email(); }, 'User email.') ->param('email', '', new Email(), 'User email.')
->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.')
->action(function ($email, $password, $request, $response, $projectDB, $webhooks, $audits) { ->action(function ($email, $password, $request, $response, $projectDB, $webhooks, $audits) {
/** @var Appwrite\Swoole\Request $request */ /** @var Appwrite\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
@ -256,10 +256,10 @@ App::get('/v1/account/sessions/oauth2/:provider')
->label('sdk.methodType', 'webAuth') ->label('sdk.methodType', 'webAuth')
->label('abuse-limit', 50) ->label('abuse-limit', 50)
->label('abuse-key', 'ip:{ip}') ->label('abuse-key', 'ip:{ip}')
->param('provider', '', function () { return new WhiteList(\array_keys(Config::getParam('providers')), true); }, 'OAuth2 Provider. Currently, supported providers are: ' . \implode(', ', \array_keys(\array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.') ->param('provider', '', new WhiteList(\array_keys(Config::getParam('providers')), true), 'OAuth2 Provider. Currently, supported providers are: ' . \implode(', ', \array_keys(\array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.')
->param('success', $oauthDefaultSuccess, function ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true, ['clients']) ->param('success', $oauthDefaultSuccess, function ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true, ['clients'])
->param('failure', $oauthDefaultFailure, function ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true, ['clients']) ->param('failure', $oauthDefaultFailure, function ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true, ['clients'])
->param('scopes', [], function () { return new ArrayList(new Text(128)); }, 'A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.', true) ->param('scopes', [], new ArrayList(new Text(128)), 'A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.', true)
->action(function ($provider, $success, $failure, $scopes, $request, $response, $project) { ->action(function ($provider, $success, $failure, $scopes, $request, $response, $project) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -301,10 +301,10 @@ App::get('/v1/account/sessions/oauth2/callback/:provider/:projectId')
->label('error', __DIR__.'/../../views/general/error.phtml') ->label('error', __DIR__.'/../../views/general/error.phtml')
->label('scope', 'public') ->label('scope', 'public')
->label('docs', false) ->label('docs', false)
->param('projectId', '', function () { return new Text(1024); }, 'Project unique ID.') ->param('projectId', '', new Text(1024), 'Project unique ID.')
->param('provider', '', function () { return new WhiteList(\array_keys(Config::getParam('providers')), true); }, 'OAuth2 provider.') ->param('provider', '', new WhiteList(\array_keys(Config::getParam('providers')), true), 'OAuth2 provider.')
->param('code', '', function () { return new Text(1024); }, 'OAuth2 code.') ->param('code', '', new Text(1024), 'OAuth2 code.')
->param('state', '', function () { return new Text(2048); }, 'Login state params.', true) ->param('state', '', new Text(2048), 'Login state params.', true)
->action(function ($projectId, $provider, $code, $state, $request, $response) { ->action(function ($projectId, $provider, $code, $state, $request, $response) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -326,10 +326,10 @@ App::post('/v1/account/sessions/oauth2/callback/:provider/:projectId')
->label('scope', 'public') ->label('scope', 'public')
->label('origin', '*') ->label('origin', '*')
->label('docs', false) ->label('docs', false)
->param('projectId', '', function () { return new Text(1024); }, 'Project unique ID.') ->param('projectId', '', new Text(1024), 'Project unique ID.')
->param('provider', '', function () { return new WhiteList(\array_keys(Config::getParam('providers')), true); }, 'OAuth2 provider.') ->param('provider', '', new WhiteList(\array_keys(Config::getParam('providers')), true), 'OAuth2 provider.')
->param('code', '', function () { return new Text(1024); }, 'OAuth2 code.') ->param('code', '', new Text(1024), 'OAuth2 code.')
->param('state', '', function () { return new Text(2048); }, 'Login state params.', true) ->param('state', '', new Text(2048), 'Login state params.', true)
->action(function ($projectId, $provider, $code, $state, $request, $response) { ->action(function ($projectId, $provider, $code, $state, $request, $response) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -353,9 +353,9 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->label('abuse-limit', 50) ->label('abuse-limit', 50)
->label('abuse-key', 'ip:{ip}') ->label('abuse-key', 'ip:{ip}')
->label('docs', false) ->label('docs', false)
->param('provider', '', function () { return new WhiteList(\array_keys(Config::getParam('providers')), true); }, 'OAuth2 provider.') ->param('provider', '', new WhiteList(\array_keys(Config::getParam('providers')), true), 'OAuth2 provider.')
->param('code', '', function () { return new Text(1024); }, 'OAuth2 code.') ->param('code', '', new Text(1024), 'OAuth2 code.')
->param('state', '', function () { return new Text(2048); }, 'OAuth2 state params.', true) ->param('state', '', new Text(2048), 'OAuth2 state params.', true)
->action(function ($provider, $code, $state, $request, $response, $project, $user, $projectDB, $audits) use ($oauthDefaultSuccess) { ->action(function ($provider, $code, $state, $request, $response, $project, $user, $projectDB, $audits) use ($oauthDefaultSuccess) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -738,7 +738,7 @@ App::patch('/v1/account/name')
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'updateName') ->label('sdk.method', 'updateName')
->label('sdk.description', '/docs/references/account/update-name.md') ->label('sdk.description', '/docs/references/account/update-name.md')
->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.') ->param('name', '', new Text(128), 'User name. Max length: 128 chars.')
->action(function ($name, $response, $user, $projectDB, $audits) use ($oauth2Keys) { ->action(function ($name, $response, $user, $projectDB, $audits) use ($oauth2Keys) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */
@ -779,8 +779,8 @@ App::patch('/v1/account/password')
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'updatePassword') ->label('sdk.method', 'updatePassword')
->label('sdk.description', '/docs/references/account/update-password.md') ->label('sdk.description', '/docs/references/account/update-password.md')
->param('password', '', function () { return new Password(); }, 'New user password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'New user password. Must be between 6 to 32 chars.')
->param('oldPassword', '', function () { return new Password(); }, 'Old user password. Must be between 6 to 32 chars.') ->param('oldPassword', '', new Password(), 'Old user password. Must be between 6 to 32 chars.')
->action(function ($password, $oldPassword, $response, $user, $projectDB, $audits) use ($oauth2Keys) { ->action(function ($password, $oldPassword, $response, $user, $projectDB, $audits) use ($oauth2Keys) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */
@ -825,8 +825,8 @@ App::patch('/v1/account/email')
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'updateEmail') ->label('sdk.method', 'updateEmail')
->label('sdk.description', '/docs/references/account/update-email.md') ->label('sdk.description', '/docs/references/account/update-email.md')
->param('email', '', function () { return new Email(); }, 'User email.') ->param('email', '', new Email(), 'User email.')
->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.')
->action(function ($email, $password, $response, $user, $projectDB, $audits) use ($oauth2Keys) { ->action(function ($email, $password, $response, $user, $projectDB, $audits) use ($oauth2Keys) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */
@ -885,7 +885,7 @@ App::patch('/v1/account/prefs')
->label('sdk.platform', [APP_PLATFORM_CLIENT]) ->label('sdk.platform', [APP_PLATFORM_CLIENT])
->label('sdk.namespace', 'account') ->label('sdk.namespace', 'account')
->label('sdk.method', 'updatePrefs') ->label('sdk.method', 'updatePrefs')
->param('prefs', '', function () { return new Assoc();}, 'Prefs key-value JSON object.') ->param('prefs', '', new Assoc(), 'Prefs key-value JSON object.')
->label('sdk.description', '/docs/references/account/update-prefs.md') ->label('sdk.description', '/docs/references/account/update-prefs.md')
->action(function ($prefs, $response, $user, $projectDB, $audits) { ->action(function ($prefs, $response, $user, $projectDB, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -992,7 +992,7 @@ App::delete('/v1/account/sessions/:sessionId')
->label('sdk.method', 'deleteSession') ->label('sdk.method', 'deleteSession')
->label('sdk.description', '/docs/references/account/delete-session.md') ->label('sdk.description', '/docs/references/account/delete-session.md')
->label('abuse-limit', 100) ->label('abuse-limit', 100)
->param('sessionId', null, function () { return new UID(); }, 'Session unique ID. Use the string \'current\' to delete the current device session.') ->param('sessionId', null, new UID(), 'Session unique ID. Use the string \'current\' to delete the current device session.')
->action(function ($sessionId, $request, $response, $user, $projectDB, $audits, $webhooks) { ->action(function ($sessionId, $request, $response, $user, $projectDB, $audits, $webhooks) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -1113,7 +1113,7 @@ App::post('/v1/account/recovery')
->label('sdk.description', '/docs/references/account/create-recovery.md') ->label('sdk.description', '/docs/references/account/create-recovery.md')
->label('abuse-limit', 10) ->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}') ->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () { return new Email(); }, 'User email.') ->param('email', '', new Email(), 'User email.')
->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients']) ->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients'])
->action(function ($email, $url, $request, $response, $projectDB, $project, $locale, $mails, $audits) { ->action(function ($email, $url, $request, $response, $projectDB, $project, $locale, $mails, $audits) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
@ -1219,10 +1219,10 @@ App::put('/v1/account/recovery')
->label('sdk.description', '/docs/references/account/update-recovery.md') ->label('sdk.description', '/docs/references/account/update-recovery.md')
->label('abuse-limit', 10) ->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},userId:{param-userId}') ->label('abuse-key', 'url:{url},userId:{param-userId}')
->param('userId', '', function () { return new UID(); }, 'User account UID address.') ->param('userId', '', new UID(), 'User account UID address.')
->param('secret', '', function () { return new Text(256); }, 'Valid reset token.') ->param('secret', '', new Text(256), 'Valid reset token.')
->param('password', '', function () { return new Password(); }, 'New password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'New password. Must be between 6 to 32 chars.')
->param('passwordAgain', '', function () {return new Password(); }, 'New password again. Must be between 6 to 32 chars.') ->param('passwordAgain', '', new Password(), 'New password again. Must be between 6 to 32 chars.')
->action(function ($userId, $secret, $password, $passwordAgain, $response, $projectDB, $audits) { ->action(function ($userId, $secret, $password, $passwordAgain, $response, $projectDB, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -1386,8 +1386,8 @@ App::put('/v1/account/verification')
->label('sdk.description', '/docs/references/account/update-verification.md') ->label('sdk.description', '/docs/references/account/update-verification.md')
->label('abuse-limit', 10) ->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},userId:{param-userId}') ->label('abuse-key', 'url:{url},userId:{param-userId}')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->param('secret', '', function () { return new Text(256); }, 'Valid verification token.') ->param('secret', '', new Text(256), 'Valid verification token.')
->action(function ($userId, $secret, $response, $user, $projectDB, $audits) { ->action(function ($userId, $secret, $response, $user, $projectDB, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */

View file

@ -90,10 +90,10 @@ App::get('/v1/avatars/credit-cards/:code')
->label('sdk.method', 'getCreditCard') ->label('sdk.method', 'getCreditCard')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-credit-card.md') ->label('sdk.description', '/docs/references/avatars/get-credit-card.md')
->param('code', '', function () { return new WhiteList(\array_keys(Config::getParam('avatar-credit-cards'))); }, 'Credit Card Code. Possible values: '.\implode(', ', \array_keys(Config::getParam('avatar-credit-cards'))).'.') ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-credit-cards'))), 'Credit Card Code. Possible values: '.\implode(', ', \array_keys(Config::getParam('avatar-credit-cards'))).'.')
->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('quality', 100, function () { return new Range(0, 100); }, 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('quality', 100, new Range(0, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) { ->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) {
return $avatarCallback('credit-cards', $code, $width, $height, $quality, $response); return $avatarCallback('credit-cards', $code, $width, $height, $quality, $response);
}, ['response']); }, ['response']);
@ -107,10 +107,10 @@ App::get('/v1/avatars/browsers/:code')
->label('sdk.method', 'getBrowser') ->label('sdk.method', 'getBrowser')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-browser.md') ->label('sdk.description', '/docs/references/avatars/get-browser.md')
->param('code', '', function () { return new WhiteList(\array_keys(Config::getParam('avatar-browsers'))); }, 'Browser Code.') ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-browsers'))), 'Browser Code.')
->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('quality', 100, function () { return new Range(0, 100); }, 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('quality', 100, new Range(0, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) { ->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) {
return $avatarCallback('browsers', $code, $width, $height, $quality, $response); return $avatarCallback('browsers', $code, $width, $height, $quality, $response);
}, ['response']); }, ['response']);
@ -124,10 +124,10 @@ App::get('/v1/avatars/flags/:code')
->label('sdk.method', 'getFlag') ->label('sdk.method', 'getFlag')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-flag.md') ->label('sdk.description', '/docs/references/avatars/get-flag.md')
->param('code', '', function () { return new WhiteList(\array_keys(Config::getParam('avatar-flags'))); }, 'Country Code. ISO Alpha-2 country code format.') ->param('code', '', new WhiteList(\array_keys(Config::getParam('avatar-flags'))), 'Country Code. ISO Alpha-2 country code format.')
->param('width', 100, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('width', 100, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 100, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 100, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('quality', 100, function () { return new Range(0, 100); }, 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('quality', 100, new Range(0, 100), 'Image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) { ->action(function ($code, $width, $height, $quality, $response) use ($avatarCallback) {
return $avatarCallback('flags', $code, $width, $height, $quality, $response); return $avatarCallback('flags', $code, $width, $height, $quality, $response);
}, ['response']); }, ['response']);
@ -141,9 +141,9 @@ App::get('/v1/avatars/image')
->label('sdk.method', 'getImage') ->label('sdk.method', 'getImage')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-image.md') ->label('sdk.description', '/docs/references/avatars/get-image.md')
->param('url', '', function () { return new URL(); }, 'Image URL which you want to crop.') ->param('url', '', new URL(), 'Image URL which you want to crop.')
->param('width', 400, function () { return new Range(0, 2000); }, 'Resize preview image width, Pass an integer between 0 to 2000.', true) ->param('width', 400, new Range(0, 2000), 'Resize preview image width, Pass an integer between 0 to 2000.', true)
->param('height', 400, function () { return new Range(0, 2000); }, 'Resize preview image height, Pass an integer between 0 to 2000.', true) ->param('height', 400, new Range(0, 2000), 'Resize preview image height, Pass an integer between 0 to 2000.', true)
->action(function ($url, $width, $height, $response) { ->action(function ($url, $width, $height, $response) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -207,7 +207,7 @@ App::get('/v1/avatars/favicon')
->label('sdk.method', 'getFavicon') ->label('sdk.method', 'getFavicon')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-favicon.md') ->label('sdk.description', '/docs/references/avatars/get-favicon.md')
->param('url', '', function () { return new URL(); }, 'Website URL which you want to fetch the favicon from.') ->param('url', '', new URL(), 'Website URL which you want to fetch the favicon from.')
->action(function ($url, $response) { ->action(function ($url, $response) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -357,10 +357,10 @@ App::get('/v1/avatars/qr')
->label('sdk.method', 'getQR') ->label('sdk.method', 'getQR')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-qr.md') ->label('sdk.description', '/docs/references/avatars/get-qr.md')
->param('text', '', function () { return new Text(512); }, 'Plain text to be converted to QR code image.') ->param('text', '', new Text(512), 'Plain text to be converted to QR code image.')
->param('size', 400, function () { return new Range(0, 1000); }, 'QR code size. Pass an integer between 0 to 1000. Defaults to 400.', true) ->param('size', 400, new Range(0, 1000), 'QR code size. Pass an integer between 0 to 1000. Defaults to 400.', true)
->param('margin', 1, function () { return new Range(0, 10); }, 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true) ->param('margin', 1, new Range(0, 10), 'Margin from edge. Pass an integer between 0 to 10. Defaults to 1.', true)
->param('download', false, function () { return new Boolean(true); }, 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true) ->param('download', false, new Boolean(true), 'Return resulting image with \'Content-Disposition: attachment \' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.', true)
->action(function ($text, $size, $margin, $download, $response) { ->action(function ($text, $size, $margin, $download, $response) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -393,11 +393,11 @@ App::get('/v1/avatars/initials')
->label('sdk.method', 'getInitials') ->label('sdk.method', 'getInitials')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-initials.md') ->label('sdk.description', '/docs/references/avatars/get-initials.md')
->param('name', '', function () { return new Text(128); }, 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true) ->param('name', '', new Text(128), 'Full Name. When empty, current user name or email will be used. Max length: 128 chars.', true)
->param('width', 500, function () { return new Range(0, 2000); }, 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('width', 500, new Range(0, 2000), 'Image width. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('height', 500, function () { return new Range(0, 2000); }, 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true) ->param('height', 500, new Range(0, 2000), 'Image height. Pass an integer between 0 to 2000. Defaults to 100.', true)
->param('color', '', function () { return new HexColor(); }, 'Changes text color. By default a random color will be picked and stay will persistent to the given name.', true) ->param('color', '', new HexColor(), 'Changes text color. By default a random color will be picked and stay will persistent to the given name.', true)
->param('background', '', function () { return new HexColor(); }, 'Changes background color. By default a random color will be picked and stay will persistent to the given name.', true) ->param('background', '', new HexColor(), 'Changes background color. By default a random color will be picked and stay will persistent to the given name.', true)
->action(function ($name, $width, $height, $color, $background, $response, $user) { ->action(function ($name, $width, $height, $color, $background, $response, $user) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */

View file

@ -30,9 +30,9 @@ App::post('/v1/database/collections')
->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.method', 'createCollection') ->label('sdk.method', 'createCollection')
->label('sdk.description', '/docs/references/database/create-collection.md') ->label('sdk.description', '/docs/references/database/create-collection.md')
->param('name', '', function () { return new Text(128); }, 'Collection name. Max length: 128 chars.') ->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', false, ['projectDB']) ->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', false, ['projectDB'])
->action(function ($name, $read, $write, $rules, $response, $projectDB, $webhooks, $audits) { ->action(function ($name, $read, $write, $rules, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -106,10 +106,10 @@ App::get('/v1/database/collections')
->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.method', 'listCollections') ->label('sdk.method', 'listCollections')
->label('sdk.description', '/docs/references/database/list-collections.md') ->label('sdk.description', '/docs/references/database/list-collections.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 40000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 40000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -137,7 +137,7 @@ App::get('/v1/database/collections/:collectionId')
->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.method', 'getCollection') ->label('sdk.method', 'getCollection')
->label('sdk.description', '/docs/references/database/get-collection.md') ->label('sdk.description', '/docs/references/database/get-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.') ->param('collectionId', '', new UID(), 'Collection unique ID.')
->action(function ($collectionId, $response, $projectDB) { ->action(function ($collectionId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -159,7 +159,7 @@ App::get('/v1/database/collections/:collectionId')
// ->label('sdk.namespace', 'database') // ->label('sdk.namespace', 'database')
// ->label('sdk.method', 'getCollectionLogs') // ->label('sdk.method', 'getCollectionLogs')
// ->label('sdk.description', '/docs/references/database/get-collection-logs.md') // ->label('sdk.description', '/docs/references/database/get-collection-logs.md')
// ->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.') // ->param('collectionId', '', new UID(), 'Collection unique ID.')
// ->action( // ->action(
// function ($collectionId) use ($response, $register, $projectDB, $project) { // function ($collectionId) use ($response, $register, $projectDB, $project) {
// $collection = $projectDB->getDocument($collectionId, false); // $collection = $projectDB->getDocument($collectionId, false);
@ -225,10 +225,10 @@ App::put('/v1/database/collections/:collectionId')
->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.method', 'updateCollection') ->label('sdk.method', 'updateCollection')
->label('sdk.description', '/docs/references/database/update-collection.md') ->label('sdk.description', '/docs/references/database/update-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.') ->param('collectionId', '', new UID(), 'Collection unique ID.')
->param('name', null, function () { return new Text(128); }, 'Collection name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', true, ['projectDB']) ->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', true, ['projectDB'])
->action(function ($collectionId, $name, $read, $write, $rules, $response, $projectDB, $webhooks, $audits) { ->action(function ($collectionId, $name, $read, $write, $rules, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -301,7 +301,7 @@ App::delete('/v1/database/collections/:collectionId')
->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.method', 'deleteCollection') ->label('sdk.method', 'deleteCollection')
->label('sdk.description', '/docs/references/database/delete-collection.md') ->label('sdk.description', '/docs/references/database/delete-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.') ->param('collectionId', '', new UID(), 'Collection unique ID.')
->action(function ($collectionId, $response, $projectDB, $webhooks, $audits) { ->action(function ($collectionId, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -342,13 +342,13 @@ App::post('/v1/database/collections/:collectionId/documents')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.method', 'createDocument') ->label('sdk.method', 'createDocument')
->label('sdk.description', '/docs/references/database/create-document.md') ->label('sdk.description', '/docs/references/database/create-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).')
->param('data', [], function () { return new JSON(); }, 'Document data as JSON object.') ->param('data', [], new JSON(), 'Document data as JSON object.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('parentDocument', '', function () { return new UID(); }, 'Parent document unique ID. Use when you want your new document to be a child of a parent document.', true) ->param('parentDocument', '', new UID(), 'Parent document unique ID. Use when you want your new document to be a child of a parent document.', true)
->param('parentProperty', '', function () { return new Key(); }, 'Parent document property name. Use when you want your new document to be a child of a parent document.', true) ->param('parentProperty', '', new Key(), 'Parent document property name. Use when you want your new document to be a child of a parent document.', true)
->param('parentPropertyType', Document::SET_TYPE_ASSIGN, function () { return new WhiteList([Document::SET_TYPE_ASSIGN, Document::SET_TYPE_APPEND, Document::SET_TYPE_PREPEND], true); }, 'Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.', true) ->param('parentPropertyType', Document::SET_TYPE_ASSIGN, new WhiteList([Document::SET_TYPE_ASSIGN, Document::SET_TYPE_APPEND, Document::SET_TYPE_PREPEND], true), 'Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.', true)
->action(function ($collectionId, $data, $read, $write, $parentDocument, $parentProperty, $parentPropertyType, $response, $projectDB, $webhooks, $audits) { ->action(function ($collectionId, $data, $read, $write, $parentDocument, $parentProperty, $parentPropertyType, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -465,14 +465,14 @@ App::get('/v1/database/collections/:collectionId/documents')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.method', 'listDocuments') ->label('sdk.method', 'listDocuments')
->label('sdk.description', '/docs/references/database/list-documents.md') ->label('sdk.description', '/docs/references/database/list-documents.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).')
->param('filters', [], function () { return new ArrayList(new Text(128)); }, 'Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: \'name=John Doe\' or \'category.$id>=5bed2d152c362\'.', true) ->param('filters', [], new ArrayList(new Text(128)), 'Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: \'name=John Doe\' or \'category.$id>=5bed2d152c362\'.', true)
->param('limit', 25, function () { return new Range(0, 1000); }, 'Maximum number of documents to return in response. Use this value to manage pagination.', true) ->param('limit', 25, new Range(0, 1000), 'Maximum number of documents to return in response. Use this value to manage pagination.', true)
->param('offset', 0, function () { return new Range(0, 900000000); }, 'Offset value. Use this value to manage pagination.', true) ->param('offset', 0, new Range(0, 900000000), 'Offset value. Use this value to manage pagination.', true)
->param('orderField', '$id', function () { return new Text(128); }, 'Document field that results will be sorted by.', true) ->param('orderField', '$id', new Text(128), 'Document field that results will be sorted by.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['DESC', 'ASC'], true); }, 'Order direction. Possible values are DESC for descending order, or ASC for ascending order.', true) ->param('orderType', 'ASC', new WhiteList(['DESC', 'ASC'], true), 'Order direction. Possible values are DESC for descending order, or ASC for ascending order.', true)
->param('orderCast', 'string', function () { return new WhiteList(['int', 'string', 'date', 'time', 'datetime'], true); }, 'Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.', true) ->param('orderCast', 'string', new WhiteList(['int', 'string', 'date', 'time', 'datetime'], true), 'Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string.', true)
->param('search', '', function () { return new Text(256); }, 'Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars.', true)
->action(function ($collectionId, $filters, $limit, $offset, $orderField, $orderType, $orderCast, $search, $response, $projectDB) { ->action(function ($collectionId, $filters, $limit, $offset, $orderField, $orderType, $orderCast, $search, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -526,8 +526,8 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.method', 'getDocument') ->label('sdk.method', 'getDocument')
->label('sdk.description', '/docs/references/database/get-document.md') ->label('sdk.description', '/docs/references/database/get-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID.') ->param('documentId', null, new UID(), 'Document unique ID.')
->action(function ($collectionId, $documentId, $request, $response, $projectDB) { ->action(function ($collectionId, $documentId, $request, $response, $projectDB) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -575,11 +575,11 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.method', 'updateDocument') ->label('sdk.method', 'updateDocument')
->label('sdk.description', '/docs/references/database/update-document.md') ->label('sdk.description', '/docs/references/database/update-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID.') ->param('documentId', null, new UID(), 'Document unique ID.')
->param('data', [], function () { return new JSON(); }, 'Document data as JSON object.') ->param('data', [], new JSON(), 'Document data as JSON object.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->action(function ($collectionId, $documentId, $data, $read, $write, $response, $projectDB, $webhooks, $audits) { ->action(function ($collectionId, $documentId, $data, $read, $write, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -658,8 +658,8 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.method', 'deleteDocument') ->label('sdk.method', 'deleteDocument')
->label('sdk.description', '/docs/references/database/delete-document.md') ->label('sdk.description', '/docs/references/database/delete-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID.') ->param('documentId', null, new UID(), 'Document unique ID.')
->action(function ($collectionId, $documentId, $response, $projectDB, $webhooks, $audits) { ->action(function ($collectionId, $documentId, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */

View file

@ -28,12 +28,12 @@ App::post('/v1/functions')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'create') ->label('sdk.method', 'create')
->label('sdk.description', '/docs/references/functions/create-function.md') ->label('sdk.description', '/docs/references/functions/create-function.md')
->param('name', '', function () { return new Text(128); }, 'Function name. Max length: 128 chars.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.')
->param('env', '', function () { return new WhiteList(array_keys(Config::getParam('environments')), true); }, 'Execution enviornment.') ->param('env', '', new WhiteList(array_keys(Config::getParam('environments')), true), 'Execution enviornment.')
->param('vars', [], function () { return new Assoc();}, 'Key-value JSON object.', true) ->param('vars', [], new Assoc(), 'Key-value JSON object.', true)
->param('events', [], function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.', true) ->param('events', [], new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)), 'Events list.', true)
->param('schedule', '', function () { return new Cron(); }, 'Schedule CRON syntax.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
->param('timeout', 15, function () { return new Range(1, 900); }, 'Function maximum execution time in seconds.', true) ->param('timeout', 15, new Range(1, 900), 'Function maximum execution time in seconds.', true)
->action(function ($name, $env, $vars, $events, $schedule, $timeout, $response, $projectDB) { ->action(function ($name, $env, $vars, $events, $schedule, $timeout, $response, $projectDB) {
$function = $projectDB->createDocument([ $function = $projectDB->createDocument([
'$collection' => Database::SYSTEM_COLLECTION_FUNCTIONS, '$collection' => Database::SYSTEM_COLLECTION_FUNCTIONS,
@ -73,10 +73,10 @@ App::get('/v1/functions')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'list') ->label('sdk.method', 'list')
->label('sdk.description', '/docs/references/functions/list-functions.md') ->label('sdk.description', '/docs/references/functions/list-functions.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) {
$results = $projectDB->getCollection([ $results = $projectDB->getCollection([
'limit' => $limit, 'limit' => $limit,
@ -101,7 +101,7 @@ App::get('/v1/functions/:functionId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/functions/get-function.md') ->label('sdk.description', '/docs/references/functions/get-function.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->action(function ($functionId, $response, $projectDB) { ->action(function ($functionId, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -120,12 +120,12 @@ App::put('/v1/functions/:functionId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'update') ->label('sdk.method', 'update')
->label('sdk.description', '/docs/references/functions/update-function.md') ->label('sdk.description', '/docs/references/functions/update-function.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('name', '', function () { return new Text(128); }, 'Function name. Max length: 128 chars.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.')
->param('vars', [], function () { return new Assoc();}, 'Key-value JSON object.', true) ->param('vars', [], new Assoc(), 'Key-value JSON object.', true)
->param('events', [], function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)); }, 'Events list.', true) ->param('events', [], new ArrayList(new WhiteList(array_keys(Config::getParam('events')), true)), 'Events list.', true)
->param('schedule', '', function () { return new Cron(); }, 'Schedule CRON syntax.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true)
->param('timeout', 15, function () { return new Range(1, 900); }, 'Function maximum execution time in seconds.', true) ->param('timeout', 15, new Range(1, 900), 'Function maximum execution time in seconds.', true)
->action(function ($functionId, $name, $vars, $events, $schedule, $timeout, $response, $projectDB) { ->action(function ($functionId, $name, $vars, $events, $schedule, $timeout, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -162,8 +162,8 @@ App::patch('/v1/functions/:functionId/tag')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'updateTag') ->label('sdk.method', 'updateTag')
->label('sdk.description', '/docs/references/functions/update-tag.md') ->label('sdk.description', '/docs/references/functions/update-tag.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('tag', '', function () { return new UID(); }, 'Tag unique ID.') ->param('tag', '', new UID(), 'Tag unique ID.')
->action(function ($functionId, $tag, $response, $projectDB) { ->action(function ($functionId, $tag, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
$tag = $projectDB->getDocument($tag); $tag = $projectDB->getDocument($tag);
@ -200,7 +200,7 @@ App::delete('/v1/functions/:functionId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'delete') ->label('sdk.method', 'delete')
->label('sdk.description', '/docs/references/functions/delete-function.md') ->label('sdk.description', '/docs/references/functions/delete-function.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->action(function ($functionId, $response, $projectDB) { ->action(function ($functionId, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -223,10 +223,10 @@ App::post('/v1/functions/:functionId/tags')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'createTag') ->label('sdk.method', 'createTag')
->label('sdk.description', '/docs/references/functions/create-tag.md') ->label('sdk.description', '/docs/references/functions/create-tag.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('command', '', function () { return new Text('1028'); }, 'Code execution command.') ->param('command', '', new Text('1028'), 'Code execution command.')
->param('code', [], function () { return new File(); }, 'Gzip file containing your code.', false) ->param('code', [], new File(), 'Gzip file containing your code.', false)
// ->param('code', '', function () { return new Text(128); }, 'Code package. Use the '.APP_NAME.' code packager to create a deployable package file.') // ->param('code', '', new Text(128), 'Code package. Use the '.APP_NAME.' code packager to create a deployable package file.')
->action(function ($functionId, $command, $code, $request, $response, $projectDB, $usage) { ->action(function ($functionId, $command, $code, $request, $response, $projectDB, $usage) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -305,11 +305,11 @@ App::get('/v1/functions/:functionId/tags')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'listTags') ->label('sdk.method', 'listTags')
->label('sdk.description', '/docs/references/functions/list-tags.md') ->label('sdk.description', '/docs/references/functions/list-tags.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($functionId, $search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($functionId, $search, $limit, $offset, $orderType, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -341,8 +341,8 @@ App::get('/v1/functions/:functionId/tags/:tagId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'getTag') ->label('sdk.method', 'getTag')
->label('sdk.description', '/docs/references/functions/get-tag.md') ->label('sdk.description', '/docs/references/functions/get-tag.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('tagId', '', function () { return new UID(); }, 'Tag unique ID.') ->param('tagId', '', new UID(), 'Tag unique ID.')
->action(function ($functionId, $tagId, $response, $projectDB) { ->action(function ($functionId, $tagId, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -371,8 +371,8 @@ App::delete('/v1/functions/:functionId/tags/:tagId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'deleteTag') ->label('sdk.method', 'deleteTag')
->label('sdk.description', '/docs/references/functions/delete-tag.md') ->label('sdk.description', '/docs/references/functions/delete-tag.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('tagId', '', function () { return new UID(); }, 'Tag unique ID.') ->param('tagId', '', new UID(), 'Tag unique ID.')
->action(function ($functionId, $tagId, $response, $projectDB, $usage) { ->action(function ($functionId, $tagId, $response, $projectDB, $usage) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -413,8 +413,8 @@ App::post('/v1/functions/:functionId/executions')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'createExecution') ->label('sdk.method', 'createExecution')
->label('sdk.description', '/docs/references/functions/create-execution.md') ->label('sdk.description', '/docs/references/functions/create-execution.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('async', 1, function () { return new Range(0, 1); }, 'Execute code asynchronously. Pass 1 for true, 0 for false. Default value is 1.', true) ->param('async', 1, new Range(0, 1), 'Execute code asynchronously. Pass 1 for true, 0 for false. Default value is 1.', true)
->action(function ($functionId, $async, $response, $project, $projectDB) { ->action(function ($functionId, $async, $response, $project, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $project */ /** @var Appwrite\Database\Document $project */
@ -480,11 +480,11 @@ App::get('/v1/functions/:functionId/executions')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'listExecutions') ->label('sdk.method', 'listExecutions')
->label('sdk.description', '/docs/references/functions/list-executions.md') ->label('sdk.description', '/docs/references/functions/list-executions.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($functionId, $search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($functionId, $search, $limit, $offset, $orderType, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);
@ -516,8 +516,8 @@ App::get('/v1/functions/:functionId/executions/:executionId')
->label('sdk.namespace', 'functions') ->label('sdk.namespace', 'functions')
->label('sdk.method', 'getExecution') ->label('sdk.method', 'getExecution')
->label('sdk.description', '/docs/references/functions/get-execution.md') ->label('sdk.description', '/docs/references/functions/get-execution.md')
->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('executionId', '', function () { return new UID(); }, 'Execution unique ID.') ->param('executionId', '', new UID(), 'Execution unique ID.')
->action(function ($functionId, $executionId, $response, $projectDB) { ->action(function ($functionId, $executionId, $response, $projectDB) {
$function = $projectDB->getDocument($functionId); $function = $projectDB->getDocument($functionId);

View file

@ -27,17 +27,17 @@ App::post('/v1/projects')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'create') ->label('sdk.method', 'create')
->param('name', null, function () { return new Text(128); }, 'Project name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('description', '', function () { return new Text(256); }, 'Project description. Max length: 256 chars.', true) ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
->param('logo', '', function () { return new Text(1024); }, 'Project logo.', true) ->param('logo', '', new Text(1024), 'Project logo.', true)
->param('url', '', function () { return new URL(); }, 'Project URL.', true) ->param('url', '', new URL(), 'Project URL.', true)
->param('legalName', '', function () { return new Text(256); }, 'Project legal Name. Max length: 256 chars.', true) ->param('legalName', '', new Text(256), 'Project legal Name. Max length: 256 chars.', true)
->param('legalCountry', '', function () { return new Text(256); }, 'Project legal Country. Max length: 256 chars.', true) ->param('legalCountry', '', new Text(256), 'Project legal Country. Max length: 256 chars.', true)
->param('legalState', '', function () { return new Text(256); }, 'Project legal State. Max length: 256 chars.', true) ->param('legalState', '', new Text(256), 'Project legal State. Max length: 256 chars.', true)
->param('legalCity', '', function () { return new Text(256); }, 'Project legal City. Max length: 256 chars.', true) ->param('legalCity', '', new Text(256), 'Project legal City. Max length: 256 chars.', true)
->param('legalAddress', '', function () { return new Text(256); }, 'Project legal Address. Max length: 256 chars.', true) ->param('legalAddress', '', new Text(256), 'Project legal Address. Max length: 256 chars.', true)
->param('legalTaxId', '', function () { return new Text(256); }, 'Project legal Tax ID. Max length: 256 chars.', true) ->param('legalTaxId', '', new Text(256), 'Project legal Tax ID. Max length: 256 chars.', true)
->action(function ($name, $teamId, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $response, $consoleDB, $projectDB) { ->action(function ($name, $teamId, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $response, $consoleDB, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -92,10 +92,10 @@ App::get('/v1/projects')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'list') ->label('sdk.method', 'list')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $consoleDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -131,7 +131,7 @@ App::get('/v1/projects/:projectId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -160,8 +160,8 @@ App::get('/v1/projects/:projectId/usage')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getUsage') ->label('sdk.method', 'getUsage')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->param('range', 'last30', function () { return new WhiteList(['daily', 'monthly', 'last30', 'last90'], true); }, 'Date range.', true) ->param('range', 'last30', new WhiteList(['daily', 'monthly', 'last30', 'last90'], true), 'Date range.', true)
->action(function ($projectId, $range, $response, $consoleDB, $projectDB, $register) { ->action(function ($projectId, $range, $response, $consoleDB, $projectDB, $register) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -334,17 +334,17 @@ App::patch('/v1/projects/:projectId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'update') ->label('sdk.method', 'update')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->param('name', null, function () { return new Text(128); }, 'Project name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Project name. Max length: 128 chars.')
->param('description', '', function () { return new Text(256); }, 'Project description. Max length: 256 chars.', true) ->param('description', '', new Text(256), 'Project description. Max length: 256 chars.', true)
->param('logo', '', function () { return new Text(1024); }, 'Project logo.', true) ->param('logo', '', new Text(1024), 'Project logo.', true)
->param('url', '', function () { return new URL(); }, 'Project URL.', true) ->param('url', '', new URL(), 'Project URL.', true)
->param('legalName', '', function () { return new Text(256); }, 'Project legal name. Max length: 256 chars.', true) ->param('legalName', '', new Text(256), 'Project legal name. Max length: 256 chars.', true)
->param('legalCountry', '', function () { return new Text(256); }, 'Project legal country. Max length: 256 chars.', true) ->param('legalCountry', '', new Text(256), 'Project legal country. Max length: 256 chars.', true)
->param('legalState', '', function () { return new Text(256); }, 'Project legal state. Max length: 256 chars.', true) ->param('legalState', '', new Text(256), 'Project legal state. Max length: 256 chars.', true)
->param('legalCity', '', function () { return new Text(256); }, 'Project legal city. Max length: 256 chars.', true) ->param('legalCity', '', new Text(256), 'Project legal city. Max length: 256 chars.', true)
->param('legalAddress', '', function () { return new Text(256); }, 'Project legal address. Max length: 256 chars.', true) ->param('legalAddress', '', new Text(256), 'Project legal address. Max length: 256 chars.', true)
->param('legalTaxId', '', function () { return new Text(256); }, 'Project legal tax ID. Max length: 256 chars.', true) ->param('legalTaxId', '', new Text(256), 'Project legal tax ID. Max length: 256 chars.', true)
->action(function ($projectId, $name, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $response, $consoleDB) { ->action(function ($projectId, $name, $description, $logo, $url, $legalName, $legalCountry, $legalState, $legalCity, $legalAddress, $legalTaxId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -381,10 +381,10 @@ App::patch('/v1/projects/:projectId/oauth2')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updateOAuth2') ->label('sdk.method', 'updateOAuth2')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->param('provider', '', function () { return new WhiteList(\array_keys(Config::getParam('providers')), true); }, 'Provider Name', false) ->param('provider', '', new WhiteList(\array_keys(Config::getParam('providers')), true), 'Provider Name', false)
->param('appId', '', function () { return new Text(256); }, 'Provider app ID. Max length: 256 chars.', true) ->param('appId', '', new Text(256), 'Provider app ID. Max length: 256 chars.', true)
->param('secret', '', function () { return new text(512); }, 'Provider secret key. Max length: 512 chars.', true) ->param('secret', '', new text(512), 'Provider secret key. Max length: 512 chars.', true)
->action(function ($projectId, $provider, $appId, $secret, $response, $consoleDB) { ->action(function ($projectId, $provider, $appId, $secret, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -424,8 +424,8 @@ App::delete('/v1/projects/:projectId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'delete') ->label('sdk.method', 'delete')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->param('password', '', function () { return new UID(); }, 'Your user password for confirmation. Must be between 6 to 32 chars.') ->param('password', '', new UID(), 'Your user password for confirmation. Must be between 6 to 32 chars.')
->action(function ($projectId, $password, $response, $user, $consoleDB, $deletes) { ->action(function ($projectId, $password, $response, $user, $consoleDB, $deletes) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */
@ -473,13 +473,13 @@ App::post('/v1/projects/:projectId/webhooks')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'createWebhook') ->label('sdk.method', 'createWebhook')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, function () { return new Text(128); }, 'Webhook name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Webhook name. Max length: 128 chars.')
->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events'), true), true)); }, 'Events list.') ->param('events', null, new ArrayList(new WhiteList(array_keys(Config::getParam('events'), true), true)), 'Events list.')
->param('url', null, function () { return new URL(); }, 'Webhook URL.') ->param('url', null, new URL(), 'Webhook URL.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user. Max length: 256 chars.', true) ->param('httpUser', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true)
->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password. Max length: 256 chars.', true) ->param('httpPass', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true)
->action(function ($projectId, $name, $events, $url, $security, $httpUser, $httpPass, $response, $consoleDB) { ->action(function ($projectId, $name, $events, $url, $security, $httpUser, $httpPass, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -540,7 +540,7 @@ App::get('/v1/projects/:projectId/webhooks')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'listWebhooks') ->label('sdk.method', 'listWebhooks')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -574,8 +574,8 @@ App::get('/v1/projects/:projectId/webhooks/:webhookId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getWebhook') ->label('sdk.method', 'getWebhook')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.') ->param('webhookId', null, new UID(), 'Webhook unique ID.')
->action(function ($projectId, $webhookId, $response, $consoleDB) { ->action(function ($projectId, $webhookId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -608,14 +608,14 @@ App::put('/v1/projects/:projectId/webhooks/:webhookId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updateWebhook') ->label('sdk.method', 'updateWebhook')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.') ->param('webhookId', null, new UID(), 'Webhook unique ID.')
->param('name', null, function () { return new Text(128); }, 'Webhook name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Webhook name. Max length: 128 chars.')
->param('events', null, function () { return new ArrayList(new WhiteList(array_keys(Config::getParam('events'), true), true)); }, 'Events list.') ->param('events', null, new ArrayList(new WhiteList(array_keys(Config::getParam('events'), true), true)), 'Events list.')
->param('url', null, function () { return new URL(); }, 'Webhook URL.') ->param('url', null, new URL(), 'Webhook URL.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
->param('httpUser', '', function () { return new Text(256); }, 'Webhook HTTP user. Max length: 256 chars.', true) ->param('httpUser', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true)
->param('httpPass', '', function () { return new Text(256); }, 'Webhook HTTP password. Max length: 256 chars.', true) ->param('httpPass', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true)
->action(function ($projectId, $webhookId, $name, $events, $url, $security, $httpUser, $httpPass, $response, $consoleDB) { ->action(function ($projectId, $webhookId, $name, $events, $url, $security, $httpUser, $httpPass, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -666,8 +666,8 @@ App::delete('/v1/projects/:projectId/webhooks/:webhookId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'deleteWebhook') ->label('sdk.method', 'deleteWebhook')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('webhookId', null, function () { return new UID(); }, 'Webhook unique ID.') ->param('webhookId', null, new UID(), 'Webhook unique ID.')
->action(function ($projectId, $webhookId, $response, $consoleDB) { ->action(function ($projectId, $webhookId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -699,9 +699,9 @@ App::post('/v1/projects/:projectId/keys')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'createKey') ->label('sdk.method', 'createKey')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, function () { return new Text(128); }, 'Key name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
->param('scopes', null, function () { return new ArrayList(new WhiteList(Config::getParam('scopes'), true)); }, 'Key scopes list.') ->param('scopes', null, new ArrayList(new WhiteList(Config::getParam('scopes'), true)), 'Key scopes list.')
->action(function ($projectId, $name, $scopes, $response, $consoleDB) { ->action(function ($projectId, $name, $scopes, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -747,7 +747,7 @@ App::get('/v1/projects/:projectId/keys')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'listKeys') ->label('sdk.method', 'listKeys')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -767,8 +767,8 @@ App::get('/v1/projects/:projectId/keys/:keyId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getKey') ->label('sdk.method', 'getKey')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('keyId', null, function () { return new UID(); }, 'Key unique ID.') ->param('keyId', null, new UID(), 'Key unique ID.')
->action(function ($projectId, $keyId, $response, $consoleDB) { ->action(function ($projectId, $keyId, $response, $consoleDB) {
$project = $consoleDB->getDocument($projectId); $project = $consoleDB->getDocument($projectId);
@ -791,10 +791,10 @@ App::put('/v1/projects/:projectId/keys/:keyId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updateKey') ->label('sdk.method', 'updateKey')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('keyId', null, function () { return new UID(); }, 'Key unique ID.') ->param('keyId', null, new UID(), 'Key unique ID.')
->param('name', null, function () { return new Text(128); }, 'Key name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
->param('scopes', null, function () { return new ArrayList(new WhiteList(Config::getParam('scopes'), true)); }, 'Key scopes list') ->param('scopes', null, new ArrayList(new WhiteList(Config::getParam('scopes'), true)), 'Key scopes list')
->action(function ($projectId, $keyId, $name, $scopes, $response, $consoleDB) { ->action(function ($projectId, $keyId, $name, $scopes, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -829,8 +829,8 @@ App::delete('/v1/projects/:projectId/keys/:keyId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'deleteKey') ->label('sdk.method', 'deleteKey')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('keyId', null, function () { return new UID(); }, 'Key unique ID.') ->param('keyId', null, new UID(), 'Key unique ID.')
->action(function ($projectId, $keyId, $response, $consoleDB) { ->action(function ($projectId, $keyId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -862,16 +862,16 @@ App::post('/v1/projects/:projectId/tasks')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'createTask') ->label('sdk.method', 'createTask')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, function () { return new Text(128); }, 'Task name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Task name. Max length: 128 chars.')
->param('status', null, function () { return new WhiteList(['play', 'pause'], true); }, 'Task status.') ->param('status', null, new WhiteList(['play', 'pause'], true), 'Task status.')
->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') ->param('schedule', null, new Cron(), 'Task schedule CRON syntax.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
->param('httpMethod', '', function () { return new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT'], true); }, 'Task HTTP method.') ->param('httpMethod', '', new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT'], true), 'Task HTTP method.')
->param('httpUrl', '', function () { return new URL(); }, 'Task HTTP URL') ->param('httpUrl', '', new URL(), 'Task HTTP URL')
->param('httpHeaders', null, function () { return new ArrayList(new Text(256)); }, 'Task HTTP headers list.', true) ->param('httpHeaders', null, new ArrayList(new Text(256)), 'Task HTTP headers list.', true)
->param('httpUser', '', function () { return new Text(256); }, 'Task HTTP user. Max length: 256 chars.', true) ->param('httpUser', '', new Text(256), 'Task HTTP user. Max length: 256 chars.', true)
->param('httpPass', '', function () { return new Text(256); }, 'Task HTTP password. Max length: 256 chars.', true) ->param('httpPass', '', new Text(256), 'Task HTTP password. Max length: 256 chars.', true)
->action(function ($projectId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $consoleDB) { ->action(function ($projectId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -947,7 +947,7 @@ App::get('/v1/projects/:projectId/tasks')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'listTasks') ->label('sdk.method', 'listTasks')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -981,8 +981,8 @@ App::get('/v1/projects/:projectId/tasks/:taskId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getTask') ->label('sdk.method', 'getTask')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('taskId', null, function () { return new UID(); }, 'Task unique ID.') ->param('taskId', null, new UID(), 'Task unique ID.')
->action(function ($projectId, $taskId, $response, $consoleDB) { ->action(function ($projectId, $taskId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1015,17 +1015,17 @@ App::put('/v1/projects/:projectId/tasks/:taskId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updateTask') ->label('sdk.method', 'updateTask')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('taskId', null, function () { return new UID(); }, 'Task unique ID.') ->param('taskId', null, new UID(), 'Task unique ID.')
->param('name', null, function () { return new Text(128); }, 'Task name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Task name. Max length: 128 chars.')
->param('status', null, function () { return new WhiteList(['play', 'pause'], true); }, 'Task status.') ->param('status', null, new WhiteList(['play', 'pause'], true), 'Task status.')
->param('schedule', null, function () { return new Cron(); }, 'Task schedule CRON syntax.') ->param('schedule', null, new Cron(), 'Task schedule CRON syntax.')
->param('security', false, function () { return new Boolean(true); }, 'Certificate verification, false for disabled or true for enabled.') ->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
->param('httpMethod', '', function () { return new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT'], true); }, 'Task HTTP method.') ->param('httpMethod', '', new WhiteList(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS', 'TRACE', 'CONNECT'], true), 'Task HTTP method.')
->param('httpUrl', '', function () { return new URL(); }, 'Task HTTP URL.') ->param('httpUrl', '', new URL(), 'Task HTTP URL.')
->param('httpHeaders', null, function () { return new ArrayList(new Text(256)); }, 'Task HTTP headers list.', true) ->param('httpHeaders', null, new ArrayList(new Text(256)), 'Task HTTP headers list.', true)
->param('httpUser', '', function () { return new Text(256); }, 'Task HTTP user. Max length: 256 chars.', true) ->param('httpUser', '', new Text(256), 'Task HTTP user. Max length: 256 chars.', true)
->param('httpPass', '', function () { return new Text(256); }, 'Task HTTP password. Max length: 256 chars.', true) ->param('httpPass', '', new Text(256), 'Task HTTP password. Max length: 256 chars.', true)
->action(function ($projectId, $taskId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $consoleDB) { ->action(function ($projectId, $taskId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1088,8 +1088,8 @@ App::delete('/v1/projects/:projectId/tasks/:taskId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'deleteTask') ->label('sdk.method', 'deleteTask')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('taskId', null, function () { return new UID(); }, 'Task unique ID.') ->param('taskId', null, new UID(), 'Task unique ID.')
->action(function ($projectId, $taskId, $response, $consoleDB) { ->action(function ($projectId, $taskId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1121,12 +1121,12 @@ App::post('/v1/projects/:projectId/platforms')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'createPlatform') ->label('sdk.method', 'createPlatform')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('type', null, function () { return new WhiteList(['web', 'flutter-ios', 'flutter-android', 'ios', 'android', 'unity'], true); }, 'Platform type.') ->param('type', null, new WhiteList(['web', 'flutter-ios', 'flutter-android', 'ios', 'android', 'unity'], true), 'Platform type.')
->param('name', null, function () { return new Text(128); }, 'Platform name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.')
->param('key', '', function () { return 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', '', function () { return 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)
->param('hostname', '', function () { return new Text(256); }, 'Platform client hostname. Max length: 256 chars.', true) ->param('hostname', '', new Text(256), 'Platform client hostname. Max length: 256 chars.', true)
->action(function ($projectId, $type, $name, $key, $store, $hostname, $response, $consoleDB) { ->action(function ($projectId, $type, $name, $key, $store, $hostname, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1176,7 +1176,7 @@ App::get('/v1/projects/:projectId/platforms')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'listPlatforms') ->label('sdk.method', 'listPlatforms')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1198,8 +1198,8 @@ App::get('/v1/projects/:projectId/platforms/:platformId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getPlatform') ->label('sdk.method', 'getPlatform')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('platformId', null, function () { return new UID(); }, 'Platform unique ID.') ->param('platformId', null, new UID(), 'Platform unique ID.')
->action(function ($projectId, $platformId, $response, $consoleDB) { ->action(function ($projectId, $platformId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1225,12 +1225,12 @@ App::put('/v1/projects/:projectId/platforms/:platformId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updatePlatform') ->label('sdk.method', 'updatePlatform')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('platformId', null, function () { return new UID(); }, 'Platform unique ID.') ->param('platformId', null, new UID(), 'Platform unique ID.')
->param('name', null, function () { return new Text(128); }, 'Platform name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.')
->param('key', '', function () { return 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', '', function () { return 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)
->param('hostname', '', function () { return new Text(256); }, 'Platform client URL. Max length: 256 chars.', true) ->param('hostname', '', new Text(256), 'Platform client URL. Max length: 256 chars.', true)
->action(function ($projectId, $platformId, $name, $key, $store, $hostname, $response, $consoleDB) { ->action(function ($projectId, $platformId, $name, $key, $store, $hostname, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1268,8 +1268,8 @@ App::delete('/v1/projects/:projectId/platforms/:platformId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'deletePlatform') ->label('sdk.method', 'deletePlatform')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('platformId', null, function () { return new UID(); }, 'Platform unique ID.') ->param('platformId', null, new UID(), 'Platform unique ID.')
->action(function ($projectId, $platformId, $response, $consoleDB) { ->action(function ($projectId, $platformId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1301,8 +1301,8 @@ App::post('/v1/projects/:projectId/domains')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'createDomain') ->label('sdk.method', 'createDomain')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('domain', null, function () { return new DomainValidator(); }, 'Domain name.') ->param('domain', null, new DomainValidator(), 'Domain name.')
->action(function ($projectId, $domain, $response, $consoleDB) { ->action(function ($projectId, $domain, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1365,7 +1365,7 @@ App::get('/v1/projects/:projectId/domains')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'listDomains') ->label('sdk.method', 'listDomains')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.') ->param('projectId', '', new UID(), 'Project unique ID.')
->action(function ($projectId, $response, $consoleDB) { ->action(function ($projectId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1387,8 +1387,8 @@ App::get('/v1/projects/:projectId/domains/:domainId')
->label('scope', 'projects.read') ->label('scope', 'projects.read')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'getDomain') ->label('sdk.method', 'getDomain')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('domainId', null, function () { return new UID(); }, 'Domain unique ID.') ->param('domainId', null, new UID(), 'Domain unique ID.')
->action(function ($projectId, $domainId, $response, $consoleDB) { ->action(function ($projectId, $domainId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1414,8 +1414,8 @@ App::patch('/v1/projects/:projectId/domains/:domainId/verification')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'updateDomainVerification') ->label('sdk.method', 'updateDomainVerification')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('domainId', null, function () { return new UID(); }, 'Domain unique ID.') ->param('domainId', null, new UID(), 'Domain unique ID.')
->action(function ($projectId, $domainId, $response, $consoleDB) { ->action(function ($projectId, $domainId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */
@ -1472,8 +1472,8 @@ App::delete('/v1/projects/:projectId/domains/:domainId')
->label('scope', 'projects.write') ->label('scope', 'projects.write')
->label('sdk.namespace', 'projects') ->label('sdk.namespace', 'projects')
->label('sdk.method', 'deleteDomain') ->label('sdk.method', 'deleteDomain')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.') ->param('projectId', null, new UID(), 'Project unique ID.')
->param('domainId', null, function () { return new UID(); }, 'Domain unique ID.') ->param('domainId', null, new UID(), 'Domain unique ID.')
->action(function ($projectId, $domainId, $response, $consoleDB) { ->action(function ($projectId, $domainId, $response, $consoleDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $consoleDB */ /** @var Appwrite\Database\Database $consoleDB */

View file

@ -33,9 +33,9 @@ App::post('/v1/storage/files')
->label('sdk.description', '/docs/references/storage/create-file.md') ->label('sdk.description', '/docs/references/storage/create-file.md')
->label('sdk.consumes', 'multipart/form-data') ->label('sdk.consumes', 'multipart/form-data')
->label('sdk.methodType', 'upload') ->label('sdk.methodType', 'upload')
->param('file', [], function () { return new File(); }, 'Binary file.', false) ->param('file', [], new File(), 'Binary file.', false)
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->action(function ($file, $read, $write, $request, $response, $user, $projectDB, $webhooks, $audits, $usage) { ->action(function ($file, $read, $write, $request, $response, $user, $projectDB, $webhooks, $audits, $usage) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -167,10 +167,10 @@ App::get('/v1/storage/files')
->label('sdk.namespace', 'storage') ->label('sdk.namespace', 'storage')
->label('sdk.method', 'listFiles') ->label('sdk.method', 'listFiles')
->label('sdk.description', '/docs/references/storage/list-files.md') ->label('sdk.description', '/docs/references/storage/list-files.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -202,7 +202,7 @@ App::get('/v1/storage/files/:fileId')
->label('sdk.namespace', 'storage') ->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFile') ->label('sdk.method', 'getFile')
->label('sdk.description', '/docs/references/storage/get-file.md') ->label('sdk.description', '/docs/references/storage/get-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('fileId', '', new UID(), 'File unique ID.')
->action(function ($fileId, $response, $projectDB) { ->action(function ($fileId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -226,12 +226,12 @@ App::get('/v1/storage/files/:fileId/preview')
->label('sdk.description', '/docs/references/storage/get-file-preview.md') ->label('sdk.description', '/docs/references/storage/get-file-preview.md')
->label('sdk.response.type', 'image/*') ->label('sdk.response.type', 'image/*')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->param('fileId', '', function () { return new UID(); }, 'File unique ID') ->param('fileId', '', new UID(), 'File unique ID')
->param('width', 0, function () { return new Range(0, 4000); }, 'Resize preview image width, Pass an integer between 0 to 4000.', true) ->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true)
->param('height', 0, function () { return new Range(0, 4000); }, 'Resize preview image height, Pass an integer between 0 to 4000.', true) ->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true)
->param('quality', 100, function () { return new Range(0, 100); }, 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('quality', 100, new Range(0, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
->param('background', '', function () { return 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', '', function () { return 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)
->action(function ($fileId, $width, $height, $quality, $background, $output, $request, $response, $project, $projectDB) { ->action(function ($fileId, $width, $height, $quality, $background, $output, $request, $response, $project, $projectDB) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -352,7 +352,7 @@ App::get('/v1/storage/files/:fileId/download')
->label('sdk.description', '/docs/references/storage/get-file-download.md') ->label('sdk.description', '/docs/references/storage/get-file-download.md')
->label('sdk.response.type', '*') ->label('sdk.response.type', '*')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('fileId', '', new UID(), 'File unique ID.')
->action(function ($fileId, $response, $projectDB) { ->action(function ($fileId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -407,8 +407,8 @@ App::get('/v1/storage/files/:fileId/view')
->label('sdk.description', '/docs/references/storage/get-file-view.md') ->label('sdk.description', '/docs/references/storage/get-file-view.md')
->label('sdk.response.type', '*') ->label('sdk.response.type', '*')
->label('sdk.methodType', 'location') ->label('sdk.methodType', 'location')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('fileId', '', new UID(), 'File unique ID.')
->param('as', '', function () { return new WhiteList(['pdf', /*'html',*/ 'text'], true); }, 'Choose a file format to convert your file to. Currently you can only convert word and pdf files to pdf or txt. This option is currently experimental only, use at your own risk.', true) ->param('as', '', new WhiteList(['pdf', /*'html',*/ 'text'], true), 'Choose a file format to convert your file to. Currently you can only convert word and pdf files to pdf or txt. This option is currently experimental only, use at your own risk.', true)
->action(function ($fileId, $as, $response, $projectDB) { ->action(function ($fileId, $as, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -479,9 +479,9 @@ App::put('/v1/storage/files/:fileId')
->label('sdk.namespace', 'storage') ->label('sdk.namespace', 'storage')
->label('sdk.method', 'updateFile') ->label('sdk.method', 'updateFile')
->label('sdk.description', '/docs/references/storage/update-file.md') ->label('sdk.description', '/docs/references/storage/update-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('fileId', '', new UID(), 'File unique ID.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('read', [], new ArrayList(new Text(64)), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.') ->param('write', [], new ArrayList(new Text(64)), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->action(function ($fileId, $read, $write, $response, $projectDB, $webhooks, $audits) { ->action(function ($fileId, $read, $write, $response, $projectDB, $webhooks, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -527,7 +527,7 @@ App::delete('/v1/storage/files/:fileId')
->label('sdk.namespace', 'storage') ->label('sdk.namespace', 'storage')
->label('sdk.method', 'deleteFile') ->label('sdk.method', 'deleteFile')
->label('sdk.description', '/docs/references/storage/delete-file.md') ->label('sdk.description', '/docs/references/storage/delete-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.') ->param('fileId', '', new UID(), 'File unique ID.')
->action(function ($fileId, $response, $projectDB, $webhooks, $audits, $usage) { ->action(function ($fileId, $response, $projectDB, $webhooks, $audits, $usage) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -573,8 +573,8 @@ App::delete('/v1/storage/files/:fileId')
// ->label('sdk.namespace', 'storage') // ->label('sdk.namespace', 'storage')
// ->label('sdk.method', 'getFileScan') // ->label('sdk.method', 'getFileScan')
// ->label('sdk.hide', true) // ->label('sdk.hide', true)
// ->param('fileId', '', function () { return new UID(); }, 'File unique ID.') // ->param('fileId', '', new UID(), 'File unique ID.')
// ->param('storage', 'files', function () { return new WhiteList(['files']);}) // ->param('storage', 'files', new WhiteList(['files']);})
// ->action( // ->action(
// function ($fileId, $storage) use ($response, $request, $projectDB) { // function ($fileId, $storage) use ($response, $request, $projectDB) {
// $file = $projectDB->getDocument($fileId); // $file = $projectDB->getDocument($fileId);

View file

@ -26,8 +26,8 @@ App::post('/v1/teams')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'create') ->label('sdk.method', 'create')
->label('sdk.description', '/docs/references/teams/create-team.md') ->label('sdk.description', '/docs/references/teams/create-team.md')
->param('name', null, function () { return new Text(128); }, 'Team name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Team name. Max length: 128 chars.')
->param('roles', ['owner'], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions).', true) ->param('roles', ['owner'], new ArrayList(new Text(128)), 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions).', true)
->action(function ($name, $roles, $response, $user, $projectDB, $mode) { ->action(function ($name, $roles, $response, $user, $projectDB, $mode) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Document $user */ /** @var Appwrite\Database\Document $user */
@ -93,10 +93,10 @@ App::get('/v1/teams')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'list') ->label('sdk.method', 'list')
->label('sdk.description', '/docs/references/teams/list-teams.md') ->label('sdk.description', '/docs/references/teams/list-teams.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -124,7 +124,7 @@ App::get('/v1/teams/:teamId')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/teams/get-team.md') ->label('sdk.description', '/docs/references/teams/get-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->action(function ($teamId, $response, $projectDB) { ->action(function ($teamId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -146,8 +146,8 @@ App::put('/v1/teams/:teamId')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'update') ->label('sdk.method', 'update')
->label('sdk.description', '/docs/references/teams/update-team.md') ->label('sdk.description', '/docs/references/teams/update-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('name', null, function () { return new Text(128); }, 'Team name. Max length: 128 chars.') ->param('name', null, new Text(128), 'Team name. Max length: 128 chars.')
->action(function ($teamId, $name, $response, $projectDB) { ->action(function ($teamId, $name, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -177,7 +177,7 @@ App::delete('/v1/teams/:teamId')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'delete') ->label('sdk.method', 'delete')
->label('sdk.description', '/docs/references/teams/delete-team.md') ->label('sdk.description', '/docs/references/teams/delete-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->action(function ($teamId, $response, $projectDB) { ->action(function ($teamId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -218,10 +218,10 @@ App::post('/v1/teams/:teamId/memberships')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'createMembership') ->label('sdk.method', 'createMembership')
->label('sdk.description', '/docs/references/teams/create-team-membership.md') ->label('sdk.description', '/docs/references/teams/create-team-membership.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('email', '', function () { return new Email(); }, 'New team member email.') ->param('email', '', new Email(), 'New team member email.')
->param('name', '', function () { return new Text(128); }, 'New team member name. Max length: 128 chars.', true) ->param('name', '', new Text(128), 'New team member name. Max length: 128 chars.', true)
->param('roles', [], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).') ->param('roles', [], new ArrayList(new Text(128)), 'Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).')
->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients']) // TODO add our own built-in confirm page ->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients']) // TODO add our own built-in confirm page
->action(function ($teamId, $email, $name, $roles, $url, $response, $project, $user, $projectDB, $locale, $audits, $mails, $mode) { ->action(function ($teamId, $email, $name, $roles, $url, $response, $project, $user, $projectDB, $locale, $audits, $mails, $mode) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -415,11 +415,11 @@ App::get('/v1/teams/:teamId/memberships')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'getMemberships') ->label('sdk.method', 'getMemberships')
->label('sdk.description', '/docs/references/teams/get-team-members.md') ->label('sdk.description', '/docs/references/teams/get-team-members.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($teamId, $search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($teamId, $search, $limit, $offset, $orderType, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -474,10 +474,10 @@ App::patch('/v1/teams/:teamId/memberships/:inviteId/status')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateMembershipStatus') ->label('sdk.method', 'updateMembershipStatus')
->label('sdk.description', '/docs/references/teams/update-team-membership-status.md') ->label('sdk.description', '/docs/references/teams/update-team-membership-status.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('inviteId', '', function () { return new UID(); }, 'Invite unique ID.') ->param('inviteId', '', new UID(), 'Invite unique ID.')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->param('secret', '', function () { return new Text(256); }, 'Secret key.') ->param('secret', '', new Text(256), 'Secret key.')
->action(function ($teamId, $inviteId, $userId, $secret, $request, $response, $user, $projectDB, $audits) { ->action(function ($teamId, $inviteId, $userId, $secret, $request, $response, $user, $projectDB, $audits) {
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
@ -604,8 +604,8 @@ App::delete('/v1/teams/:teamId/memberships/:inviteId')
->label('sdk.namespace', 'teams') ->label('sdk.namespace', 'teams')
->label('sdk.method', 'deleteMembership') ->label('sdk.method', 'deleteMembership')
->label('sdk.description', '/docs/references/teams/delete-team-membership.md') ->label('sdk.description', '/docs/references/teams/delete-team-membership.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.') ->param('teamId', '', new UID(), 'Team unique ID.')
->param('inviteId', '', function () { return new UID(); }, 'Invite unique ID.') ->param('inviteId', '', new UID(), 'Invite unique ID.')
->action(function ($teamId, $inviteId, $response, $projectDB, $audits) { ->action(function ($teamId, $inviteId, $response, $projectDB, $audits) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */

View file

@ -26,9 +26,9 @@ App::post('/v1/users')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'create') ->label('sdk.method', 'create')
->label('sdk.description', '/docs/references/users/create-user.md') ->label('sdk.description', '/docs/references/users/create-user.md')
->param('email', '', function () { return new Email(); }, 'User email.') ->param('email', '', new Email(), 'User email.')
->param('password', '', function () { return new Password(); }, 'User password. Must be between 6 to 32 chars.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.')
->param('name', '', function () { return new Text(128); }, 'User name. Max length: 128 chars.', true) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true)
->action(function ($email, $password, $name, $response, $projectDB) { ->action(function ($email, $password, $name, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -96,10 +96,10 @@ App::get('/v1/users')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'list') ->label('sdk.method', 'list')
->label('sdk.description', '/docs/references/users/list-users.md') ->label('sdk.description', '/docs/references/users/list-users.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results. Max length: 256 chars.', true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->param('limit', 25, function () { return new Range(0, 100); }, 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('limit', 25, new Range(0, 100), 'Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true) ->param('offset', 0, new Range(0, 2000), 'Results offset. The default value is 0. Use this param to manage pagination.', true)
->param('orderType', 'ASC', function () { return new WhiteList(['ASC', 'DESC'], true); }, 'Order result by ASC or DESC order.', true) ->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) { ->action(function ($search, $limit, $offset, $orderType, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -152,7 +152,7 @@ App::get('/v1/users/:userId')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->label('sdk.description', '/docs/references/users/get-user.md') ->label('sdk.description', '/docs/references/users/get-user.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->action(function ($userId, $response, $projectDB) { ->action(function ($userId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -195,7 +195,7 @@ App::get('/v1/users/:userId/prefs')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'getPrefs') ->label('sdk.method', 'getPrefs')
->label('sdk.description', '/docs/references/users/get-user-prefs.md') ->label('sdk.description', '/docs/references/users/get-user-prefs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->action(function ($userId, $response, $projectDB) { ->action(function ($userId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -226,7 +226,7 @@ App::get('/v1/users/:userId/sessions')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'getSessions') ->label('sdk.method', 'getSessions')
->label('sdk.description', '/docs/references/users/get-user-sessions.md') ->label('sdk.description', '/docs/references/users/get-user-sessions.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->action(function ($userId, $response, $projectDB, $locale, $geodb) { ->action(function ($userId, $response, $projectDB, $locale, $geodb) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -292,7 +292,7 @@ App::get('/v1/users/:userId/logs')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'getLogs') ->label('sdk.method', 'getLogs')
->label('sdk.description', '/docs/references/users/get-user-logs.md') ->label('sdk.description', '/docs/references/users/get-user-logs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->action(function ($userId, $response, $register, $project, $projectDB, $locale, $geodb) { ->action(function ($userId, $response, $register, $project, $projectDB, $locale, $geodb) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Utopia\Registry\Registry $register */ /** @var Utopia\Registry\Registry $register */
@ -377,8 +377,8 @@ App::patch('/v1/users/:userId/status')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'updateStatus') ->label('sdk.method', 'updateStatus')
->label('sdk.description', '/docs/references/users/update-user-status.md') ->label('sdk.description', '/docs/references/users/update-user-status.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->param('status', '', function () { return new WhiteList([Auth::USER_STATUS_ACTIVATED, Auth::USER_STATUS_BLOCKED, Auth::USER_STATUS_UNACTIVATED], true); }, 'User Status code. To activate the user pass '.Auth::USER_STATUS_ACTIVATED.', to block the user pass '.Auth::USER_STATUS_BLOCKED.' and for disabling the user pass '.Auth::USER_STATUS_UNACTIVATED) ->param('status', '', new WhiteList([Auth::USER_STATUS_ACTIVATED, Auth::USER_STATUS_BLOCKED, Auth::USER_STATUS_UNACTIVATED], true), 'User Status code. To activate the user pass '.Auth::USER_STATUS_ACTIVATED.', to block the user pass '.Auth::USER_STATUS_BLOCKED.' and for disabling the user pass '.Auth::USER_STATUS_UNACTIVATED)
->action(function ($userId, $status, $response, $projectDB) { ->action(function ($userId, $status, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -427,8 +427,8 @@ App::patch('/v1/users/:userId/prefs')
->label('sdk.namespace', 'users') ->label('sdk.namespace', 'users')
->label('sdk.method', 'updatePrefs') ->label('sdk.method', 'updatePrefs')
->label('sdk.description', '/docs/references/users/update-user-prefs.md') ->label('sdk.description', '/docs/references/users/update-user-prefs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->param('prefs', '', function () { return new Assoc();}, 'Prefs key-value JSON object.') ->param('prefs', '', new Assoc(), 'Prefs key-value JSON object.')
->action(function ($userId, $prefs, $response, $projectDB) { ->action(function ($userId, $prefs, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -471,8 +471,8 @@ App::delete('/v1/users/:userId/sessions/:sessionId')
->label('sdk.method', 'deleteSession') ->label('sdk.method', 'deleteSession')
->label('sdk.description', '/docs/references/users/delete-user-session.md') ->label('sdk.description', '/docs/references/users/delete-user-session.md')
->label('abuse-limit', 100) ->label('abuse-limit', 100)
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->param('sessionId', null, function () { return new UID(); }, 'User unique session ID.') ->param('sessionId', null, new UID(), 'User unique session ID.')
->action(function ($userId, $sessionId, $response, $projectDB) { ->action(function ($userId, $sessionId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */
@ -505,7 +505,7 @@ App::delete('/v1/users/:userId/sessions')
->label('sdk.method', 'deleteSessions') ->label('sdk.method', 'deleteSessions')
->label('sdk.description', '/docs/references/users/delete-user-sessions.md') ->label('sdk.description', '/docs/references/users/delete-user-sessions.md')
->label('abuse-limit', 100) ->label('abuse-limit', 100)
->param('userId', '', function () { return new UID(); }, 'User unique ID.') ->param('userId', '', new UID(), 'User unique ID.')
->action(function ($userId, $response, $projectDB) { ->action(function ($userId, $response, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */

View file

@ -301,7 +301,7 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) {
/** @var Exception $error */ /** @var Exception $error */
/** @var Utopia\App $utopia */ /** @var Utopia\App $utopia */
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */
/** @var Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Utopia\View $layout */ /** @var Utopia\View $layout */
/** @var Appwrite\Database\Document $project */ /** @var Appwrite\Database\Document $project */

View file

@ -18,9 +18,9 @@ App::get('/v1/mock/tests/foo')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->label('sdk.description', 'Mock a get request for SDK tests') ->label('sdk.description', 'Mock a get request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -32,9 +32,9 @@ App::post('/v1/mock/tests/foo')
->label('sdk.method', 'post') ->label('sdk.method', 'post')
->label('sdk.description', 'Mock a post request for SDK tests') ->label('sdk.description', 'Mock a post request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -46,9 +46,9 @@ App::patch('/v1/mock/tests/foo')
->label('sdk.method', 'patch') ->label('sdk.method', 'patch')
->label('sdk.description', 'Mock a get request for SDK tests') ->label('sdk.description', 'Mock a get request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -60,9 +60,9 @@ App::put('/v1/mock/tests/foo')
->label('sdk.method', 'put') ->label('sdk.method', 'put')
->label('sdk.description', 'Mock a put request for SDK tests') ->label('sdk.description', 'Mock a put request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -74,9 +74,9 @@ App::delete('/v1/mock/tests/foo')
->label('sdk.method', 'delete') ->label('sdk.method', 'delete')
->label('sdk.description', 'Mock a delete request for SDK tests') ->label('sdk.description', 'Mock a delete request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -88,9 +88,9 @@ App::get('/v1/mock/tests/bar')
->label('sdk.method', 'get') ->label('sdk.method', 'get')
->label('sdk.description', 'Mock a get request for SDK tests') ->label('sdk.description', 'Mock a get request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -102,9 +102,9 @@ App::post('/v1/mock/tests/bar')
->label('sdk.method', 'post') ->label('sdk.method', 'post')
->label('sdk.description', 'Mock a post request for SDK tests') ->label('sdk.description', 'Mock a post request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -116,9 +116,9 @@ App::patch('/v1/mock/tests/bar')
->label('sdk.method', 'patch') ->label('sdk.method', 'patch')
->label('sdk.description', 'Mock a get request for SDK tests') ->label('sdk.description', 'Mock a get request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -130,9 +130,9 @@ App::put('/v1/mock/tests/bar')
->label('sdk.method', 'put') ->label('sdk.method', 'put')
->label('sdk.description', 'Mock a put request for SDK tests') ->label('sdk.description', 'Mock a put request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -144,9 +144,9 @@ App::delete('/v1/mock/tests/bar')
->label('sdk.method', 'delete') ->label('sdk.method', 'delete')
->label('sdk.description', 'Mock a delete request for SDK tests') ->label('sdk.description', 'Mock a delete request for SDK tests')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->action(function ($x, $y, $z) { ->action(function ($x, $y, $z) {
}); });
@ -159,10 +159,10 @@ App::post('/v1/mock/tests/general/upload')
->label('sdk.description', 'Mock a delete request for SDK tests') ->label('sdk.description', 'Mock a delete request for SDK tests')
->label('sdk.consumes', 'multipart/form-data') ->label('sdk.consumes', 'multipart/form-data')
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('x', '', function () { return new Text(100); }, 'Sample string param') ->param('x', '', new Text(100), 'Sample string param')
->param('y', '', function () { return new Numeric(); }, 'Sample numeric param') ->param('y', '', new Numeric(), 'Sample numeric param')
->param('z', null, function () { return new ArrayList(new Text(256)); }, 'Sample array param') ->param('z', null, new ArrayList(new Text(256)), 'Sample array param')
->param('file', [], function () { return new File(); }, 'Sample file param', false) ->param('file', [], new File(), 'Sample file param', false)
->action(function ($x, $y, $z, $file, $request) { ->action(function ($x, $y, $z, $file, $request) {
/** @var Utopia\Swoole\Request $request */ /** @var Utopia\Swoole\Request $request */
@ -266,10 +266,10 @@ App::get('/v1/mock/tests/general/oauth2')
->label('scope', 'public') ->label('scope', 'public')
->label('docs', false) ->label('docs', false)
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('client_id', '', function () { return new Text(100); }, 'OAuth2 Client ID.') ->param('client_id', '', new Text(100), 'OAuth2 Client ID.')
->param('redirect_uri', '', function () { return new Host(['localhost']); }, 'OAuth2 Redirect URI.') // Important to deny an open redirect attack ->param('redirect_uri', '', new Host(['localhost']), 'OAuth2 Redirect URI.') // Important to deny an open redirect attack
->param('scope', '', function () { return new Text(100); }, 'OAuth2 scope list.') ->param('scope', '', new Text(100), 'OAuth2 scope list.')
->param('state', '', function () { return new Text(1024); }, 'OAuth2 state.') ->param('state', '', new Text(1024), 'OAuth2 state.')
->action(function ($clientId, $redirectURI, $scope, $state, $response) { ->action(function ($clientId, $redirectURI, $scope, $state, $response) {
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
@ -282,10 +282,10 @@ App::get('/v1/mock/tests/general/oauth2/token')
->label('scope', 'public') ->label('scope', 'public')
->label('docs', false) ->label('docs', false)
->label('sdk.mock', true) ->label('sdk.mock', true)
->param('client_id', '', function () { return new Text(100); }, 'OAuth2 Client ID.') ->param('client_id', '', new Text(100), 'OAuth2 Client ID.')
->param('redirect_uri', '', function () { return new Host(['localhost']); }, 'OAuth2 Redirect URI.') ->param('redirect_uri', '', new Host(['localhost']), 'OAuth2 Redirect URI.')
->param('client_secret', '', function () { return new Text(100); }, 'OAuth2 scope list.') ->param('client_secret', '', new Text(100), 'OAuth2 scope list.')
->param('code', '', function () { return new Text(100); }, 'OAuth2 state.') ->param('code', '', new Text(100), 'OAuth2 state.')
->action(function ($clientId, $redirectURI, $clientSecret, $code, $response) { ->action(function ($clientId, $redirectURI, $clientSecret, $code, $response) {
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
@ -309,7 +309,7 @@ App::get('/v1/mock/tests/general/oauth2/user')
->groups(['mock']) ->groups(['mock'])
->label('scope', 'public') ->label('scope', 'public')
->label('docs', false) ->label('docs', false)
->param('token', '', function () { return new Text(100); }, 'OAuth2 Access Token.') ->param('token', '', new Text(100), 'OAuth2 Access Token.')
->action(function ($token, $response) { ->action(function ($token, $response) {
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */

View file

@ -211,7 +211,7 @@ App::get('/console/database/collection')
->groups(['web', 'console']) ->groups(['web', 'console'])
->label('permission', 'public') ->label('permission', 'public')
->label('scope', 'console') ->label('scope', 'console')
->param('id', '', function () { return new UID(); }, 'Collection unique ID.') ->param('id', '', new UID(), 'Collection unique ID.')
->action(function ($id, $response, $layout, $projectDB) { ->action(function ($id, $response, $layout, $projectDB) {
/** @var Utopia\Response $response */ /** @var Utopia\Response $response */
/** @var Utopia\View $layout */ /** @var Utopia\View $layout */
@ -247,7 +247,7 @@ App::get('/console/database/document')
->groups(['web', 'console']) ->groups(['web', 'console'])
->label('permission', 'public') ->label('permission', 'public')
->label('scope', 'console') ->label('scope', 'console')
->param('collection', '', function () { return new UID(); }, 'Collection unique ID.') ->param('collection', '', new UID(), 'Collection unique ID.')
->action(function ($collection, $layout, $projectDB) { ->action(function ($collection, $layout, $projectDB) {
/** @var Utopia\View $layout */ /** @var Utopia\View $layout */
/** @var Appwrite\Database\Database $projectDB */ /** @var Appwrite\Database\Database $projectDB */

View file

@ -184,9 +184,9 @@ App::get('/open-api-2.json')
->groups(['web', 'home']) ->groups(['web', 'home'])
->label('scope', 'public') ->label('scope', 'public')
->label('docs', false) ->label('docs', false)
->param('platform', APP_PLATFORM_CLIENT, function () {return new WhiteList([APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER, APP_PLATFORM_CONSOLE], true);}, 'Choose target platform.', true) ->param('platform', APP_PLATFORM_CLIENT, new WhiteList([APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER, APP_PLATFORM_CONSOLE], true), 'Choose target platform.', true)
->param('extensions', 0, function () {return new Range(0, 1);}, 'Show extra data.', true) ->param('extensions', 0, new Range(0, 1), 'Show extra data.', true)
->param('tests', 0, function () {return new Range(0, 1);}, 'Include only test services.', true) ->param('tests', 0, new Range(0, 1), 'Include only test services.', true)
->action(function ($platform, $extensions, $tests, $utopia, $request, $response) { ->action(function ($platform, $extensions, $tests, $utopia, $request, $response) {
/** @var Utopia\App $utopia */ /** @var Utopia\App $utopia */
/** @var Utopia\Request $request */ /** @var Utopia\Request $request */