Skip to content

Commit 0693069

Browse files
committed
Updated task and added webhook-url
1 parent 01b36e3 commit 0693069

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/WorkerJS/PHPClient/Client.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ public function getSetting($name) {
6161
}
6262
}
6363

64-
/**
65-
* @param $taskID
66-
* @return mixed|HTTPClientTask
67-
* @throws InvalidApiException
68-
* @throws UndefinedSettingsException
69-
*/
70-
64+
/**
65+
* @param $taskID
66+
* @return mixed|HTTPClientTask
67+
* @throws InvalidApiException
68+
* @throws UndefinedSettingsException
69+
* @throws exceptions\TaskNotFoundException
70+
*/
7171
public function getTaskByID($taskID) {
7272
$taskStore = $this->getTaskStore();
7373

src/WorkerJS/PHPClient/HTTPClientTask.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public function sendTask() {
3333
$url = $this->client->getSetting("api_base")."/task";
3434
$payload = $this->getTask();
3535

36+
$webhook = $this->client->getSettings("task-webhook");
37+
38+
if ($webhook === null) {
39+
throw new RequestException("You need to set webhook url.");
40+
}
41+
42+
$payload->webhook = $webhook;
43+
3644
$taskResponse = $this->sendRequest($url, $payload);
3745

3846
$this->client->getTaskStore()->setTask($taskResponse["taskID"], $this);

src/WorkerJS/PHPClient/Task.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public function __construct($client, $params) {
1919
$name = $params;
2020
$this->task = [
2121
"name" => null,
22-
"task" => null
22+
"task" => null,
23+
"task-webhook" => null,
2324
];
2425

2526
$this->task["name"] = $name;

0 commit comments

Comments
 (0)