diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 76dbb6d261..fdd3655266 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1117,7 +1117,7 @@ App::post('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') // Variables -App::post('/v1/functions/:functionId/variables/') +App::post('/v1/functions/:functionId/variables') ->desc('Create Variable') ->groups(['api', 'functions']) ->label('scope', 'functions.write') @@ -1162,7 +1162,7 @@ App::post('/v1/functions/:functionId/variables/') $response->dynamic($variable, Response::MODEL_VARIABLE); }); -App::get('/v1/functions/:functionId/variables/') +App::get('/v1/functions/:functionId/variables') ->desc('List Variables') ->groups(['api', 'functions']) ->label('scope', 'functions.read') @@ -1194,7 +1194,7 @@ App::get('/v1/functions/:functionId/variables/') ]), Response::MODEL_VARIABLE_LIST); }); -App::get('/v1/functions/:functionId/variables//:variableId') +App::get('/v1/functions/:functionId/variables/:variableId') ->desc('Get Variable') ->groups(['api', 'functions']) ->label('scope', 'functions.read') @@ -1228,7 +1228,7 @@ App::get('/v1/functions/:functionId/variables//:variableId') $response->dynamic($variable, Response::MODEL_VARIABLE); }); -App::put('/v1/functions/:functionId/variables//:variableId') +App::put('/v1/functions/:functionId/variables/:variableId') ->desc('Update Variable') ->groups(['api', 'functions']) ->label('scope', 'functions.write') @@ -1281,7 +1281,7 @@ App::put('/v1/functions/:functionId/variables//:variableId') $response->dynamic($variable, Response::MODEL_VARIABLE); }); -App::delete('/v1/functions/:functionId/variables//:variableId') +App::delete('/v1/functions/:functionId/variables/:variableId') ->desc('Delete Variable') ->groups(['api', 'functions']) ->label('scope', 'functions.write') diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index 6ce57959c0..438adc6ad8 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -100,7 +100,7 @@ class FunctionsConsoleClientTest extends Scope */ public function testCreateFunctionVariable(array $data) { - $response = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $data['functionId'], array_merge([ + $response = $this->client->call(Client::METHOD_POST, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -124,7 +124,7 @@ class FunctionsConsoleClientTest extends Scope */ public function testCreateDuplicateVariable(array $data) { - $response = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $data['functionId'], array_merge([ + $response = $this->client->call(Client::METHOD_POST, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -142,7 +142,7 @@ class FunctionsConsoleClientTest extends Scope */ public function testListVariables(array $data) { - $response = $this->client->call(Client::METHOD_GET, '/functions/variables/' . $data['functionId'], array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -160,7 +160,7 @@ class FunctionsConsoleClientTest extends Scope */ public function testGetVariable(array $data) { - $response = $this->client->call(Client::METHOD_GET, '/functions/variables/' . $data['functionId'] . '/' . $data['variableId'], array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -177,7 +177,7 @@ class FunctionsConsoleClientTest extends Scope */ public function testUpdateVariable(array $data) { - $response = $this->client->call(Client::METHOD_PUT, '/functions/variables/' . $data['functionId'] . '/' . $data['variableId'], array_merge([ + $response = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -187,7 +187,7 @@ class FunctionsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - $variable = $this->client->call(Client::METHOD_GET, '/functions/variables/' . $data['functionId'] . '/' . $data['variableId'], array_merge([ + $variable = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -204,14 +204,14 @@ class FunctionsConsoleClientTest extends Scope */ public function testDeleteVariable(array $data) { - $response = $this->client->call(Client::METHOD_DELETE, '/functions/variables/' . $data['functionId'] . '/' . $data['variableId'], array_merge([ + $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); - $response = $this->client->call(Client::METHOD_GET, '/functions/variables/' . $data['functionId'], array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 5de18c57de..b6c367a62a 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -65,7 +65,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $function['body']['$id'], [ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $function['body']['$id'] . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], @@ -74,7 +74,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue1', ]); - $variable2 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $function['body']['$id'], [ + $variable2 = $this->client->call(Client::METHOD_POST, '/functions/' . $function['body']['$id'] . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], @@ -83,7 +83,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue2', ]); - $variable3 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $function['body']['$id'], [ + $variable3 = $this->client->call(Client::METHOD_POST, '/functions/' . $function['body']['$id'] . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], @@ -179,7 +179,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, @@ -188,7 +188,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue1', ]); - $variable2 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable2 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, @@ -197,7 +197,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue2', ]); - $variable3 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable3 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, @@ -391,7 +391,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, @@ -400,7 +400,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue1', ]); - $variable2 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable2 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, @@ -409,7 +409,7 @@ class FunctionsCustomClientTest extends Scope 'value' => 'funcValue2', ]); - $variable3 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, [ + $variable3 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, 'x-appwrite-key' => $apikey, diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index e07b7ac330..cdcb8e8659 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -53,7 +53,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(10, $response1['body']['timeout']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -61,7 +61,7 @@ class FunctionsCustomServerTest extends Scope 'value' => 'funcValue1', ]); - $variable2 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable2 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -69,7 +69,7 @@ class FunctionsCustomServerTest extends Scope 'value' => 'funcValue2', ]); - $variable3 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable3 = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -155,7 +155,7 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($response['body']['$id']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $response['body']['$id'], array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $response['body']['$id'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -163,7 +163,7 @@ class FunctionsCustomServerTest extends Scope 'value' => 'funcValue1', ]); - $variable2 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $response['body']['$id'], array_merge([ + $variable2 = $this->client->call(Client::METHOD_POST, '/functions/' . $response['body']['$id'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -171,7 +171,7 @@ class FunctionsCustomServerTest extends Scope 'value' => 'funcValue2', ]); - $variable3 = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $response['body']['$id'], array_merge([ + $variable3 = $this->client->call(Client::METHOD_POST, '/functions/' . $response['body']['$id'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -949,7 +949,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); // Create variable - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -1062,7 +1062,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -1175,7 +1175,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ @@ -1288,7 +1288,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); /** Create Variables */ - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $functionId, array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 61eccb018e..78b98793cb 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -450,7 +450,7 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($function['body']['$id'], $data['functionId']); // Create variable - $variable = $this->client->call(Client::METHOD_POST, '/functions/variables/' . $data['functionId'], array_merge([ + $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [