From 12b58b00acfa7add0d8963adf4b22a001b4d1f99 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Wed, 30 Jun 2021 11:10:45 -0400 Subject: [PATCH] Update descriptions/examples for docs Applied suggestions from code review Co-authored-by: Eldad A. Fux --- app/controllers/api/database.php | 20 +++++++++---------- .../Utopia/Response/Model/Collection.php | 8 ++++---- .../Utopia/Response/Model/Document.php | 4 ++-- src/Appwrite/Utopia/Response/Model/Index.php | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 638e58232..f9bbaeee6 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -310,7 +310,7 @@ App::get('v1/database/collections/:collectionId/attributes') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE_LIST) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->inject('response') ->inject('dbForExternal') ->action(function ($collectionId, $response, $dbForExternal) { @@ -348,7 +348,7 @@ App::get('v1/database/collections/:collectionId/attributes/:attributeId') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_ATTRIBUTE) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('attributeId', '', new Key(), 'Attribute ID.') ->inject('response') ->inject('dbForExternal') @@ -389,7 +389,7 @@ App::delete('/v1/database/collections/:collectionId/attributes/:attributeId') ->label('sdk.description', '/docs/references/database/delete-attribute.md') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('attributeId', '', new Key(), 'Attribute ID.') ->inject('response') ->inject('dbForExternal') @@ -452,7 +452,7 @@ App::post('/v1/database/collections/:collectionId/indexes') ->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('id', null, new Key(), 'Index ID.') ->param('type', null, new WhiteList([Database::INDEX_KEY, Database::INDEX_FULLTEXT, Database::INDEX_UNIQUE, Database::INDEX_SPATIAL, Database::INDEX_ARRAY]), 'Index type.') ->param('attributes', null, new ArrayList(new Key()), 'Array of attributes to index.') @@ -517,7 +517,7 @@ App::get('v1/database/collections/:collectionId/indexes') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX_LIST) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->inject('response') ->inject('dbForExternal') ->action(function ($collectionId, $response, $dbForExternal) { @@ -555,7 +555,7 @@ App::get('v1/database/collections/:collectionId/indexes/:indexId') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_INDEX) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('indexId', null, new Key(), 'Index ID.') ->inject('response') ->inject('dbForExternal') @@ -596,7 +596,7 @@ App::delete('/v1/database/collections/:collectionId/indexes/:indexId') ->label('sdk.description', '/docs/references/database/delete-index.md') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) - ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('indexId', '', new Key(), 'Index ID.') ->inject('response') ->inject('dbForExternal') @@ -742,7 +742,7 @@ App::get('/v1/database/collections/:collectionId/documents') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT_LIST) - ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', '', new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('queries', [], new ArrayList(new Text(128)), 'Array of query strings.', true) ->param('limit', 25, new Range(0, 100), 'Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true) ->param('offset', 0, new Range(0, 900000000), 'Offset value. The default value is 0. Use this param to manage pagination.', true) @@ -783,7 +783,7 @@ App::get('/v1/database/collections/:collectionId/documents/:documentId') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_DOCUMENT) - ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('documentId', null, new UID(), 'Document unique ID.') ->inject('response') ->inject('dbForExternal') @@ -888,7 +888,7 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId') ->label('sdk.description', '/docs/references/database/delete-document.md') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_NONE) - ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') + ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection using the Database service [server integration](/docs/server/database#createCollection).') ->param('documentId', null, new UID(), 'Document unique ID.') ->inject('response') ->inject('dbForExternal') diff --git a/src/Appwrite/Utopia/Response/Model/Collection.php b/src/Appwrite/Utopia/Response/Model/Collection.php index a3659e027..4c1db0f53 100644 --- a/src/Appwrite/Utopia/Response/Model/Collection.php +++ b/src/Appwrite/Utopia/Response/Model/Collection.php @@ -15,20 +15,20 @@ class Collection extends Model 'type' => self::TYPE_STRING, 'description' => 'Collection ID.', 'default' => '', - 'example' => '', + 'example' => '5e5ea5c16897e', ]) ->addRule('$read', [ 'type' => self::TYPE_STRING, 'description' => 'Collection read permissions.', 'default' => '', - 'example' => '', + 'example' => 'role:all', 'array' => true ]) ->addRule('$write', [ 'type' => self::TYPE_STRING, 'description' => 'Collection write permissions.', 'default' => '', - 'example' => '', + 'example' => 'user:608f9da25e7e1', 'array' => true ]) ->addRule('name', [ @@ -87,4 +87,4 @@ class Collection extends Model { return Response::MODEL_COLLECTION; } -} \ No newline at end of file +} diff --git a/src/Appwrite/Utopia/Response/Model/Document.php b/src/Appwrite/Utopia/Response/Model/Document.php index ba9092137..2ee8e8cf4 100644 --- a/src/Appwrite/Utopia/Response/Model/Document.php +++ b/src/Appwrite/Utopia/Response/Model/Document.php @@ -45,14 +45,14 @@ class Document extends Any 'type' => self::TYPE_STRING, 'description' => 'Document read permissions.', 'default' => '', - 'example' => '', + 'example' => 'role:all', 'array' => true, ]) ->addRule('$write', [ 'type' => self::TYPE_STRING, 'description' => 'Document write permissions.', 'default' => '', - 'example' => '', + 'example' => 'user:608f9da25e7e1', 'array' => true, ]) ; diff --git a/src/Appwrite/Utopia/Response/Model/Index.php b/src/Appwrite/Utopia/Response/Model/Index.php index f67637a26..3ae1536aa 100644 --- a/src/Appwrite/Utopia/Response/Model/Index.php +++ b/src/Appwrite/Utopia/Response/Model/Index.php @@ -14,7 +14,7 @@ class Index extends Model 'type' => self::TYPE_STRING, 'description' => 'Collection ID.', 'default' => '', - 'example' => '', + 'example' => '5e5ea5c16d55', ]) ->addRule('$id', [ 'type' => self::TYPE_STRING, @@ -73,4 +73,4 @@ class Index extends Model { return Response::MODEL_INDEX; } -} \ No newline at end of file +}