Merge pull request #61197 from nextcloud/enh/noid/streaming-adjustments

On behalf of Julien's request
This commit is contained in:
Daphne Muller 2026-06-12 13:18:13 +02:00 committed by GitHub
commit deefec1a59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 41 additions and 3 deletions

View file

@ -164,11 +164,13 @@ class TaskProcessingApiController extends OCSController {
private function handleScheduleTaskInternal(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
$task = new Task($type, $input, $appId, $this->userId, $customId);
$task->setWebhookUri($webhookUri);
$task->setWebhookMethod($webhookMethod);
$task->setIncludeWatermark($includeWatermark);
$task->setPreferStreaming($preferStreaming);
try {
$this->taskProcessingManager->scheduleTask($task);
@ -202,6 +204,7 @@ class TaskProcessingApiController extends OCSController {
* @param string|null $webhookUri URI to be requested when the task finishes
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
* @param bool $includeWatermark Whether to include a watermark in the output file or not
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
*
* 200: Task scheduled successfully
@ -215,6 +218,7 @@ class TaskProcessingApiController extends OCSController {
public function schedule(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
return $this->handleScheduleTaskInternal(
$input,
@ -224,6 +228,7 @@ class TaskProcessingApiController extends OCSController {
$webhookUri,
$webhookMethod,
$includeWatermark,
$preferStreaming,
);
}
@ -239,6 +244,7 @@ class TaskProcessingApiController extends OCSController {
* @param string|null $webhookUri URI to be requested when the task finishes
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
* @param bool $includeWatermark Whether to include a watermark in the output file or not
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
*
* 200: Task scheduled successfully
@ -251,6 +257,7 @@ class TaskProcessingApiController extends OCSController {
public function scheduleExAppEndpoint(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
return $this->handleScheduleTaskInternal(
$input,
@ -260,6 +267,7 @@ class TaskProcessingApiController extends OCSController {
$webhookUri,
$webhookMethod,
$includeWatermark,
$preferStreaming,
);
}

View file

@ -39,7 +39,7 @@ class Version35000Date20260527162338 extends SimpleMigrationStep {
if (!$table->hasColumn('prefer_streaming')) {
$table->addColumn('prefer_streaming', Types::SMALLINT, [
'notnull' => true,
'default' => 1,
'default' => 0,
'unsigned' => true,
]);
return $schema;

View file

@ -647,6 +647,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}

View file

@ -5098,6 +5098,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
@ -10457,6 +10462,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}

View file

@ -5098,6 +5098,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}

View file

@ -22,7 +22,7 @@ class SynchronousProviderOptions {
*/
public function __construct(
private readonly bool $includeWatermarks = false,
private readonly bool $preferStreaming = true,
private readonly bool $preferStreaming = false,
?callable $reportIntermediateOutput = null,
) {
$this->reportIntermediateOutput = $reportIntermediateOutput !== null

View file

@ -51,7 +51,7 @@ final class Task implements \JsonSerializable {
protected bool $includeWatermark = true;
protected bool $preferStreaming = true;
protected bool $preferStreaming = false;
/**
* @since 30.0.0

View file

@ -8803,6 +8803,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
@ -14165,6 +14170,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}