1
0
Fork 0
mirror of synced 2024-05-20 20:52:36 +12:00

Modes routes docs to md files

This commit is contained in:
eldadfux 2019-10-08 10:09:35 +03:00
parent 9226568bb0
commit cad690cf8b
10 changed files with 64 additions and 58 deletions

View file

@ -1,6 +1,6 @@
# Version 0.3.0 (PRE-RELEASE)
# Version 0.3.0 (PRE-RELEASE) - PLANNED
## Planned Issues
## Features
* Added 7 new locales for locale service and email templates (af, ar, cz, hu, lt, no, ru, si, sv, ta, vi, zh-cn, zh-tw)
* New users service routes to allow updates pref and name update
@ -11,6 +11,10 @@
* Allow electron apps to not pass origin header
* New OAuth adapters (Amazon, Dropbox, Microsoft, Slack, VK)
## Breaking Changs
* deleteUsersSession method name changed to deleteUserSession in all SDKs for better consistency
# Version 0.2.0 (PRE-RELEASE)
## Features

View file

@ -24,7 +24,7 @@ $utopia->post('/v1/auth/register')
->label('scope', 'auth')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'register')
->label('sdk.description', '/docs/refernces/register.md')
->label('sdk.description', '/docs/references/auth/register.md')
->label('sdk.cookies', true)
->label('abuse-limit', 10)
->param('email', '', function () { return new Email(); }, 'Account email')
@ -190,7 +190,7 @@ $utopia->post('/v1/auth/register/confirm')
->label('scope', 'public')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'confirm')
->label('sdk.description', '/docs/refernces/confirm.md')
->label('sdk.description', '/docs/references/auth/confirm.md')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},userId:{param-userId}')
->param('userId', '', function () { return new UID(); }, 'User unique ID')
@ -240,7 +240,7 @@ $utopia->post('/v1/auth/register/confirm/resend')
->label('scope', 'account')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'confirmResend')
->label('sdk.description', '/docs/refernces/confirm-resend.md')
->label('sdk.description', '/docs/references/auth/confirm-resend.md')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},userId:{param-userId}')
->param('confirm', '', function () use ($clients) { return new Host($clients); }, 'Confirmation URL to redirect user to your app after confirm token has been sent to user email.')
@ -304,7 +304,7 @@ $utopia->post('/v1/auth/login')
->label('scope', 'auth')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'login')
->label('sdk.description', '/docs/refernces/login.md')
->label('sdk.description', '/docs/references/auth/login.md')
->label('sdk.cookies', true)
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}')
@ -389,7 +389,7 @@ $utopia->delete('/v1/auth/logout')
->label('scope', 'account')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'logout')
->label('sdk.description', '/docs/refernces/logout.md')
->label('sdk.description', '/docs/references/auth/logout.md')
->label('abuse-limit', 100)
->action(
function () use ($response, $request, $user, $projectDB, $audit, $webhook) {
@ -420,7 +420,7 @@ $utopia->delete('/v1/auth/logout/:id')
->label('scope', 'account')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'logoutBySession')
->label('sdk.description', '/docs/refernces/logout-by-session.md')
->label('sdk.description', '/docs/references/auth/logout-by-session.md')
->label('abuse-limit', 100)
->param('id', null, function () { return new UID(); }, 'User specific session unique ID number. if 0 delete all sessions.')
->action(
@ -453,7 +453,7 @@ $utopia->post('/v1/auth/recovery')
->label('scope', 'auth')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'recovery')
->label('sdk.description', '/docs/refernces/recovery.md')
->label('sdk.description', '/docs/references/auth/recovery.md')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () { return new Email(); }, 'User account email address.')
@ -533,7 +533,7 @@ $utopia->put('/v1/auth/recovery/reset')
->label('scope', 'auth')
->label('sdk.namespace', 'auth')
->label('sdk.method', 'recoveryReset')
->label('sdk.description', '/docs/refernces/recovery-reset.md')
->label('sdk.description', '/docs/references/auth/recovery-reset.md')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},userId:{param-userId}')
->param('userId', '', function () { return new UID(); }, 'User account email address.')

View file

@ -94,7 +94,7 @@ $utopia->get('/v1/avatars/credit-cards/:code')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getCreditCard')
->label('sdk.description', 'Need to display your users with your billing method or there payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.')
->label('sdk.description', '/docs/references/avatars/get-credit-cards.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('credit-cards', $code, $width, $height, $quality);
});
@ -107,7 +107,7 @@ $utopia->get('/v1/avatars/browsers/:code')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getBrowser')
->label('sdk.description', 'You can use this endpoint to show different browser icons to your users, The code argument receives the browser code as appear in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings.')
->label('sdk.description', '/docs/references/avatars/get-browser.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('browsers', $code, $width, $height, $quality);
});
@ -120,7 +120,7 @@ $utopia->get('/v1/avatars/flags/:code')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFlag')
->label('sdk.description', 'You can use this endpoint to show different country flags icons to your users, The code argument receives the a 2 letter country code. Use width, height and quality arguments to change the output settings.')
->label('sdk.description', '/docs/references/avatars/get-flag.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('flags', $code, $width, $height, $quality);
});
@ -132,7 +132,7 @@ $utopia->get('/v1/avatars/image')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getImage')
->label('sdk.description', 'Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in cases, you want to make sure a 3rd party image is properly served using a TLS protocol.')
->label('sdk.description', '/docs/references/avatars/get-image.md')
->action(
function ($url, $width, $height) use ($response, $request, $version) {
$quality = 80;
@ -197,7 +197,7 @@ $utopia->get('/v1/avatars/favicon')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFavicon')
->label('sdk.description', 'Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL.')
->label('sdk.description', '/docs/references/avatars/get-favicon.md')
->action(
function ($url) use ($response, $request, $version) {
$width = 56;
@ -349,7 +349,7 @@ $utopia->get('/v1/avatars/qr')
->label('scope', 'avatars.read')
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getQR')
->label('sdk.description', 'Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.')
->label('sdk.description', '/docs/references/avatars/get-qr.md')
->action(
function ($text, $size, $margin, $download) use ($response) {
$renderer = new ImageRenderer(

View file

@ -26,7 +26,7 @@ $utopia->get('/v1/database')
->label('scope', 'collections.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'listCollections')
->label('sdk.description', 'Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. [Learn more about different API modes](/docs/modes).')
->label('sdk.description', '/docs/references/database/list-collections.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', 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('offset', 0, function () { return new Range(0, 40000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true)
@ -73,7 +73,7 @@ $utopia->get('/v1/database/:collectionId')
->label('scope', 'collections.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'getCollection')
->label('sdk.description', 'Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.')
->label('sdk.description', '/docs/references/database/get-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.')
->action(
function ($collectionId) use ($response, $projectDB) {
@ -93,7 +93,7 @@ $utopia->post('/v1/database')
->label('scope', 'collections.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'createCollection')
->label('sdk.description', 'Create a new Collection.')
->label('sdk.description', '/docs/references/database/create-collection.md')
->param('name', '', function () { return new Text(256); }, 'Collection name.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true)
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. [Learn more about permissions and roles](/docs/permissions).', true)
@ -160,7 +160,7 @@ $utopia->put('/v1/database/:collectionId')
->label('scope', 'collections.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'updateCollection')
->label('sdk.description', 'Update collection by its unique ID.')
->label('sdk.description', '/docs/references/database/update-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.')
->param('name', null, function () { return new Text(256); }, 'Collection name.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true)
@ -210,7 +210,7 @@ $utopia->delete('/v1/database/:collectionId')
->label('scope', 'collections.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'deleteCollection')
->label('sdk.description', 'Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.')
->label('sdk.description', '/docs/references/database/delete-collection.md')
->param('collectionId', '', function () { return new UID(); }, 'Collection unique ID.')
->action(
function ($collectionId) use ($response, $projectDB, $audit) {
@ -239,7 +239,7 @@ $utopia->get('/v1/database/:collectionId/documents')
->label('scope', 'documents.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'listDocuments')
->label('sdk.description', 'Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/modes).')
->label('sdk.description', '/docs/references/database/list-documents.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID.')
->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.$uid>=5bed2d152c362\'', true)
->param('offset', 0, function () { return new Range(0, 900000000); }, 'Offset value. Use this value to manage pagination.', true)
@ -305,7 +305,7 @@ $utopia->get('/v1/database/:collectionId/documents/:documentId')
->label('scope', 'documents.read')
->label('sdk.namespace', 'database')
->label('sdk.method', 'getDocument')
->label('sdk.description', 'Get document by its unique ID. This endpoint response returns a JSON object with the document data.')
->label('sdk.description', '/docs/references/database/get-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID')
->action(
@ -350,7 +350,7 @@ $utopia->post('/v1/database/:collectionId/documents')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'createDocument')
->label('sdk.description', 'Create a new Document.')
->label('sdk.description', '/docs/references/database/create-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID.')
->param('data', [], function () { return new \Utopia\Validator\Mock(); }, 'Document data as JSON string.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true)
@ -456,6 +456,7 @@ $utopia->patch('/v1/database/:collectionId/documents/:documentId')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'updateDocument')
->label('sdk.description', '/docs/references/database/update-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID')
->param('data', [], function () { return new \Utopia\Validator\Mock(); }, 'Document data as JSON string')
@ -532,7 +533,7 @@ $utopia->delete('/v1/database/:collectionId/documents/:documentId')
->label('scope', 'documents.write')
->label('sdk.namespace', 'database')
->label('sdk.method', 'deleteDocument')
->label('sdk.description', 'Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents **will not** be deleted.')
->label('sdk.description', '/docs/references/database/delete-document.md')
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID')
->param('documentId', null, function () { return new UID(); }, 'Document unique ID')
->action(

View file

@ -11,7 +11,7 @@ $utopia->get('/v1/locale')
->label('scope', 'locale.read')
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getLocale')
->label('sdk.description', 'Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in supported language.')
->label('sdk.description', '/docs/references/locale/get-locale.md')
->action(
function () use ($response, $request, $utopia) {
$eu = include __DIR__.'/../config/eu.php';
@ -68,7 +68,7 @@ $utopia->get('/v1/locale/countries')
->label('scope', 'locale.read')
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountries')
->label('sdk.description', 'List of all countries. You can use the locale header to get the data in supported language.')
->label('sdk.description', '/docs/references/locale/get-countires.md')
->action(
function () use ($response, $request) {
$list = Locale::getText('countries'); /* @var $list array */
@ -84,7 +84,7 @@ $utopia->get('/v1/locale/countries/eu')
->label('scope', 'locale.read')
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountriesEU')
->label('sdk.description', 'List of all countries that are currently members of the EU. You can use the locale header to get the data in supported language. UK brexit date is currently set to 2019-10-31 and will be updated if and when needed.')
->label('sdk.description', '/docs/references/locale/get-countries-eu.md')
->action(
function () use ($response) {
$countries = Locale::getText('countries'); /* @var $countries array */
@ -108,7 +108,7 @@ $utopia->get('/v1/locale/countries/phones')
->label('scope', 'locale.read')
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCountriesPhones')
->label('sdk.description', 'List of all countries phone codes. You can use the locale header to get the data in supported language.')
->label('sdk.description', '/docs/references/locale/get-countries-phones.md')
->action(
function () use ($response) {
$list = include __DIR__.'/../config/phones.php'; /* @var $list array */
@ -132,7 +132,7 @@ $utopia->get('/v1/locale/currencies')
->label('scope', 'locale.read')
->label('sdk.namespace', 'locale')
->label('sdk.method', 'getCurrencies')
->label('sdk.description', 'List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in supported language.')
->label('sdk.description', '/docs/references/locale/get-currencies.md')
->action(
function () use ($response) {
$currencies = include __DIR__.'/../config/currencies.php';

View file

@ -118,7 +118,7 @@ $utopia->get('/v1/storage/files')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'listFiles')
->label('sdk.description', 'Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project files. [Learn more about different API modes](/docs/modes).')
->label('sdk.description', '/docs/references/storage/list-files.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', 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('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true)
@ -150,7 +150,7 @@ $utopia->get('/v1/storage/files/:fileId')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFile')
->label('sdk.description', 'Get file by its unique ID. This endpoint response returns a JSON object with the file metadata.')
->label('sdk.description', '/docs/references/storage/get-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
->action(
function ($fileId) use ($response, $projectDB) {
@ -169,7 +169,7 @@ $utopia->get('/v1/storage/files/:fileId/preview')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFilePreview')
->label('sdk.description', 'Get file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets will return file icon image. You can also pass query string arguments for cutting and resizing your preview image.')
->label('sdk.description', '/docs/references/storage/get-file-preview.md')
->param('fileId', '', function () { return 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('height', 0, function () { return new Range(0, 4000); }, 'Resize preview image height, Pass an integer between 0 to 4000', true)
@ -281,7 +281,7 @@ $utopia->get('/v1/storage/files/:fileId/download')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileDownload')
->label('sdk.description', 'Get file content by its unique ID. The endpoint response return with a \'Content-Disposition: attachment\' header that tells the browser to start downloading the file to user downloads directory.')
->label('sdk.description', '/docs/references/storage/get-file-download.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
->action(
function ($fileId) use ($response, $request, $projectDB) {
@ -331,7 +331,7 @@ $utopia->get('/v1/storage/files/:fileId/view')
->label('scope', 'files.read')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'getFileView')
->label('sdk.description', 'Get file content by its unique ID. This endpoint is similar to the download method but returns with no \'Content-Disposition: attachment\' header.')
->label('sdk.description', '/docs/references/storage/get-file-view.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
->param('as', '', function () { return new WhiteList(['pdf', /*'html',*/ 'text']); }, '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(
@ -398,7 +398,7 @@ $utopia->post('/v1/storage/files')
->label('scope', 'files.write')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'createFile')
->label('sdk.description', 'Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments.')
->label('sdk.description', '/docs/references/storage/create-file.md')
->label('sdk.consumes', 'multipart/form-data')
->param('files', [], function () { return new File(); }, 'Binary Files.', false)
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true)
@ -521,7 +521,7 @@ $utopia->put('/v1/storage/files/:fileId')
->label('scope', 'files.write')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'updateFile')
->label('sdk.description', 'Update file by its unique ID. Only users with write permissions have access to update this resource.')
->label('sdk.description', '/docs/references/storage/update-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true)
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. [Learn more about permissions and roles](/docs/permissions).', true)
@ -555,7 +555,7 @@ $utopia->delete('/v1/storage/files/:fileId')
->label('scope', 'files.write')
->label('sdk.namespace', 'storage')
->label('sdk.method', 'deleteFile')
->label('sdk.description', 'Delete a file by its unique ID. Only users with write permissions have access to delete this resource.')
->label('sdk.description', '/docs/references/storage/delete-file.md')
->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
->action(
function ($fileId) use ($response, $projectDB, $audit, $usage) {

View file

@ -23,7 +23,7 @@ $utopia->get('/v1/teams')
->label('scope', 'teams.read')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'listTeams')
->label('sdk.description', 'Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project teams. [Learn more about different API modes](/docs/modes).')
->label('sdk.description', '/docs/references/teams/list-teams.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', 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('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true)
@ -51,7 +51,7 @@ $utopia->get('/v1/teams/:teamId')
->label('scope', 'teams.read')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'getTeam')
->label('sdk.description', 'Get team by its unique ID. All team members have read access for this resource.')
->label('sdk.description', '/docs/references/teams/get-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->action(
function ($teamId) use ($response, $projectDB) {
@ -70,7 +70,7 @@ $utopia->get('/v1/teams/:teamId/members')
->label('scope', 'teams.read')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'getTeamMembers')
->label('sdk.description', 'Get team members by the team unique ID. All team members have read access for this list of resources.')
->label('sdk.description', '/docs/references/teams/get-team-members.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->action(
function ($teamId) use ($response, $projectDB) {
@ -122,7 +122,7 @@ $utopia->post('/v1/teams')
->label('scope', 'teams.write')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'createTeam')
->label('sdk.description', 'Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.')
->label('sdk.description', '/docs/references/teams/create-team.md')
->param('name', null, function () { return new Text(100); }, 'Team name.')
->param('roles', ['owner'], function () { return new ArrayList(new Text(128)); }, 'User roles array. Use this param to set the roles in the team for the user who created the team. The default role is **owner**, a role can be any string.', true)
->action(
@ -184,7 +184,7 @@ $utopia->put('/v1/teams/:teamId')
->label('scope', 'teams.write')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateTeam')
->label('sdk.description', 'Update team by its unique ID. Only team owners have write access for this resource.')
->label('sdk.description', '/docs/references/teams/update-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('name', null, function () { return new Text(100); }, 'Team name.')
->action(
@ -212,7 +212,7 @@ $utopia->delete('/v1/teams/:teamId')
->label('scope', 'teams.write')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'deleteTeam')
->label('sdk.description', 'Delete team by its unique ID. Only team owners have write access for this resource.')
->label('sdk.description', '/docs/references/teams/delete-team.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->action(
function ($teamId) use ($response, $projectDB) {
@ -252,7 +252,7 @@ $utopia->post('/v1/teams/:teamId/memberships')
->label('scope', 'account')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'createTeamMembership')
->label('sdk.description', "Use this endpoint to invite a new member to your team. An email with a link to join the team will be sent to the new member email address. If member doesn't exists in the project it will be automatically created.\n\nUse the redirect parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the /teams/{teamId}/memberships/{inviteId}/status endpoint to finally join the user to the team.\n\nPlease notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.")
->label('sdk.description', '/docs/references/teams/create-team-membership.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('email', '', function () { return new Email(); }, 'New team member email address.')
->param('name', '', function () { return new Text(100); }, 'New team member name.', true)
@ -395,7 +395,7 @@ $utopia->post('/v1/teams/:teamId/memberships/:inviteId/resend')
->label('scope', 'account')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'createTeamMembershipResend')
->label('sdk.description', 'Use this endpoint to resend your invitation email for a user to join a team.')
->label('sdk.description', '/docs/references/teams/create-team-membership-resend.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('inviteId', '', function () { return new UID(); }, 'Invite unique ID.')
->param('redirect', '', function () use ($clients) { return new Host($clients); }, 'Reset page to redirect user back to your app from the invitation email.')
@ -475,7 +475,7 @@ $utopia->patch('/v1/teams/:teamId/memberships/:inviteId/status')
->label('scope', 'auth')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'updateTeamMembershipStatus')
->label('sdk.description', "Use this endpoint to let user accept an invitation to join a team after he is being redirect back to your app from the invitation email. Use the success and failure URL's to redirect users back to your application after the request completes.\n\nPlease notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.\n\nWhen not using the success or failure redirect arguments this endpoint will result with a 200 status code on success and with 401 status error on failure. This behavior was applied to help the web clients deal with browsers who don't allow to set 3rd party HTTP cookies needed for saving the account session token.")
->label('sdk.description', '/docs/references/teams/update-team-membership-status.md')
->label('sdk.cookies', true)
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('inviteId', '', function () { return new UID(); }, 'Invite unique ID')
@ -607,7 +607,7 @@ $utopia->delete('/v1/teams/:teamId/memberships/:inviteId')
->label('scope', 'account')
->label('sdk.namespace', 'teams')
->label('sdk.method', 'deleteTeamMembership')
->label('sdk.description', 'This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member.')
->label('sdk.description', '/docs/references/teams/delete-team-membership.md')
->param('teamId', '', function () { return new UID(); }, 'Team unique ID.')
->param('inviteId', '', function () { return new UID(); }, 'Invite unique ID')
->action(

View file

@ -22,7 +22,7 @@ $utopia->get('/v1/users')
->label('scope', 'users.read')
->label('sdk.namespace', 'users')
->label('sdk.method', 'listUsers')
->label('sdk.description', 'Get a list of all the project users. You can use the query params to filter your results.')
->label('sdk.description', '/docs/references/users/list-users.md')
->param('search', '', function () { return new Text(256); }, 'Search term to filter your list results.', 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('offset', 0, function () { return new Range(0, 2000); }, 'Results offset. The default value is 0. Use this param to manage pagination.', true)
@ -74,7 +74,7 @@ $utopia->get('/v1/users/:userId')
->label('scope', 'users.read')
->label('sdk.namespace', 'users')
->label('sdk.method', 'getUser')
->label('sdk.description', 'Get user by its unique ID.')
->label('sdk.description', '/docs/references/users/get-user.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->action(
function ($userId) use ($response, $projectDB, $providers) {
@ -113,7 +113,7 @@ $utopia->get('/v1/users/:userId/prefs')
->label('scope', 'users.read')
->label('sdk.namespace', 'users')
->label('sdk.method', 'getUserPrefs')
->label('sdk.description', 'Get user preferences by its unique ID.')
->label('sdk.description', '/docs/references/users/get-user-prefs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->action(
function ($userId) use ($response, $projectDB) {
@ -144,7 +144,7 @@ $utopia->get('/v1/users/:userId/sessions')
->label('scope', 'users.read')
->label('sdk.namespace', 'users')
->label('sdk.method', 'getUserSessions')
->label('sdk.description', 'Get user sessions list by its unique ID.')
->label('sdk.description', '/docs/references/users/get-user-sessions.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->action(
function ($userId) use ($response, $projectDB) {
@ -206,7 +206,7 @@ $utopia->get('/v1/users/:userId/logs')
->label('scope', 'users.read')
->label('sdk.namespace', 'users')
->label('sdk.method', 'getUserLogs')
->label('sdk.description', 'Get user activity logs list by its unique ID.')
->label('sdk.description', '/docs/references/users/get-user-logs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->action(
function ($userId) use ($response, $register, $projectDB, $project) {
@ -267,7 +267,7 @@ $utopia->post('/v1/users')
->label('scope', 'users.write')
->label('sdk.namespace', 'users')
->label('sdk.method', 'createUser')
->label('sdk.description', 'Create a new user.')
->label('sdk.description', '/docs/references/users/create-user.md')
->param('email', '', function () { return new Email(); }, 'User account email.')
->param('password', '', function () { return new Password(); }, 'User account password.')
->param('name', '', function () { return new Text(100); }, 'User account name.', true)
@ -331,7 +331,7 @@ $utopia->patch('/v1/users/:userId/status')
->label('scope', 'users.write')
->label('sdk.namespace', 'users')
->label('sdk.method', 'updateUserStatus')
->label('sdk.description', 'Update user status by its unique ID.')
->label('sdk.description', '/docs/references/users/update-user-status.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->param('status', '', function () { return new WhiteList([Auth::USER_STATUS_ACTIVATED, Auth::USER_STATUS_BLOCKED, Auth::USER_STATUS_UNACTIVATED]); }, 'User Status code. To activate the user pass '.Auth::USER_STATUS_ACTIVATED.', to blocking the user pass '.Auth::USER_STATUS_BLOCKED.' and for disabling the user pass '.Auth::USER_STATUS_UNACTIVATED)
->action(
@ -360,9 +360,9 @@ $utopia->patch('/v1/users/:userId/prefs')
->label('scope', 'users.write')
->label('sdk.namespace', 'users')
->label('sdk.method', 'updateUserPrefs')
->label('sdk.description', '/docs/references/users/update-user-prefs.md')
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->param('prefs', '', function () { return new \Utopia\Validator\Mock(); }, 'Prefs key-value JSON object string.')
->label('sdk.description', 'Update user preferences by its unique ID. You can pass only the specific settings you wish to update.')
->action(
function ($userId, $prefs) use ($response, $projectDB) {
$user = $projectDB->getDocument($userId);
@ -387,8 +387,8 @@ $utopia->delete('/v1/users/:userId/sessions/:session')
->desc('Delete User Session')
->label('scope', 'users.write')
->label('sdk.namespace', 'users')
->label('sdk.method', 'deleteUsersSession')
->label('sdk.description', 'Delete user sessions by its unique ID.')
->label('sdk.method', 'deleteUserSession')
->label('sdk.description', '/docs/references/users/delete-user-session.md')
->label('abuse-limit', 100)
->param('userId', '', function () { return new UID(); }, 'User unique ID.')
->param('sessionId', null, function () { return new UID(); }, 'User unique session ID.')

View file

@ -0,0 +1 @@
Update user preferences by its unique ID. You can pass only the specific settings you wish to update.