feat(API): Add Public API endpoint for updating variables (#15315)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-05-12 16:50:24 +02:00
committed by GitHub
parent 2674d7fe61
commit 52bf9203f0
4 changed files with 82 additions and 31 deletions
@@ -8,9 +8,35 @@ delete:
parameters:
- $ref: '../schemas/parameters/variableId.yml'
responses:
'204':
'201':
description: Operation successful.
'401':
$ref: '../../../../shared/spec/responses/unauthorized.yml'
'404':
$ref: '../../../../shared/spec/responses/notFound.yml'
put:
x-eov-operation-id: updateVariable
x-eov-operation-handler: v1/handlers/variables/variables.handler
tags:
- Variables
summary: Update a variable
description: Update a variable from your instance.
requestBody:
description: Payload for variable to update.
content:
application/json:
schema:
$ref: '../schemas/variable.yml'
required: true
responses:
'204':
description: Operation successful.
'400':
$ref: '../../../../shared/spec/responses/badRequest.yml'
'401':
$ref: '../../../../shared/spec/responses/unauthorized.yml'
'403':
$ref: '../../../../shared/spec/responses/forbidden.yml'
'404':
$ref: '../../../../shared/spec/responses/notFound.yml'
@@ -27,6 +27,15 @@ export = {
res.status(201).send();
},
],
updateVariable: [
isLicensed('feat:variables'),
apiKeyHasScopeWithGlobalScopeFallback({ scope: 'variable:update' }),
async (req: VariablesRequest.Update, res: Response) => {
await Container.get(VariablesController).updateVariable(req);
res.status(204).send();
},
],
deleteVariable: [
isLicensed('feat:variables'),
apiKeyHasScopeWithGlobalScopeFallback({ scope: 'variable:delete' }),