addressing comments

This commit is contained in:
shimon
2022-08-25 09:56:37 +03:00
parent ed93e54480
commit 6d2d115fd3
4 changed files with 18 additions and 6 deletions
+1 -2
View File
@@ -226,7 +226,6 @@ App::get('/v1/videos')
->label('sdk.response.code', Response::STATUS_CODE_OK)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_VIDEO)
->param('videoId', '', new UID(), 'Video unique ID.')
->param('limit', 25, new Range(0, 100), 'Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.', true)
->param('offset', 0, new Range(0, APP_LIMIT_COUNT), 'Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)', true)
->param('cursor', '', new UID(), 'ID of the file used as the starting point for the query, excluding the file itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)', true)
@@ -234,7 +233,7 @@ App::get('/v1/videos')
->param('orderType', 'ASC', new WhiteList(['ASC', 'DESC'], true), 'Order result by ASC or DESC order.', true)
->inject('response')
->inject('dbForProject')
->action(function (string $videoId, int $limit, int $offset, string $cursor, string $cursorDirection, string $orderType, Response $response, Database $dbForProject) {
->action(function (int $limit, int $offset, string $cursor, string $cursorDirection, string $orderType, Response $response, Database $dbForProject) {
if (!empty($cursor)) {
$cursorFile = $dbForProject->getDocument('videos', $cursor);
+2 -2
View File
@@ -844,8 +844,8 @@ App::setResource('project', function ($dbForConsole, $request, $console) {
/** @var Utopia\Database\Database $dbForConsole */
/** @var Utopia\Database\Document $console */
$projectId = 'dev';
//$projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', 'console'));
//$projectId = 'dev';
$projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', 'console'));
if ($projectId === 'console') {
return $console;
-1
View File
@@ -56,7 +56,6 @@ class TranscodingV1 extends Worker
return "Transcoding";
}
public function init(): void
{
@@ -525,7 +525,7 @@ class VideoCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(1506, strlen($response['body']));
$this->assertEquals(1508, strlen($response['body']));
$response = $this->client->call(Client::METHOD_GET, '/videos/' . $videoId . '/streams/dash', [
'content-type' => 'application/json',
@@ -829,4 +829,18 @@ class VideoCustomServerTest extends Scope
$this->assertTrue($isVideo);
$this->assertTrue($isAudio);
}
public function testGetVideos()
{
$response = $this->client->call(Client::METHOD_GET, '/videos', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertGreaterThan(0, $response['body']['total']);
$this->assertGreaterThan(0, count($response['body']['videos']));
}
}