mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch 'feat-database-indexing' of https://github.com/appwrite/appwrite into feat-database-indexing-migration
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
<br />
|
||||
</p>
|
||||
|
||||
[](https://hacktoberfest.appwrite.io)
|
||||
<!-- [](https://hacktoberfest.appwrite.io) -->
|
||||
[](https://appwrite.io/discord?r=Github)
|
||||
[](https://hub.docker.com/r/appwrite/appwrite)
|
||||
[](https://travis-ci.com/appwrite/appwrite)
|
||||
[](https://twitter.com/appwrite)
|
||||
[](docs/tutorials/add-translations.md)
|
||||
<!-- [](https://store.appwrite.io) -->
|
||||
[](https://store.appwrite.io)
|
||||
|
||||
[**Appwrite 0.11 has been released! Learn what's new!**](https://dev.to/appwrite/building-apps-just-got-swifter-announcing-appwrite-v011-4g62)
|
||||
|
||||
|
||||
@@ -43,6 +43,17 @@ $collections = [
|
||||
'array' => false,
|
||||
'filters' => [],
|
||||
],
|
||||
[
|
||||
'$id' => 'enabled',
|
||||
'type' => Database::VAR_BOOLEAN,
|
||||
'signed' => true,
|
||||
'size' => 0,
|
||||
'format' => '',
|
||||
'filters' => [],
|
||||
'required' => true,
|
||||
'default' => null,
|
||||
'array' => false,
|
||||
],
|
||||
[
|
||||
'$id' => 'permission',
|
||||
'type' => Database::VAR_STRING,
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -175,6 +175,7 @@ App::post('/v1/database/collections')
|
||||
'permission' => $permission, // Permissions model type (document vs collection)
|
||||
'dateCreated' => time(),
|
||||
'dateUpdated' => time(),
|
||||
'enabled' => true,
|
||||
'name' => $name,
|
||||
'search' => implode(' ', [$collectionId, $name]),
|
||||
]));
|
||||
@@ -592,11 +593,12 @@ App::put('/v1/database/collections/:collectionId')
|
||||
->param('permission', null, new WhiteList(['document', 'collection']), 'Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.')
|
||||
->param('read', null, new Permissions(), 'An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.', true)
|
||||
->param('write', null, new Permissions(), 'An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.', true)
|
||||
->param('enabled', true, new Boolean(), 'Is collection enabled?', true)
|
||||
->inject('response')
|
||||
->inject('dbForInternal')
|
||||
->inject('audits')
|
||||
->inject('usage')
|
||||
->action(function ($collectionId, $name, $permission, $read, $write, $response, $dbForInternal, $audits, $usage) {
|
||||
->action(function ($collectionId, $name, $permission, $read, $write, $enabled, $response, $dbForInternal, $audits, $usage) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
/** @var Appwrite\Event\Event $audits */
|
||||
@@ -608,8 +610,9 @@ App::put('/v1/database/collections/:collectionId')
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
|
||||
$read = (is_null($read)) ? ($collection->getRead() ?? []) : $read; // By default inherit read permissions
|
||||
$write = (is_null($write)) ? ($collection->getWrite() ?? []) : $write; // By default inherit write permissions
|
||||
$read ??= $collection->getRead() ?? []; // By default inherit read permissions
|
||||
$write ??= $collection->getWrite() ?? []; // By default inherit write permissions
|
||||
$enabled ??= $collection->getAttribute('enabled', true);
|
||||
|
||||
try {
|
||||
$collection = $dbForInternal->updateDocument('collections', $collection->getId(), $collection
|
||||
@@ -618,6 +621,7 @@ App::put('/v1/database/collections/:collectionId')
|
||||
->setAttribute('name', $name)
|
||||
->setAttribute('permission', $permission)
|
||||
->setAttribute('dateUpdated', time())
|
||||
->setAttribute('enabled', $enabled)
|
||||
->setAttribute('search', implode(' ', [$collectionId, $name]))
|
||||
);
|
||||
}
|
||||
@@ -835,6 +839,10 @@ App::post('/v1/database/collections/:collectionId/attributes/enum')
|
||||
$size = ($length > $size) ? $length : $size;
|
||||
}
|
||||
|
||||
if (!is_null($default) && !in_array($default, $elements)) {
|
||||
throw new Exception('Default value not found in elements', 400);
|
||||
}
|
||||
|
||||
$attribute = createAttribute($collectionId, new Document([
|
||||
'key' => $key,
|
||||
'type' => Database::VAR_STRING,
|
||||
@@ -1590,7 +1598,8 @@ App::post('/v1/database/collections/:collectionId/documents')
|
||||
->inject('audits')
|
||||
->inject('usage')
|
||||
->inject('events')
|
||||
->action(function ($documentId, $collectionId, $data, $read, $write, $response, $dbForInternal, $dbForExternal, $user, $audits, $usage, $events) {
|
||||
->inject('mode')
|
||||
->action(function ($documentId, $collectionId, $data, $read, $write, $response, $dbForInternal, $dbForExternal, $user, $audits, $usage, $events, $mode) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
/** @var Utopia\Database\Database $dbForExternal */
|
||||
@@ -1598,6 +1607,7 @@ App::post('/v1/database/collections/:collectionId/documents')
|
||||
/** @var Appwrite\Event\Event $audits */
|
||||
/** @var Appwrite\Stats\Stats $usage */
|
||||
/** @var Appwrite\Event\Event $events */
|
||||
/** @var string $mode */
|
||||
|
||||
$data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array
|
||||
|
||||
@@ -1614,8 +1624,10 @@ App::post('/v1/database/collections/:collectionId/documents')
|
||||
*/
|
||||
$collection = Authorization::skip(fn() => $dbForInternal->getDocument('collections', $collectionId));
|
||||
|
||||
if ($collection->isEmpty()) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
if ($collection->isEmpty() || !$collection->getAttribute('enabled')) {
|
||||
if (!($mode === APP_MODE_ADMIN && Auth::isPrivilegedUser(Authorization::getRoles()))) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Check collection permissions when enforced
|
||||
@@ -1701,20 +1713,28 @@ App::get('/v1/database/collections/:collectionId/documents')
|
||||
->inject('response')
|
||||
->inject('dbForInternal')
|
||||
->inject('dbForExternal')
|
||||
->inject('user')
|
||||
->inject('usage')
|
||||
->action(function ($collectionId, $queries, $limit, $offset, $cursor, $cursorDirection, $orderAttributes, $orderTypes, $response, $dbForInternal, $dbForExternal, $usage) {
|
||||
->inject('mode')
|
||||
->action(function ($collectionId, $queries, $limit, $offset, $cursor, $cursorDirection, $orderAttributes, $orderTypes, $response, $dbForInternal, $dbForExternal, $user, $usage, $mode) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
/** @var Utopia\Database\Database $dbForExternal */
|
||||
/** @var Appwrite\Stats\Stats $usage */
|
||||
/** @var Utopia\Database\Document $user */
|
||||
/** @var string $mode */
|
||||
|
||||
/**
|
||||
* Skip Authorization to get the collection. Needed in case of empty permissions for document level permissions.
|
||||
*
|
||||
* @var Utopia\Database\Document $collection
|
||||
*/
|
||||
$collection = Authorization::skip(fn() => $dbForInternal->getDocument('collections', $collectionId));
|
||||
|
||||
if ($collection->isEmpty()) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
if ($collection->isEmpty() || !$collection->getAttribute('enabled')) {
|
||||
if (!($mode === APP_MODE_ADMIN && Auth::isPrivilegedUser(Authorization::getRoles()))) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Check collection permissions when enforced
|
||||
@@ -1782,18 +1802,22 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId')
|
||||
->inject('dbForInternal')
|
||||
->inject('dbForExternal')
|
||||
->inject('usage')
|
||||
->action(function ($collectionId, $documentId, $response, $dbForInternal, $dbForExternal, $usage) {
|
||||
->inject('mode')
|
||||
->action(function ($collectionId, $documentId, $response, $dbForInternal, $dbForExternal, $usage, $mode) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $$dbForInternal */
|
||||
/** @var Utopia\Database\Database $dbForExternal */
|
||||
/** @var string $mode */
|
||||
|
||||
/**
|
||||
* Skip Authorization to get the collection. Needed in case of empty permissions for document level permissions.
|
||||
*/
|
||||
$collection = Authorization::skip(fn() => $dbForInternal->getDocument('collections', $collectionId));
|
||||
|
||||
if ($collection->isEmpty()) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
if ($collection->isEmpty() || !$collection->getAttribute('enabled')) {
|
||||
if (!($mode === APP_MODE_ADMIN && Auth::isPrivilegedUser(Authorization::getRoles()))) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Check collection permissions when enforced
|
||||
@@ -1940,21 +1964,25 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId')
|
||||
->inject('audits')
|
||||
->inject('usage')
|
||||
->inject('events')
|
||||
->action(function ($collectionId, $documentId, $data, $read, $write, $response, $dbForInternal, $dbForExternal, $audits, $usage, $events) {
|
||||
->inject('mode')
|
||||
->action(function ($collectionId, $documentId, $data, $read, $write, $response, $dbForInternal, $dbForExternal, $audits, $usage, $events, $mode) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
/** @var Utopia\Database\Database $dbForExternal */
|
||||
/** @var Appwrite\Event\Event $audits */
|
||||
/** @var Appwrite\Stats\Stats $usage */
|
||||
/** @var Appwrite\Event\Event $events */
|
||||
/** @var string $mode */
|
||||
|
||||
/**
|
||||
* Skip Authorization to get the collection. Needed in case of empty permissions for document level permissions.
|
||||
*/
|
||||
$collection = Authorization::skip(fn() => $dbForInternal->getDocument('collections', $collectionId));
|
||||
|
||||
if ($collection->isEmpty()) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
if ($collection->isEmpty() || !$collection->getAttribute('enabled')) {
|
||||
if (!($mode === APP_MODE_ADMIN && Auth::isPrivilegedUser(Authorization::getRoles()))) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Check collection permissions when enforced
|
||||
@@ -2060,20 +2088,24 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId')
|
||||
->inject('events')
|
||||
->inject('audits')
|
||||
->inject('usage')
|
||||
->action(function ($collectionId, $documentId, $response, $dbForInternal, $dbForExternal, $events, $audits, $usage) {
|
||||
->inject('mode')
|
||||
->action(function ($collectionId, $documentId, $response, $dbForInternal, $dbForExternal, $events, $audits, $usage, $mode) {
|
||||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForExternal */
|
||||
/** @var Appwrite\Event\Event $events */
|
||||
/** @var Appwrite\Event\Event $audits */
|
||||
/** @var Appwrite\Stats\Stats $usage */
|
||||
/** @var string $mode */
|
||||
|
||||
/**
|
||||
* Skip Authorization to get the collection. Needed in case of empty permissions for document level permissions.
|
||||
*/
|
||||
$collection = Authorization::skip(fn() => $dbForInternal->getDocument('collections', $collectionId));
|
||||
|
||||
if ($collection->isEmpty()) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
if ($collection->isEmpty() || !$collection->getAttribute('enabled')) {
|
||||
if (!($mode === APP_MODE_ADMIN && Auth::isPrivilegedUser(Authorization::getRoles()))) {
|
||||
throw new Exception('Collection not found', 404);
|
||||
}
|
||||
}
|
||||
|
||||
// Check collection permissions when enforced
|
||||
|
||||
@@ -179,7 +179,7 @@ App::put('/v1/teams/:teamId')
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_TEAM)
|
||||
->param('teamId', '', new UID(), 'Team ID.')
|
||||
->param('name', null, new Text(128), 'Team name. Max length: 128 chars.')
|
||||
->param('name', null, new Text(128), 'New team name. Max length: 128 chars.')
|
||||
->inject('response')
|
||||
->inject('dbForInternal')
|
||||
->action(function ($teamId, $name, $response, $dbForInternal) {
|
||||
@@ -270,10 +270,10 @@ App::post('/v1/teams/:teamId/memberships')
|
||||
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
|
||||
->label('abuse-limit', 10)
|
||||
->param('teamId', '', new UID(), 'Team ID.')
|
||||
->param('email', '', new Email(), 'Team member email.')
|
||||
->param('email', '', new Email(), 'Email of the new team member.')
|
||||
->param('roles', [], new ArrayList(new Key()), '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). Max length for each role is 32 chars.')
|
||||
->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('name', '', new Text(128), 'Team member name. Max length: 128 chars.', true)
|
||||
->param('name', '', new Text(128), 'Name of the new team member. Max length: 128 chars.', true)
|
||||
->inject('response')
|
||||
->inject('project')
|
||||
->inject('user')
|
||||
@@ -515,13 +515,18 @@ App::get('/v1/teams/:teamId/memberships/:membershipId')
|
||||
|
||||
$membership = $dbForInternal->getDocument('memberships', $membershipId);
|
||||
|
||||
if($membership->isEmpty() || empty($membership->getAttribute('userId', null))) {
|
||||
if($membership->isEmpty() || empty($membership->getAttribute('userId'))) {
|
||||
throw new Exception('Membership not found', 404);
|
||||
}
|
||||
|
||||
$temp = $dbForInternal->getDocument('users', $membership->getAttribute('userId', null))->getArrayCopy(['email', 'name']);
|
||||
$user = $dbForInternal->getDocument('users', $membership->getAttribute('userId'));
|
||||
|
||||
$response->dynamic(new Document(\array_merge($temp, $membership->getArrayCopy())), Response::MODEL_MEMBERSHIP );
|
||||
$membership
|
||||
->setAttribute('name', $user->getAttribute('name'))
|
||||
->setAttribute('email', $user->getAttribute('email'))
|
||||
;
|
||||
|
||||
$response->dynamic($membership, Response::MODEL_MEMBERSHIP );
|
||||
});
|
||||
|
||||
App::patch('/v1/teams/:teamId/memberships/:membershipId')
|
||||
@@ -538,7 +543,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId')
|
||||
->label('sdk.response.model', Response::MODEL_MEMBERSHIP)
|
||||
->param('teamId', '', new UID(), 'Team ID.')
|
||||
->param('membershipId', '', new UID(), 'Membership ID.')
|
||||
->param('roles', [], new ArrayList(new Key()), '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](https://appwrite.io/docs/permissions). Max length for each role is 32 chars.')
|
||||
->param('roles', [], new ArrayList(new Key()), 'An array of strings. Use this param to set the user\'s roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Max length for each role is 32 chars.')
|
||||
->inject('request')
|
||||
->inject('response')
|
||||
->inject('user')
|
||||
@@ -569,7 +574,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId')
|
||||
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
|
||||
$isAppUser = Auth::isAppUser(Authorization::getRoles());
|
||||
$isOwner = Authorization::isRole('team:'.$team->getId().'/owner');;
|
||||
|
||||
|
||||
if (!$isOwner && !$isPrivilegedUser && !$isAppUser) { // Not owner, not admin, not app (server)
|
||||
throw new Exception('User is not allowed to modify roles', 401);
|
||||
}
|
||||
|
||||
+7
-1
@@ -349,7 +349,7 @@ Structure::addFormat(APP_DATABASE_ATTRIBUTE_EMAIL, function() {
|
||||
|
||||
Structure::addFormat(APP_DATABASE_ATTRIBUTE_ENUM, function($attribute) {
|
||||
$elements = $attribute['formatOptions']['elements'];
|
||||
return new WhiteList($elements);
|
||||
return new WhiteList($elements, true);
|
||||
}, Database::VAR_STRING);
|
||||
|
||||
Structure::addFormat(APP_DATABASE_ATTRIBUTE_IP, function() {
|
||||
@@ -833,6 +833,12 @@ App::setResource('dbForConsole', function($db, $cache) {
|
||||
|
||||
App::setResource('mode', function($request) {
|
||||
/** @var Utopia\Swoole\Request $request */
|
||||
|
||||
/**
|
||||
* Defines the mode for the request:
|
||||
* - 'default' => Requests for Client and Server Side
|
||||
* - 'admin' => Request from the Console on non-console projects
|
||||
*/
|
||||
return $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT));
|
||||
}, ['request']);
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ $logs = $this->getParam('logs', null);
|
||||
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{project-collection.$id}}" />
|
||||
<input type="hidden" name="attributeId" data-ls-bind="{{attribute.key}}" />
|
||||
<input type="hidden" name="key" data-ls-bind="{{attribute.key}}" />
|
||||
|
||||
<button class="danger small">Delete</button>
|
||||
</form>
|
||||
@@ -275,7 +275,7 @@ $logs = $this->getParam('logs', null);
|
||||
<tr>
|
||||
<th width="30"></th>
|
||||
<th width="80"></th>
|
||||
<th width="130">Index ID</th>
|
||||
<th width="130">Index Key</th>
|
||||
<th width="100">Type</th>
|
||||
<th width="180">Attributes</th>
|
||||
<th></th>
|
||||
@@ -295,7 +295,7 @@ $logs = $this->getParam('logs', null);
|
||||
<span data-ls-if="{{index.status}} == 'deleting'" class="text-size-small text-danger">deleting </span>
|
||||
</td>
|
||||
|
||||
<td data-title="Index ID: ">
|
||||
<td data-title="Index Key: ">
|
||||
<span class="text-size-small" data-ls-bind="{{index.key}}"></span><span class="text-size-small" data-ls-if="{{index.size}}" data-ls-bind="({{index.size}})"></span>
|
||||
</td>
|
||||
|
||||
@@ -334,7 +334,7 @@ $logs = $this->getParam('logs', null);
|
||||
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{project-collection.$id}}" />
|
||||
<input type="hidden" name="indexId" data-ls-bind="{{index.key}}" />
|
||||
<input type="hidden" name="key" data-ls-bind="{{index.key}}" />
|
||||
|
||||
<button class="danger small">Delete</button>
|
||||
</form>
|
||||
@@ -456,6 +456,9 @@ $logs = $this->getParam('logs', null);
|
||||
<label for="collection-name">Name</label>
|
||||
<input name="name" id="collection-name" type="text" autocomplete="off" data-ls-bind="{{project-collection.name}}" data-forms-text-direction required placeholder="Collection Name" maxlength="128" />
|
||||
|
||||
<div class="margin-bottom">
|
||||
<input name="enabled" type="hidden" data-forms-switch data-cast-to="boolean" data-ls-bind="{{project-collection.enabled}}" /> Enabled <span class="tooltip" data-tooltip="Mark whether collection is enabled"><i class="icon-info-circled"></i></span>
|
||||
</div>
|
||||
|
||||
<label class="margin-bottom-small">Permissions</label>
|
||||
|
||||
@@ -560,8 +563,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="string-attributeId">Attribute ID</label>
|
||||
<input type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="string-key">Attribute ID</label>
|
||||
<input id="string-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<label for="string-length">Size</label>
|
||||
@@ -637,8 +640,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="integer-attributeId">Attribute ID</label>
|
||||
<input id="integer-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="integer-key">Attribute ID</label>
|
||||
<input id="integer-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -719,8 +722,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="float-attributeId">Attribute ID</label>
|
||||
<input id="float-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="float-key">Attribute ID</label>
|
||||
<input id="float-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -800,8 +803,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="email-attributeId">Attribute ID</label>
|
||||
<input id="email-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="128" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="email-key">Attribute ID</label>
|
||||
<input id="email-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="128" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -870,8 +873,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="boolean-attributeId">Attribute ID</label>
|
||||
<input id="boolean-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="boolean-key">Attribute ID</label>
|
||||
<input id="boolean-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -943,8 +946,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="ip-attributeId">Attribute ID</label>
|
||||
<input id="ip-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="ip-key">Attribute ID</label>
|
||||
<input id="ip-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -1013,8 +1016,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="url-attributeId">Attribute ID</label>
|
||||
<input id="url-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="url-key">Attribute ID</label>
|
||||
<input id="url-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<div class="margin-bottom">
|
||||
@@ -1083,8 +1086,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="enum-attributeId">Attribute ID</label>
|
||||
<input id="enum-attributeId" type="text" class="full-width" name="attributeId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="enum-key">Attribute ID</label>
|
||||
<input id="enum-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<label>Elements</label>
|
||||
@@ -1180,8 +1183,8 @@ $logs = $this->getParam('logs', null);
|
||||
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
||||
<input type="hidden" name="collectionId" data-ls-bind="{{router.params.id}}" />
|
||||
|
||||
<label for="index-indexId">Index ID</label>
|
||||
<input id="index-indexId" type="text" class="full-width" name="indexId" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<label for="index-key">Index Key</label>
|
||||
<input id="index-key" type="text" class="full-width" name="key" required autocomplete="off" maxlength="36" pattern="^[a-zA-Z0-9][a-zA-Z0-9_-]{1,36}$" />
|
||||
<div class="text-fade text-size-xs margin-top-negative-small margin-bottom">Allowed Characters A-Z, a-z, 0-9, and non-leading underscore</div>
|
||||
|
||||
<label for="index-type">Type</label>
|
||||
|
||||
Generated
+6
-6
@@ -2255,16 +2255,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/framework",
|
||||
"version": "0.19.2",
|
||||
"version": "0.19.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/framework.git",
|
||||
"reference": "49e4374b97c0f4d14bc84b424bdc9c3b7747e15f"
|
||||
"reference": "4c6c841d738cec458b73fec5aedd40fd43bd41a7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/49e4374b97c0f4d14bc84b424bdc9c3b7747e15f",
|
||||
"reference": "49e4374b97c0f4d14bc84b424bdc9c3b7747e15f",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/4c6c841d738cec458b73fec5aedd40fd43bd41a7",
|
||||
"reference": "4c6c841d738cec458b73fec5aedd40fd43bd41a7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2298,9 +2298,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/framework/issues",
|
||||
"source": "https://github.com/utopia-php/framework/tree/0.19.2"
|
||||
"source": "https://github.com/utopia-php/framework/tree/0.19.3"
|
||||
},
|
||||
"time": "2021-12-07T09:29:35+00:00"
|
||||
"time": "2021-12-17T13:04:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/image",
|
||||
|
||||
@@ -5,7 +5,7 @@ sdk
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
let promise = sdk.projects.delete('[PROJECT_ID]', '[PASSWORD]');
|
||||
let promise = sdk.projects.delete('[PROJECT_ID]', 'password');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Use this endpoint to invite a new member to join your team. If initiated from Client SDK, an email with a link to join the team will be sent to the new member's email address if the member doesn't exist in the project it will be created automatically. If initiated from server side SDKs, new member will automatically be added to the team.
|
||||
Invite a new member to join your team. If initiated from the client SDK, an email with a link to join the team will be sent to the member's email address and an account will be created for them should they not be signed up already. If initiated from server-side SDKs, the new member will automatically be added to the team.
|
||||
|
||||
Use the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team. While calling from side SDKs the redirect url can be empty string.
|
||||
Use the 'url' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
|
||||
|
||||
Please note that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.
|
||||
Please note that to avoid a [Redirect Attack](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 adding your platforms in the console interface.
|
||||
@@ -1 +1 @@
|
||||
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.
|
||||
Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
|
||||
@@ -1 +1 @@
|
||||
Delete a team by its unique ID. Only team owners have write access for this resource.
|
||||
Delete a team using its ID. Only team members with the owner role can delete the team.
|
||||
@@ -1 +1 @@
|
||||
Get a team members by the team unique ID. All team members have read access for this list of resources.
|
||||
Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.
|
||||
@@ -1 +1 @@
|
||||
Get a team by its unique ID. All team members have read access for this resource.
|
||||
Get a team by its ID. All team members have read access for this resource.
|
||||
@@ -1 +1,3 @@
|
||||
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's teams. [Learn more about different API modes](/docs/admin).
|
||||
Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
|
||||
|
||||
In admin mode, this endpoint returns a list of all the teams in the current project. [Learn more about different API modes](/docs/admin).
|
||||
@@ -0,0 +1 @@
|
||||
Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](/docs/permissions).
|
||||
@@ -1 +1 @@
|
||||
Update a team by its unique ID. Only team owners have write access for this resource.
|
||||
Update a team using its ID. Only members with the owner role can update the team.
|
||||
@@ -46,6 +46,23 @@ For **Mac OS** add your app name and Bundle ID, You can find your Bundle Identif
|
||||
### Web
|
||||
Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.
|
||||
|
||||
For web in order to capture the OAuth2 callback URL and send it to the application using JavaScript `postMessage()`, you need to create an html file inside `./web` folder of your Flutter project. For example `auth.html` with the following content.
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<title>Authentication complete</title>
|
||||
<p>Authentication is complete. If this does not happen automatically, please
|
||||
close the window.
|
||||
<script>
|
||||
window.opener.postMessage({
|
||||
flutter-web-auth: window.location.href
|
||||
}, window.location.origin);
|
||||
window.close();
|
||||
</script>
|
||||
```
|
||||
|
||||
Redirection URL passed to the authentication service must be the same as the URL on which the application is running (schema, host, port if necessary) and the path must point to created HTML file, /auth.html in this case. The callbackUrlScheme parameter of the authenticate() method does not take into account, so it is possible to use a schema for native platforms in the code.
|
||||
|
||||
#### Flutter Web Cross-Domain Communication & Cookies
|
||||
While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple [custom-domains](https://appwrite.io/docs/custom-domains) for each project.
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
*
|
||||
* Use this endpoint to allow a new user to register a new account in your
|
||||
* project. After the user registration completes successfully, you can use
|
||||
* the [/account/verification](/docs/client/account#accountCreateVerification)
|
||||
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
||||
* route to start verifying the user email address. To allow the new user to
|
||||
* login to their new account, you need to create a new [account
|
||||
* session](/docs/client/account#accountCreateSession).
|
||||
@@ -264,12 +264,14 @@
|
||||
* Update Account Email
|
||||
*
|
||||
* Update currently logged in user account email address. After changing user
|
||||
* address, user confirmation status is being reset and a new confirmation
|
||||
* mail is sent. For security measures, user password is required to complete
|
||||
* this request.
|
||||
* address, the user confirmation status will get reset. A new confirmation
|
||||
* email is not sent automatically however you can use the send confirmation
|
||||
* email endpoint again to send the confirmation email. For security measures,
|
||||
* user password is required to complete this request.
|
||||
* This endpoint can also be used to convert an anonymous account to a normal
|
||||
* one, by passing an email address and a new password.
|
||||
*
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
* @throws {AppwriteException}
|
||||
@@ -1165,8 +1167,8 @@
|
||||
* @param {string} collectionId
|
||||
* @param {string} name
|
||||
* @param {string} permission
|
||||
* @param {string} read
|
||||
* @param {string} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -1237,12 +1239,13 @@
|
||||
* @param {string} collectionId
|
||||
* @param {string} name
|
||||
* @param {string} permission
|
||||
* @param {string} read
|
||||
* @param {string} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @param {boolean} enabled
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
updateCollection: (collectionId, name, permission, read, write) => __awaiter(this, void 0, void 0, function* () {
|
||||
updateCollection: (collectionId, name, permission, read, write, enabled) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
@@ -1266,6 +1269,9 @@
|
||||
if (typeof write !== 'undefined') {
|
||||
payload['write'] = write;
|
||||
}
|
||||
if (typeof enabled !== 'undefined') {
|
||||
payload['enabled'] = enabled;
|
||||
}
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('put', uri, {
|
||||
'content-type': 'application/json',
|
||||
@@ -1318,27 +1324,27 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {boolean} xdefault
|
||||
* @param {boolean} array
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createBooleanAttribute: (collectionId, attributeId, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createBooleanAttribute: (collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/boolean'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1361,27 +1367,27 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
* @param {boolean} array
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createEmailAttribute: (collectionId, attributeId, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createEmailAttribute: (collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/email'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1402,7 +1408,7 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {string[]} elements
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
@@ -1410,12 +1416,12 @@
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createEnumAttribute: (collectionId, attributeId, elements, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createEnumAttribute: (collectionId, key, elements, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof elements === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "elements"');
|
||||
@@ -1425,8 +1431,8 @@
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/enum'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof elements !== 'undefined') {
|
||||
payload['elements'] = elements;
|
||||
@@ -1453,7 +1459,7 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {string} min
|
||||
* @param {string} max
|
||||
@@ -1462,20 +1468,20 @@
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createFloatAttribute: (collectionId, attributeId, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createFloatAttribute: (collectionId, key, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/float'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1505,7 +1511,7 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {number} min
|
||||
* @param {number} max
|
||||
@@ -1514,20 +1520,20 @@
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createIntegerAttribute: (collectionId, attributeId, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createIntegerAttribute: (collectionId, key, required, min, max, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/integer'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1556,27 +1562,27 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
* @param {boolean} array
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createIpAttribute: (collectionId, attributeId, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createIpAttribute: (collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/ip'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1599,7 +1605,7 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {number} size
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
@@ -1607,12 +1613,12 @@
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createStringAttribute: (collectionId, attributeId, size, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createStringAttribute: (collectionId, key, size, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof size === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "size"');
|
||||
@@ -1622,8 +1628,8 @@
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/string'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof size !== 'undefined') {
|
||||
payload['size'] = size;
|
||||
@@ -1649,27 +1655,27 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @param {boolean} required
|
||||
* @param {string} xdefault
|
||||
* @param {boolean} array
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createUrlAttribute: (collectionId, attributeId, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
createUrlAttribute: (collectionId, key, required, xdefault, array) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof required === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "required"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/url'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof attributeId !== 'undefined') {
|
||||
payload['attributeId'] = attributeId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof required !== 'undefined') {
|
||||
payload['required'] = required;
|
||||
@@ -1690,18 +1696,18 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getAttribute: (collectionId, attributeId) => __awaiter(this, void 0, void 0, function* () {
|
||||
getAttribute: (collectionId, key) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/{attributeId}'.replace('{collectionId}', collectionId).replace('{attributeId}', attributeId);
|
||||
let path = '/database/collections/{collectionId}/attributes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
|
||||
let payload = {};
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('get', uri, {
|
||||
@@ -1713,18 +1719,18 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} attributeId
|
||||
* @param {string} key
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
deleteAttribute: (collectionId, attributeId) => __awaiter(this, void 0, void 0, function* () {
|
||||
deleteAttribute: (collectionId, key) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof attributeId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "attributeId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/attributes/{attributeId}'.replace('{collectionId}', collectionId).replace('{attributeId}', attributeId);
|
||||
let path = '/database/collections/{collectionId}/attributes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
|
||||
let payload = {};
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('delete', uri, {
|
||||
@@ -1793,8 +1799,8 @@
|
||||
* @param {string} collectionId
|
||||
* @param {string} documentId
|
||||
* @param {object} data
|
||||
* @param {string} read
|
||||
* @param {string} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -1861,8 +1867,8 @@
|
||||
* @param {string} collectionId
|
||||
* @param {string} documentId
|
||||
* @param {object} data
|
||||
* @param {string} read
|
||||
* @param {string} write
|
||||
* @param {string[]} read
|
||||
* @param {string[]} write
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
@@ -1974,19 +1980,19 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} indexId
|
||||
* @param {string} key
|
||||
* @param {string} type
|
||||
* @param {string[]} attributes
|
||||
* @param {string[]} orders
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
createIndex: (collectionId, indexId, type, attributes, orders) => __awaiter(this, void 0, void 0, function* () {
|
||||
createIndex: (collectionId, key, type, attributes, orders) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof indexId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "indexId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
if (typeof type === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "type"');
|
||||
@@ -1996,8 +2002,8 @@
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/indexes'.replace('{collectionId}', collectionId);
|
||||
let payload = {};
|
||||
if (typeof indexId !== 'undefined') {
|
||||
payload['indexId'] = indexId;
|
||||
if (typeof key !== 'undefined') {
|
||||
payload['key'] = key;
|
||||
}
|
||||
if (typeof type !== 'undefined') {
|
||||
payload['type'] = type;
|
||||
@@ -2018,18 +2024,18 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} indexId
|
||||
* @param {string} key
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getIndex: (collectionId, indexId) => __awaiter(this, void 0, void 0, function* () {
|
||||
getIndex: (collectionId, key) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof indexId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "indexId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/indexes/{indexId}'.replace('{collectionId}', collectionId).replace('{indexId}', indexId);
|
||||
let path = '/database/collections/{collectionId}/indexes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
|
||||
let payload = {};
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('get', uri, {
|
||||
@@ -2041,18 +2047,18 @@
|
||||
*
|
||||
*
|
||||
* @param {string} collectionId
|
||||
* @param {string} indexId
|
||||
* @param {string} key
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
deleteIndex: (collectionId, indexId) => __awaiter(this, void 0, void 0, function* () {
|
||||
deleteIndex: (collectionId, key) => __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof collectionId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "collectionId"');
|
||||
}
|
||||
if (typeof indexId === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "indexId"');
|
||||
if (typeof key === 'undefined') {
|
||||
throw new AppwriteException('Missing required parameter: "key"');
|
||||
}
|
||||
let path = '/database/collections/{collectionId}/indexes/{indexId}'.replace('{collectionId}', collectionId).replace('{indexId}', indexId);
|
||||
let path = '/database/collections/{collectionId}/indexes/{key}'.replace('{collectionId}', collectionId).replace('{key}', key);
|
||||
let payload = {};
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('delete', uri, {
|
||||
@@ -2234,6 +2240,22 @@
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* List the currently active function runtimes.
|
||||
*
|
||||
* Get a list of all runtimes that are currently active in your project.
|
||||
*
|
||||
* @throws {AppwriteException}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
listRuntimes: () => __awaiter(this, void 0, void 0, function* () {
|
||||
let path = '/functions/runtimes';
|
||||
let payload = {};
|
||||
const uri = new URL(this.config.endpoint + path);
|
||||
return yield this.call('get', uri, {
|
||||
'content-type': 'application/json',
|
||||
}, payload);
|
||||
}),
|
||||
/**
|
||||
* Get Function
|
||||
*
|
||||
|
||||
@@ -612,20 +612,6 @@
|
||||
"code": 61751,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "00d86f3e46c3c3d768e7246eb0eadd7f",
|
||||
"css": "discord",
|
||||
"code": 59463,
|
||||
"src": "custom_icons",
|
||||
"selected": true,
|
||||
"svg": {
|
||||
"path": "M435 432.9C411.3 432.9 392.5 453.8 392.5 479.2S411.7 525.4 435 525.4C458.8 525.4 477.5 504.6 477.5 479.2 477.9 453.8 458.8 432.9 435 432.9ZM587.1 432.9C563.3 432.9 544.6 453.8 544.6 479.2S563.8 525.4 587.1 525.4C610.8 525.4 629.6 504.6 629.6 479.2S610.8 432.9 587.1 432.9ZM789.6 83.3H231.3C184.2 83.3 145.8 121.7 145.8 169.2V732.5C145.8 780 184.2 818.3 231.3 818.3H703.8L681.7 741.3 735 790.8 785.4 837.5 875 916.7V169.2C875 121.7 836.7 83.3 789.6 83.3ZM628.8 627.5S613.8 609.6 601.3 593.8C655.8 578.3 676.7 544.2 676.7 544.2 659.6 555.4 643.3 563.3 628.8 568.8 607.9 577.5 587.9 583.3 568.3 586.7 528.3 594.2 491.7 592.1 460.4 586.3 436.7 581.7 416.3 575 399.2 568.3 389.6 564.6 379.2 560 368.8 554.2 367.5 553.3 366.3 552.9 365 552.1 364.2 551.7 363.8 551.3 363.3 550.8 355.8 546.7 351.7 543.8 351.7 543.8S371.7 577.1 424.6 592.9C412.1 608.8 396.7 627.5 396.7 627.5 304.6 624.6 269.6 564.2 269.6 564.2 269.6 430 329.6 321.3 329.6 321.3 389.6 276.3 446.7 277.5 446.7 277.5L450.8 282.5C375.8 304.2 341.3 337.1 341.3 337.1S350.4 332.1 365.8 325C410.4 305.4 445.8 300 460.4 298.8 462.9 298.3 465 297.9 467.5 297.9 492.9 294.6 521.7 293.8 551.7 297.1 591.3 301.7 633.8 313.3 677.1 337.1 677.1 337.1 644.2 305.8 573.3 284.2L579.2 277.5S636.3 276.3 696.3 321.3C696.3 321.3 756.3 430 756.3 564.2 756.3 564.2 720.8 624.6 628.8 627.5Z",
|
||||
"width": 1021
|
||||
},
|
||||
"search": [
|
||||
"discord-logo-black"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "c2152732d525871cf35345955854f711",
|
||||
"css": "moon-inv",
|
||||
@@ -789,6 +775,54 @@
|
||||
"css": "boolean",
|
||||
"code": 61957,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "47a1f80457068fbeab69fdb83d7d0817",
|
||||
"css": "youtube-play",
|
||||
"code": 61802,
|
||||
"src": "fontawesome"
|
||||
},
|
||||
{
|
||||
"uid": "b6941a012434c6246e2ad74248b6453e",
|
||||
"css": "discord",
|
||||
"code": 59463,
|
||||
"src": "custom_icons",
|
||||
"selected": true,
|
||||
"svg": {
|
||||
"path": "M1006.7 168.6C940.3 138.1 869 115.6 794.5 102.8 793.2 102.5 791.8 103.2 791.1 104.4 781.9 120.7 771.8 142 764.7 158.7 684.6 146.7 604.9 146.7 526.4 158.7 519.3 141.6 508.7 120.7 499.5 104.4 498.8 103.2 497.5 102.6 496.1 102.8 421.7 115.6 350.4 138.1 284 168.6 283.4 168.8 282.9 169.3 282.6 169.8 147.4 371.7 110.4 568.6 128.6 763.1 128.6 764.1 129.2 765 129.9 765.5 219.1 831 305.4 870.8 390.2 897.1 391.6 897.5 393 897 393.9 895.9 413.9 868.5 431.8 839.7 447.1 809.3 448 807.5 447.2 805.4 445.3 804.7 417 794 390 780.9 364 766 361.9 764.8 361.8 761.8 363.7 760.4 369.1 756.3 374.6 752.1 379.8 747.8 380.8 747 382.1 746.8 383.2 747.3 553.8 825.2 738.5 825.2 907.1 747.3 908.2 746.8 909.5 746.9 910.5 747.7 915.7 752 921.1 756.3 926.7 760.4 928.5 761.8 928.4 764.8 926.4 766 900.4 781.1 873.4 794 845 804.7 843.2 805.4 842.3 807.5 843.2 809.3 858.9 839.6 876.8 868.5 896.5 895.9 897.3 897 898.8 897.5 900.1 897.1 985.3 870.8 1071.7 831 1160.8 765.5 1161.6 765 1162.1 764.1 1162.2 763.2 1183.9 538.3 1125.8 343 1008 169.8 1007.8 169.3 1007.3 168.8 1006.7 168.6ZM472.6 644.7C421.2 644.7 378.9 597.5 378.9 539.6 378.9 481.7 420.4 434.6 472.6 434.6 525.2 434.6 567.1 482.1 566.3 539.6 566.3 597.5 524.8 644.7 472.6 644.7ZM819 644.7C767.6 644.7 725.3 597.5 725.3 539.6 725.3 481.7 766.8 434.6 819 434.6 871.6 434.6 913.5 482.1 912.6 539.6 912.6 597.5 871.6 644.7 819 644.7Z",
|
||||
"width": 1291
|
||||
},
|
||||
"search": [
|
||||
"discord-logo-color"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "00d86f3e46c3c3d768e7246eb0eadd7f",
|
||||
"css": "discord",
|
||||
"code": 59463,
|
||||
"src": "custom_icons",
|
||||
"selected": false,
|
||||
"svg": {
|
||||
"path": "M435 432.9C411.3 432.9 392.5 453.8 392.5 479.2S411.7 525.4 435 525.4C458.8 525.4 477.5 504.6 477.5 479.2 477.9 453.8 458.8 432.9 435 432.9ZM587.1 432.9C563.3 432.9 544.6 453.8 544.6 479.2S563.8 525.4 587.1 525.4C610.8 525.4 629.6 504.6 629.6 479.2S610.8 432.9 587.1 432.9ZM789.6 83.3H231.3C184.2 83.3 145.8 121.7 145.8 169.2V732.5C145.8 780 184.2 818.3 231.3 818.3H703.8L681.7 741.3 735 790.8 785.4 837.5 875 916.7V169.2C875 121.7 836.7 83.3 789.6 83.3ZM628.8 627.5S613.8 609.6 601.3 593.8C655.8 578.3 676.7 544.2 676.7 544.2 659.6 555.4 643.3 563.3 628.8 568.8 607.9 577.5 587.9 583.3 568.3 586.7 528.3 594.2 491.7 592.1 460.4 586.3 436.7 581.7 416.3 575 399.2 568.3 389.6 564.6 379.2 560 368.8 554.2 367.5 553.3 366.3 552.9 365 552.1 364.2 551.7 363.8 551.3 363.3 550.8 355.8 546.7 351.7 543.8 351.7 543.8S371.7 577.1 424.6 592.9C412.1 608.8 396.7 627.5 396.7 627.5 304.6 624.6 269.6 564.2 269.6 564.2 269.6 430 329.6 321.3 329.6 321.3 389.6 276.3 446.7 277.5 446.7 277.5L450.8 282.5C375.8 304.2 341.3 337.1 341.3 337.1S350.4 332.1 365.8 325C410.4 305.4 445.8 300 460.4 298.8 462.9 298.3 465 297.9 467.5 297.9 492.9 294.6 521.7 293.8 551.7 297.1 591.3 301.7 633.8 313.3 677.1 337.1 677.1 337.1 644.2 305.8 573.3 284.2L579.2 277.5S636.3 276.3 696.3 321.3C696.3 321.3 756.3 430 756.3 564.2 756.3 564.2 720.8 624.6 628.8 627.5Z",
|
||||
"width": 1021
|
||||
},
|
||||
"search": [
|
||||
"discord-logo-black"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "097a1d40f8e785fbd260946461a6ea9c",
|
||||
"css": "discord",
|
||||
"code": 59463,
|
||||
"src": "custom_icons",
|
||||
"selected": false,
|
||||
"svg": {
|
||||
"path": "M1092.8 89.1C1010.5 51.3 922.3 23.5 830 7.6 828.4 7.2 826.7 8 825.8 9.6 814.5 29.7 801.9 56.1 793.1 76.8 693.9 61.9 595.2 61.9 498 76.8 489.2 55.6 476.2 29.7 464.8 9.6 463.9 8.1 462.2 7.3 460.5 7.6 368.3 23.4 280.1 51.2 197.8 89.1 197.1 89.4 196.5 89.9 196 90.5 28.7 340.6-17.2 584.4 5.3 825.3 5.4 826.5 6.1 827.6 7 828.3 117.4 909.4 224.4 958.6 329.4 991.3 331 991.8 332.8 991.2 333.9 989.8 358.7 955.9 380.9 920.1 399.8 882.5 401 880.3 399.9 877.7 397.6 876.8 362.5 863.5 329.1 847.3 296.9 828.8 294.4 827.3 294.1 823.7 296.5 822 303.3 816.9 310 811.6 316.5 806.3 317.7 805.3 319.3 805.1 320.7 805.7 531.9 902.2 760.6 902.2 969.4 805.7 970.8 805.1 972.4 805.3 973.6 806.2 980.1 811.6 986.9 816.9 993.7 822 996 823.7 995.9 827.3 993.3 828.8 961.2 847.6 927.7 863.5 892.6 876.8 890.3 877.6 889.3 880.3 890.4 882.5 909.8 920.1 931.9 955.8 956.3 989.7 957.3 991.2 959.1 991.8 960.8 991.3 1066.3 958.6 1173.3 909.4 1283.7 828.3 1284.6 827.6 1285.2 826.5 1285.4 825.3 1312.3 546.9 1240.3 305 1094.5 90.6 1094.1 89.9 1093.5 89.4 1092.8 89.1ZM431.4 678.6C367.8 678.6 315.4 620.2 315.4 548.5 315.4 476.8 366.8 418.4 431.4 418.4 496.5 418.4 548.4 477.3 547.4 548.5 547.4 620.2 496 678.6 431.4 678.6ZM860.3 678.6C796.7 678.6 744.3 620.2 744.3 548.5 744.3 476.8 795.7 418.4 860.3 418.4 925.5 418.4 977.4 477.3 976.3 548.5 976.3 620.2 925.5 678.6 860.3 678.6Z",
|
||||
"width": 1291
|
||||
},
|
||||
"search": [
|
||||
"discord-logo-color"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -36,6 +36,12 @@ class Collection extends Model
|
||||
'default' => '',
|
||||
'example' => 'My Collection',
|
||||
])
|
||||
->addRule('enabled', [
|
||||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Collection enabled.',
|
||||
'default' => true,
|
||||
'example' => false,
|
||||
])
|
||||
->addRule('permission', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Collection permission model. Possible values: `document` or `collection`',
|
||||
|
||||
@@ -30,6 +30,70 @@ trait DatabaseBase
|
||||
return ['moviesId' => $movies['body']['$id']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateCollection
|
||||
*/
|
||||
public function testDisableCollection(array $data): void
|
||||
{
|
||||
/**
|
||||
* Test for SUCCESS
|
||||
*/
|
||||
$response = $this->client->call(Client::METHOD_PUT, '/database/collections/' . $data['moviesId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'name' => 'Movies',
|
||||
'enabled' => false,
|
||||
'permission' => 'document',
|
||||
]);
|
||||
|
||||
$this->assertEquals($response['headers']['status-code'], 200);
|
||||
$this->assertFalse($response['body']['enabled']);
|
||||
|
||||
if ($this->getSide() === 'client') {
|
||||
$responseCreateDocument = $this->client->call(Client::METHOD_POST, '/database/collections/' . $data['moviesId'] . '/documents', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'documentId' => 'unique()',
|
||||
'data' => [
|
||||
'title' => 'Captain America',
|
||||
],
|
||||
'read' => ['user:'.$this->getUser()['$id']],
|
||||
'write' => ['user:'.$this->getUser()['$id']],
|
||||
]);
|
||||
|
||||
$responseListDocument = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'] . '/documents', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$responseGetDocument = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'] . '/documents/someID', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals($responseCreateDocument['headers']['status-code'], 404);
|
||||
$this->assertEquals($responseListDocument['headers']['status-code'], 404);
|
||||
$this->assertEquals($responseGetDocument['headers']['status-code'], 404);
|
||||
}
|
||||
|
||||
$response = $this->client->call(Client::METHOD_PUT, '/database/collections/' . $data['moviesId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'name' => 'Movies',
|
||||
'enabled' => true,
|
||||
'permission' => 'document',
|
||||
]);
|
||||
|
||||
$this->assertEquals($response['headers']['status-code'], 200);
|
||||
$this->assertTrue($response['body']['enabled']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @depends testCreateCollection
|
||||
*/
|
||||
@@ -1355,6 +1419,36 @@ trait DatabaseBase
|
||||
'array' => true,
|
||||
]);
|
||||
|
||||
$defaultRequired = $this->client->call(Client::METHOD_POST, '/database/collections/' . $collectionId . '/attributes/integer', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'attributeId' => 'defaultRequired',
|
||||
'required' => true,
|
||||
'default' => 12
|
||||
]);
|
||||
|
||||
$enumDefault = $this->client->call(Client::METHOD_POST, '/database/collections/' . $collectionId . '/attributes/enum', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'attributeId' => 'enumDefault',
|
||||
'elements' => ['north', 'west'],
|
||||
'default' => 'south'
|
||||
]);
|
||||
|
||||
$enumDefaultStrict = $this->client->call(Client::METHOD_POST, '/database/collections/' . $collectionId . '/attributes/enum', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'attributeId' => 'enumDefault',
|
||||
'elements' => ['north', 'west'],
|
||||
'default' => 'NORTH'
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $email['headers']['status-code']);
|
||||
$this->assertEquals(201, $ip['headers']['status-code']);
|
||||
$this->assertEquals(201, $url['headers']['status-code']);
|
||||
@@ -1363,8 +1457,12 @@ trait DatabaseBase
|
||||
$this->assertEquals(201, $probability['headers']['status-code']);
|
||||
$this->assertEquals(201, $upperBound['headers']['status-code']);
|
||||
$this->assertEquals(201, $lowerBound['headers']['status-code']);
|
||||
$this->assertEquals(201, $enum['headers']['status-code']);
|
||||
$this->assertEquals(400, $invalidRange['headers']['status-code']);
|
||||
$this->assertEquals(400, $defaultArray['headers']['status-code']);
|
||||
$this->assertEquals(400, $defaultRequired['headers']['status-code']);
|
||||
$this->assertEquals(400, $enumDefault['headers']['status-code']);
|
||||
$this->assertEquals(400, $enumDefaultStrict['headers']['status-code']);
|
||||
$this->assertEquals('Minimum value must be lesser than maximum value', $invalidRange['body']['message']);
|
||||
$this->assertEquals('Cannot set default value for array attributes', $defaultArray['body']['message']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user