diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 79134eebbb..88e919730e 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -2361,15 +2361,15 @@ App::get('/v1/functions/templates') ->desc('List function templates') ->label('scope', 'public') ->label('sdk.namespace', 'functions') - ->label('sdk.method', 'listFunctionTemplates') - ->label('sdk.description', '/docs/references/functions/list-function-templates.md') + ->label('sdk.method', 'listTemplates') + ->label('sdk.description', '/docs/references/functions/list-templates.md') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_TEMPLATE_FUNCTION_LIST) ->param('runtimes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('runtimes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of runtimes allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' runtimes are allowed.', true) - ->param('usecases', [], new ArrayList(new WhiteList(['dev-tools','starter','databases','ai','messaging','utilities']), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of usecases allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' usecases are allowed.', true) - ->param('limit', 100, new Range(0, 100), 'Limit the number of templates returned in the response. Max limit: 100.', true) - ->param('offset', 0, new Range(0, 100), 'Offset the list of returned templates. Max offset: 100.', true) + ->param('useCases', [], new ArrayList(new WhiteList(['dev-tools','starter','databases','ai','messaging','utilities']), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of usecases allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' usecases are allowed.', true) + ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) + ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) ->inject('response') ->action(function (array $runtimes, array $usecases, int $limit, int $offset, Response $response) { $templates = Config::getParam('function-templates', []); diff --git a/docs/references/functions/list-function-templates.md b/docs/references/functions/list-function-templates.md deleted file mode 100644 index b6195b43c3..0000000000 --- a/docs/references/functions/list-function-templates.md +++ /dev/null @@ -1 +0,0 @@ -List function templates from marketplace. \ No newline at end of file diff --git a/docs/references/functions/list-templates.md b/docs/references/functions/list-templates.md new file mode 100644 index 0000000000..ed43b9cbf4 --- /dev/null +++ b/docs/references/functions/list-templates.md @@ -0,0 +1 @@ +List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. \ No newline at end of file diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php index 5fdbd95a35..7a3a4cfbd5 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateFunction.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateFunction.php @@ -16,7 +16,7 @@ class TemplateFunction extends Model 'default' => '', 'example' => 'icon-lightning-bolt', ]) - ->addRule('$id', [ + ->addRule('id', [ 'type' => self::TYPE_STRING, 'description' => 'Function Template ID.', 'default' => '', @@ -60,9 +60,9 @@ class TemplateFunction extends Model 'default' => 15, 'example' => 300, ]) - ->addRule('usecases', [ + ->addRule('useCases', [ 'type' => self::TYPE_STRING, - 'description' => 'Function usecases.', + 'description' => 'Function use cases.', 'default' => [], 'example' => 'Starter', 'array' => true,