chore: update descriptions for token endpoints

This commit is contained in:
Chirag Aggarwal 2025-02-06 11:08:58 +00:00
parent c269fc22ed
commit d1502bc7d6
9 changed files with 32 additions and 12 deletions

View file

@ -47,7 +47,9 @@ class Create extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'createFileToken',
description: '',
description: <<<EOT
Create a new token. A token is linked to a file or a bucket and manages permissions for those file(s). Token can be passed as a header or request get parameter.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -37,7 +37,9 @@ class XList extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'list',
description: '',
description: <<<EOT
List all the tokens created for a specific file or bucket. You can use the query params to filter your results.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -41,7 +41,9 @@ class Delete extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'delete',
description: '',
description: <<<EOT
Delete a token by its unique ID.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -34,7 +34,9 @@ class Get extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'get',
description: '',
description: <<<EOT
Get a token by its unique ID.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -37,7 +37,9 @@ class Get extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'getJWT',
description: '',
description: <<<EOT
Get a JWT based token by its unique ID. You can use the JWT to authenticate on behalf of the user.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -48,7 +48,9 @@ class Update extends Action
->label('sdk', new Method(
namespace: 'tokens',
name: 'update',
description: '',
description: <<<EOT
Update a token by its unique ID. Use this endpoint to update a token's expiry date or permissions.
EOT,
auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT],
responses: [
new SDKResponse(

View file

@ -87,11 +87,13 @@ class Method
return;
}
$descPath = $this->getDescriptionFilePath();
if (\str_ends_with($desc, '.md')) {
$descPath = $this->getDescriptionFilePath();
if (empty($descPath)) {
self::$errors[] = "Error with {$this->getRouteName()} method: Description file not found at {$desc}";
return;
if (empty($descPath)) {
self::$errors[] = "Error with {$this->getRouteName()} method: Description file not found at {$desc}";
return;
}
}
}

View file

@ -177,11 +177,14 @@ class OpenAPI3 extends Format
$namespace = $sdk->getNamespace() ?? 'default';
$desc = $desc ?? '';
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
$temp = [
'summary' => $route->getDesc(),
'operationId' => $namespace . ucfirst($method),
'tags' => [$namespace],
'description' => ($desc) ? \file_get_contents($desc) : '',
'description' => $descContents,
'responses' => [],
'x-appwrite' => [ // Appwrite related metadata
'method' => $method,

View file

@ -173,13 +173,16 @@ class Swagger2 extends Format
$namespace = $sdk->getNamespace() ?? 'default';
$desc = $desc ?? '';
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
$temp = [
'summary' => $route->getDesc(),
'operationId' => $namespace . ucfirst($method),
'consumes' => [],
'produces' => [],
'tags' => [$namespace],
'description' => ($desc) ? \file_get_contents($desc) : '',
'description' => $descContents,
'responses' => [],
'x-appwrite' => [ // Appwrite related metadata
'method' => $method,