Skip to content

Commit dd78eb5

Browse files
authored
Merge pull request #89 from cloudconvert/feature/webhook-url
Jobs: add webhook URL
2 parents c9d0242 + d3cf747 commit dd78eb5

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/Models/Job.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class Job
2222
*/
2323
protected $tag;
2424

25+
/**
26+
* @var string|null
27+
*/
28+
protected $webhook_url;
29+
2530
/**
2631
* @var \DateTimeImmutable
2732
*/
@@ -79,6 +84,23 @@ public function setTag(?string $tag): Job
7984
return $this;
8085
}
8186

87+
/**
88+
* @return string|null
89+
*/
90+
public function getWebhookUrl(): ?string
91+
{
92+
return $this->webhook_url;
93+
}
94+
95+
/**
96+
* @param string|null $webhook_url
97+
*/
98+
public function setWebhookUrl(?string $webhook_url): Job
99+
{
100+
$this->webhook_url = $webhook_url;
101+
return $this;
102+
}
103+
82104
/**
83105
* @return \DateTimeImmutable
84106
*/

src/Resources/JobsResource.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ public function create(Job $job): Job
5252
);
5353
}
5454
$response = $this->httpTransport->post($this->httpTransport->getBaseUri() . '/jobs', [
55-
'tasks' => $tasks,
56-
'tag' => $job->getTag()
55+
'tasks' => $tasks,
56+
'tag' => $job->getTag(),
57+
'webhook_url' => $job->getWebhookUrl()
5758
]);
5859
return $this->hydrator->hydrateObjectByResponse($job, $response);
5960
}
@@ -68,7 +69,8 @@ public function create(Job $job): Job
6869
*/
6970
public function refresh(Job $job, $query = null): Job
7071
{
71-
$response = $this->httpTransport->get($this->httpTransport->getBaseUri() . '/jobs/' . $job->getId(), $query ?? []);
72+
$response = $this->httpTransport->get($this->httpTransport->getBaseUri() . '/jobs/' . $job->getId(),
73+
$query ?? []);
7274
return $this->hydrator->hydrateObjectByResponse($job, $response);
7375
}
7476

0 commit comments

Comments
 (0)