diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 7f571f066e..a91b457d9f 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -1,14 +1,10 @@ desc('Install GitHub app') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') + ->label('sdk.namespace', 'vcs') ->label('error', __DIR__ . '/../../views/general/error.phtml') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'createGitHubInstallation', - description: '/docs/references/vcs/create-github-installation.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_MOVED_PERMANENTLY, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::HTML, - type: MethodType::WEBAUTH, - hide: true, - )) + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'createGitHubInstallation') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_MOVED_PERMANENTLY) + ->label('sdk.response.type', Response::CONTENT_TYPE_HTML) + ->label('sdk.methodType', 'webAuth') + ->label('sdk.hide', true) ->param('success', '', fn ($clients) => new Host($clients), 'URL to redirect back to console after a successful installation attempt.', true, ['clients']) ->param('failure', '', fn ($clients) => new Host($clients), 'URL to redirect back to console after a failed installation attempt.', true, ['clients']) ->inject('request') @@ -454,18 +443,13 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro ->desc('Get files and directories of a VCS repository') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'getRepositoryContents', - description: '/docs/references/vcs/get-repository-contents.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_VCS_CONTENT_LIST, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'getRepositoryContents') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_VCS_CONTENT_LIST) ->param('installationId', '', new Text(256), 'Installation Id') ->param('providerRepositoryId', '', new Text(256), 'Repository Id') ->param('providerRootDirectory', '', new Text(256, 0), 'Path to get contents of nested directory', true) @@ -520,18 +504,13 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr ->desc('Detect runtime settings from source code') ->groups(['api', 'vcs']) ->label('scope', 'vcs.write') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'createRepositoryDetection', - description: '/docs/references/vcs/create-repository-detection.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_DETECTION, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'createRepositoryDetection') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_DETECTION) ->param('installationId', '', new Text(256), 'Installation Id') ->param('providerRepositoryId', '', new Text(256), 'Repository Id') ->param('providerRootDirectory', '', new Text(256, 0), 'Path to Root Directory', true) @@ -597,18 +576,13 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories') ->desc('List repositories') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'listRepositories', - description: '/docs/references/vcs/list-repositories.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_PROVIDER_REPOSITORY_LIST, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'listRepositories') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY_LIST) ->param('installationId', '', new Text(256), 'Installation Id') ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('gitHub') @@ -697,18 +671,13 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories') ->desc('Create repository') ->groups(['api', 'vcs']) ->label('scope', 'vcs.write') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'createRepository', - description: '/docs/references/vcs/create-repository.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_PROVIDER_REPOSITORY, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'createRepository') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY) ->param('installationId', '', new Text(256), 'Installation Id') ->param('name', '', new Text(256), 'Repository name (slug)') ->param('private', '', new Boolean(false), 'Mark repository public or private') @@ -809,18 +778,13 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro ->desc('Get repository') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'getRepository', - description: '/docs/references/vcs/get-repository.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_PROVIDER_REPOSITORY, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'getRepository') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_PROVIDER_REPOSITORY) ->param('installationId', '', new Text(256), 'Installation Id') ->param('providerRepositoryId', '', new Text(256), 'Repository Id') ->inject('gitHub') @@ -863,18 +827,13 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro ->desc('List repository branches') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'listRepositoryBranches', - description: '/docs/references/vcs/list-repository-branches.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_BRANCH_LIST, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'listRepositoryBranches') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_BRANCH_LIST) ->param('installationId', '', new Text(256), 'Installation Id') ->param('providerRepositoryId', '', new Text(256), 'Repository Id') ->inject('gitHub') @@ -926,7 +885,6 @@ App::post('/v1/vcs/github/events') ->action( function (GitHub $github, Request $request, Response $response, Database $dbForPlatform, callable $getProjectDB, Build $queueForBuilds) use ($createGitDeployments) { $payload = $request->getRawPayload(); - var_dump(['payload' => $payload]); $signatureRemote = $request->getHeader('x-hub-signature-256', ''); $signatureLocal = System::getEnv('_APP_VCS_GITHUB_WEBHOOK_SECRET', ''); @@ -1057,18 +1015,13 @@ App::get('/v1/vcs/installations') ->desc('List installations') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'listInstallations', - description: '/docs/references/vcs/list-installations.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_INSTALLATION_LIST, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'listInstallations') + ->label('sdk.description', '/docs/references/vcs/list-installations.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_INSTALLATION_LIST) ->param('queries', [], new Installations(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Installations::ALLOWED_ATTRIBUTES), true) ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('response') @@ -1128,18 +1081,13 @@ App::get('/v1/vcs/installations/:installationId') ->desc('Get installation') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'getInstallation', - description: '/docs/references/vcs/get-installation.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_OK, - model: Response::MODEL_INSTALLATION, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'getInstallation') + ->label('sdk.description', '/docs/references/vcs/get-installation.md') + ->label('sdk.response.code', Response::STATUS_CODE_OK) + ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) + ->label('sdk.response.model', Response::MODEL_INSTALLATION) ->param('installationId', '', new Text(256), 'Installation Id') ->inject('response') ->inject('project') @@ -1162,19 +1110,12 @@ App::delete('/v1/vcs/installations/:installationId') ->desc('Delete installation') ->groups(['api', 'vcs']) ->label('scope', 'vcs.write') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'deleteInstallation', - description: '/docs/references/vcs/delete-installation.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_NOCONTENT, - model: Response::MODEL_NONE, - ) - ], - contentType: ContentType::NONE - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'deleteInstallation') + ->label('sdk.description', '/docs/references/vcs/delete-installation.md') + ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) + ->label('sdk.response.model', Response::MODEL_NONE) ->param('installationId', '', new Text(256), 'Installation Id') ->inject('response') ->inject('project') @@ -1202,18 +1143,12 @@ App::patch('/v1/vcs/github/installations/:installationId/repositories/:repositor ->desc('Authorize external deployment') ->groups(['api', 'vcs']) ->label('scope', 'vcs.write') - ->label('sdk', new Method( - namespace: 'vcs', - name: 'updateExternalDeployments', - description: '/docs/references/vcs/update-external-deployments.md', - auth: [AuthType::ADMIN], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_NOCONTENT, - model: Response::MODEL_NONE, - ) - ] - )) + ->label('sdk.namespace', 'vcs') + ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) + ->label('sdk.method', 'updateExternalDeployments') + ->label('sdk.description', '') + ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) + ->label('sdk.response.model', Response::MODEL_NONE) ->param('installationId', '', new Text(256), 'Installation Id') ->param('repositoryId', '', new Text(256), 'VCS Repository Id') ->param('providerPullRequestId', '', new Text(256), 'GitHub Pull Request Id') diff --git a/composer.json b/composer.json index dfbc834ed2..cce79cc928 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", "utopia-php/framework": "0.33.*", - "utopia-php/fetch": "0.2.*", + "utopia-php/fetch": "0.3.*", "utopia-php/image": "0.7.*", "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.6.*", diff --git a/composer.lock b/composer.lock index 67ab9706d6..04fda4af4f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1ca8e90732c949ace1f05ef3ceaf819b", + "content-hash": "437347e8b0264137ab3a4427b5334ed4", "packages": [ { "name": "adhocore/jwt", @@ -3639,16 +3639,16 @@ }, { "name": "utopia-php/fetch", - "version": "0.2.1", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/utopia-php/fetch.git", - "reference": "1423c0ee3eef944d816ca6e31706895b585aea82" + "reference": "02b12c05aec13399dcc2da8d51f908e328ab63f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/fetch/zipball/1423c0ee3eef944d816ca6e31706895b585aea82", - "reference": "1423c0ee3eef944d816ca6e31706895b585aea82", + "url": "https://api.github.com/repos/utopia-php/fetch/zipball/02b12c05aec13399dcc2da8d51f908e328ab63f4", + "reference": "02b12c05aec13399dcc2da8d51f908e328ab63f4", "shasum": "" }, "require": { @@ -3672,9 +3672,9 @@ "description": "A simple library that provides an interface for making HTTP Requests.", "support": { "issues": "https://github.com/utopia-php/fetch/issues", - "source": "https://github.com/utopia-php/fetch/tree/0.2.1" + "source": "https://github.com/utopia-php/fetch/tree/0.3.0" }, - "time": "2024-03-18T11:50:59+00:00" + "time": "2025-01-17T06:11:10+00:00" }, { "name": "utopia-php/framework",