Merge branch '0.7.x' of github.com:appwrite/appwrite into 0.7.x
This commit is contained in:
commit
4e38953a9e
6 changed files with 86 additions and 19 deletions
|
@ -436,7 +436,7 @@ App::post('/v1/functions/:functionId/tags')
|
|||
->label('sdk.response.model', Response::MODEL_TAG)
|
||||
->param('functionId', '', new UID(), 'Function unique ID.')
|
||||
->param('command', '', new Text('1028'), 'Code execution command.')
|
||||
->param('file', null, new File(), 'Gzip file with your code package.', false)
|
||||
->param('code', null, new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false)
|
||||
->inject('request')
|
||||
->inject('response')
|
||||
->inject('projectDB')
|
||||
|
@ -453,7 +453,7 @@ App::post('/v1/functions/:functionId/tags')
|
|||
throw new Exception('Function not found', 404);
|
||||
}
|
||||
|
||||
$file = $request->getFiles('file');
|
||||
$file = $request->getFiles('code');
|
||||
$device = Storage::getDevice('functions');
|
||||
$fileExt = new FileExt([FileExt::TYPE_GZIP]);
|
||||
$fileSize = new FileSize(App::getEnv('_APP_STORAGE_LIMIT', 0));
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Functions functions = Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
Future result = functions.createExecution(
|
||||
functionId: '[FUNCTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Functions functions = Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
Future result = functions.getExecution(
|
||||
functionId: '[FUNCTION_ID]',
|
||||
executionId: '[EXECUTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import 'package:appwrite/appwrite.dart';
|
||||
|
||||
void main() { // Init SDK
|
||||
Client client = Client();
|
||||
Functions functions = Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
Future result = functions.listExecutions(
|
||||
functionId: '[FUNCTION_ID]',
|
||||
);
|
||||
|
||||
result
|
||||
.then((response) {
|
||||
print(response);
|
||||
}).catchError((error) {
|
||||
print(error.response);
|
||||
});
|
||||
}
|
|
@ -76,7 +76,7 @@ class FunctionsCustomClientTest extends Scope
|
|||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], [
|
||||
'command' => 'php function.php',
|
||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
]);
|
||||
|
||||
$tagId = $tag['body']['$id'] ?? '';
|
||||
|
|
|
@ -184,7 +184,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'command' => 'php function.php',
|
||||
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
|
||||
]);
|
||||
|
||||
$tagId = $tag['body']['$id'] ?? '';
|
||||
|
@ -467,7 +467,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'PHP',
|
||||
'version' => '7.4',
|
||||
'name' => 'php-7.4',
|
||||
'file' => $functions.'/php.tar.gz',
|
||||
'code' => $functions.'/php.tar.gz',
|
||||
'command' => 'php index.php',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -475,7 +475,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'PHP',
|
||||
'version' => '8.0',
|
||||
'name' => 'php-8.0',
|
||||
'file' => $functions.'/php.tar.gz',
|
||||
'code' => $functions.'/php.tar.gz',
|
||||
'command' => 'php index.php',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -483,7 +483,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Python',
|
||||
'version' => '3.8',
|
||||
'name' => 'python-3.8',
|
||||
'file' => $functions.'/python.tar.gz',
|
||||
'code' => $functions.'/python.tar.gz',
|
||||
'command' => 'python main.py',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -491,7 +491,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Node.js',
|
||||
'version' => '14.5',
|
||||
'name' => 'node-14.5',
|
||||
'file' => $functions.'/node.tar.gz',
|
||||
'code' => $functions.'/node.tar.gz',
|
||||
'command' => 'node index.js',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -499,7 +499,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Node.js',
|
||||
'version' => '15.5',
|
||||
'name' => 'node-15.5',
|
||||
'file' => $functions.'/node.tar.gz',
|
||||
'code' => $functions.'/node.tar.gz',
|
||||
'command' => 'node index.js',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -507,7 +507,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Ruby',
|
||||
'version' => '2.7',
|
||||
'name' => 'ruby-2.7',
|
||||
'file' => $functions.'/ruby.tar.gz',
|
||||
'code' => $functions.'/ruby.tar.gz',
|
||||
'command' => 'ruby app.rb',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -515,7 +515,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Ruby',
|
||||
'version' => '3.0',
|
||||
'name' => 'ruby-3.0',
|
||||
'file' => $functions.'/ruby.tar.gz',
|
||||
'code' => $functions.'/ruby.tar.gz',
|
||||
'command' => 'ruby app.rb',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -523,7 +523,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Deno',
|
||||
'version' => '1.5',
|
||||
'name' => 'deno-1.5',
|
||||
'file' => $functions.'/deno.tar.gz',
|
||||
'code' => $functions.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -531,7 +531,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Deno',
|
||||
'version' => '1.6',
|
||||
'name' => 'deno-1.6',
|
||||
'file' => $functions.'/deno.tar.gz',
|
||||
'code' => $functions.'/deno.tar.gz',
|
||||
'command' => 'deno run --allow-env index.ts',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -539,7 +539,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => 'Dart',
|
||||
'version' => '2.10',
|
||||
'name' => 'dart-2.10',
|
||||
'file' => $functions.'/dart.tar.gz',
|
||||
'code' => $functions.'/dart.tar.gz',
|
||||
'command' => 'dart main.dart',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -547,7 +547,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => '.NET',
|
||||
'version' => '3.1',
|
||||
'name' => 'dotnet-3.1',
|
||||
'file' => $functions.'/dotnet-3.1.tar.gz',
|
||||
'code' => $functions.'/dotnet-3.1.tar.gz',
|
||||
'command' => 'dotnet dotnet.dll',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -555,7 +555,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'language' => '.NET',
|
||||
'version' => '5.0',
|
||||
'name' => 'dotnet-5.0',
|
||||
'file' => $functions.'/dotnet-5.0.tar.gz',
|
||||
'code' => $functions.'/dotnet-5.0.tar.gz',
|
||||
'command' => 'dotnet dotnet.dll',
|
||||
'timeout' => 15,
|
||||
],
|
||||
|
@ -586,7 +586,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
$language = $env['language'] ?? '';
|
||||
$version = $env['version'] ?? '';
|
||||
$name = $env['name'] ?? '';
|
||||
$code = $env['file'] ?? '';
|
||||
$code = $env['code'] ?? '';
|
||||
$command = $env['command'] ?? '';
|
||||
$timeout = $env['timeout'] ?? 15;
|
||||
|
||||
|
@ -618,7 +618,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'command' => $command,
|
||||
'file' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||
'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||
]);
|
||||
|
||||
$tagId = $tag['body']['$id'] ?? '';
|
||||
|
@ -716,7 +716,7 @@ class FunctionsCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'command' => $command,
|
||||
'file' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||
'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
|
||||
]);
|
||||
|
||||
$tagId = $tag['body']['$id'] ?? '';
|
||||
|
|
Loading…
Reference in a new issue