1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

depricate name params

This commit is contained in:
Damodar Lohani 2021-07-22 10:57:01 +05:45
parent df6645c9ab
commit e88450268b
10 changed files with 6 additions and 75 deletions

View file

@ -10,7 +10,6 @@ $collections = [
'projects' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'projects',
'name' => 'Projects',
'attributes' => [
[
'$id' => 'teamId',
@ -214,7 +213,6 @@ $collections = [
'users' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'users',
'name' => 'Users',
'attributes' => [
[
'$id' => 'name',
@ -363,7 +361,6 @@ $collections = [
'sessions' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'sessions',
'name' => 'Sessions',
'attributes' => [
[
'$id' => 'userId',
@ -611,19 +608,7 @@ $collections = [
'teams' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'teams',
'name' => 'Teams',
'attributes' => [
[
'$id' => 'name',
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => 'dateCreated',
'type' => Database::VAR_INTEGER,
@ -661,7 +646,6 @@ $collections = [
'memberships' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'memberships',
'name' => 'Memberships',
'attributes' => [
[
'$id' => 'teamId',
@ -769,7 +753,6 @@ $collections = [
'files' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'files',
'name' => 'Files',
'attributes' => [
[
'$id' => 'dateCreated',
@ -948,7 +931,6 @@ $collections = [
'functions' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'functions',
'name' => 'Functions',
'attributes' => [
[
'$id' => 'execute',
@ -1090,7 +1072,6 @@ $collections = [
'tags' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'tags',
'name' => 'Tags',
'attributes' => [
[
'$id' => 'dateCreated',
@ -1163,7 +1144,6 @@ $collections = [
'executions' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'executions',
'name' => 'Executions',
'attributes' => [
[
'$id' => 'dateCreated',
@ -1280,7 +1260,6 @@ $collections = [
'certificates' => [
'$collection' => Database::COLLECTIONS,
'$id' => 'certificates',
'name' => 'Certificates',
'attributes' => [
[
'$id' => 'domain',

View file

@ -37,13 +37,12 @@ App::post('/v1/database/collections')
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_COLLECTION)
->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.')
->param('read', null, new Permissions(), 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->param('write', null, new Permissions(), 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
->inject('response')
->inject('dbForExternal')
->inject('audits')
->action(function ($collectionId, $name, $read, $write, $response, $dbForExternal, $audits) {
->action(function ($collectionId, $read, $write, $response, $dbForExternal, $audits) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForExternal*/
/** @var Appwrite\Event\Event $audits */
@ -56,7 +55,6 @@ App::post('/v1/database/collections')
$read = (is_null($read)) ? ($collection->getRead() ?? []) : $read; // By default inherit read permissions
$write = (is_null($write)) ? ($collection->getWrite() ?? []) : $write; // By default inherit write permissions
$collection->setAttribute('name', $name);
$collection->setAttribute('$read', $read);
$collection->setAttribute('$write', $write);

View file

@ -606,7 +606,6 @@ App::post('/v1/projects/:projectId/webhooks')
->label('sdk.response.model', Response::MODEL_WEBHOOK)
->param('webhookId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, new Text(128), 'Webhook name. Max length: 128 chars.')
->param('events', null, new ArrayList(new WhiteList(array_keys(Config::getParam('events'), true), true)), 'Events list.')
->param('url', null, new URL(), 'Webhook URL.')
->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
@ -614,7 +613,7 @@ App::post('/v1/projects/:projectId/webhooks')
->param('httpPass', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true)
->inject('response')
->inject('dbForConsole')
->action(function ($webhookId, $projectId, $name, $events, $url, $security, $httpUser, $httpPass, $response, $dbForConsole) {
->action(function ($webhookId, $projectId, $events, $url, $security, $httpUser, $httpPass, $response, $dbForConsole) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForConsole */
@ -628,7 +627,6 @@ App::post('/v1/projects/:projectId/webhooks')
$webhook = new Document([
'$id' => $webhookId == 'unique()' ? $dbForConsole->getId() : $webhookId,
'name' => $name,
'events' => $events,
'url' => $url,
'security' => $security,
@ -806,11 +804,10 @@ App::post('/v1/projects/:projectId/keys')
->label('sdk.response.model', Response::MODEL_KEY)
->param('keyId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
->param('scopes', null, new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true)), 'Key scopes list.')
->inject('response')
->inject('dbForConsole')
->action(function ($keyId, $projectId, $name, $scopes, $response, $dbForConsole) {
->action(function ($keyId, $projectId, $scopes, $response, $dbForConsole) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForConsole */
@ -822,7 +819,6 @@ App::post('/v1/projects/:projectId/keys')
$key = new Document([
'$id' => $keyId == 'unique()' ? $dbForConsole->getId() : $keyId,
'name' => $name,
'scopes' => $scopes,
'secret' => \bin2hex(\random_bytes(128)),
]);
@ -984,7 +980,6 @@ App::post('/v1/projects/:projectId/tasks')
->label('sdk.response.model', Response::MODEL_TASK)
->param('taskId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, new Text(128), 'Task name. Max length: 128 chars.')
->param('status', null, new WhiteList(['play', 'pause'], true), 'Task status.')
->param('schedule', null, new Cron(), 'Task schedule CRON syntax.')
->param('security', false, new Boolean(true), 'Certificate verification, false for disabled or true for enabled.')
@ -995,7 +990,7 @@ App::post('/v1/projects/:projectId/tasks')
->param('httpPass', '', new Text(256), 'Task HTTP password. Max length: 256 chars.', true)
->inject('response')
->inject('dbForConsole')
->action(function ($taskId, $projectId, $name, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $dbForConsole) {
->action(function ($taskId, $projectId, $status, $schedule, $security, $httpMethod, $httpUrl, $httpHeaders, $httpUser, $httpPass, $response, $dbForConsole) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForConsole */
@ -1012,7 +1007,6 @@ App::post('/v1/projects/:projectId/tasks')
$task = new Document([
'$id' => $taskId == 'unique()' ? $dbForConsole->getId() : $taskId,
'projectId' => $project->getId(),
'name' => $name,
'status' => $status,
'schedule' => $schedule,
'updated' => \time(),
@ -1218,13 +1212,12 @@ App::post('/v1/projects/:projectId/platforms')
->param('platformId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('projectId', null, new UID(), 'Project unique ID.')
->param('type', null, new WhiteList(['web', 'flutter-ios', 'flutter-android', 'flutter-linux', 'flutter-macos', 'flutter-windows', 'ios', 'android', 'unity'], true), 'Platform type.')
->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.')
->param('key', '', new Text(256), 'Package name for android or bundle ID for iOS. Max length: 256 chars.', true)
->param('store', '', new Text(256), 'App store or Google Play store ID. Max length: 256 chars.', true)
->param('hostname', '', new Text(256), 'Platform client hostname. Max length: 256 chars.', true)
->inject('response')
->inject('dbForConsole')
->action(function ($platformId, $projectId, $type, $name, $key, $store, $hostname, $response, $dbForConsole) {
->action(function ($platformId, $projectId, $type, $key, $store, $hostname, $response, $dbForConsole) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForConsole */
@ -1237,7 +1230,6 @@ App::post('/v1/projects/:projectId/platforms')
$platform = new Document([
'$id' => $platformId == 'unique()' ? $dbForConsole->getId() : $platformId,
'type' => $type,
'name' => $name,
'key' => $key,
'store' => $store,
'hostname' => $hostname,

View file

@ -34,12 +34,11 @@ App::post('/v1/teams')
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TEAM)
->param('teamId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('name', null, new Text(128), 'Team name. Max length: 128 chars.')
->param('roles', ['owner'], new ArrayList(new Key()), 'Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Max length for each role is 32 chars.', true)
->inject('response')
->inject('user')
->inject('dbForInternal')
->action(function ($teamId, $name, $roles, $response, $user, $dbForInternal) {
->action(function ($teamId, $roles, $response, $user, $dbForInternal) {
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Document $user */
/** @var Utopia\Database\Database $dbForInternal */
@ -54,7 +53,6 @@ App::post('/v1/teams')
'$id' => $teamId ,
'$read' => ['team:'.$teamId],
'$write' => ['team:'.$teamId .'/owner'],
'name' => $name,
'sum' => ($isPrivilegedUser || $isAppUser) ? 0 : 1,
'dateCreated' => \time(),
]));

View file

@ -31,12 +31,6 @@ class Collection extends Model
'example' => 'user:608f9da25e7e1',
'array' => true
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Collection name.',
'default' => '',
'example' => '',
])
->addRule('attributes', [
'type' => Response::MODEL_ATTRIBUTE,
'description' => 'Collection attributes.',

View file

@ -21,12 +21,6 @@ class Key extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Key name.',
'default' => '',
'example' => 'My API Key',
])
->addRule('scopes', [
'type' => self::TYPE_STRING,
'description' => 'Allowed permission scopes.',

View file

@ -21,12 +21,6 @@ class Platform extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Platform name.',
'default' => '',
'example' => 'My Web App',
])
->addRule('type', [
'type' => self::TYPE_STRING,
'description' => 'Platform type. Possible values are: web, flutter-ios, flutter-android, ios, android, and unity.',

View file

@ -27,12 +27,6 @@ class Task extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Task name.',
'default' => '',
'example' => 'My Task',
])
->addRule('security', [
'type' => self::TYPE_BOOLEAN,
'description' => 'Indicated if SSL / TLS Certificate verification is enabled.',

View file

@ -16,12 +16,6 @@ class Team extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Team name.',
'default' => '',
'example' => 'VIP',
])
->addRule('dateCreated', [
'type' => self::TYPE_INTEGER,
'description' => 'Team creation date in Unix timestamp.',

View file

@ -21,12 +21,6 @@ class Webhook extends Model
'default' => '',
'example' => '5e5ea5c16897e',
])
->addRule('name', [
'type' => self::TYPE_STRING,
'description' => 'Webhook name.',
'default' => '',
'example' => 'My Webhook',
])
->addRule('url', [
'type' => self::TYPE_STRING,
'description' => 'Webhook URL endpoint.',