Skip to content

Commit

Permalink
Merge pull request #89 from cloudconvert/feature/webhook-url
Browse files Browse the repository at this point in the history
Jobs: add webhook URL
  • Loading branch information
josiasmontag authored Nov 8, 2021
2 parents c9d0242 + d3cf747 commit dd78eb5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
22 changes: 22 additions & 0 deletions src/Models/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class Job
*/
protected $tag;

/**
* @var string|null
*/
protected $webhook_url;

/**
* @var \DateTimeImmutable
*/
Expand Down Expand Up @@ -79,6 +84,23 @@ public function setTag(?string $tag): Job
return $this;
}

/**
* @return string|null
*/
public function getWebhookUrl(): ?string
{
return $this->webhook_url;
}

/**
* @param string|null $webhook_url
*/
public function setWebhookUrl(?string $webhook_url): Job
{
$this->webhook_url = $webhook_url;
return $this;
}

/**
* @return \DateTimeImmutable
*/
Expand Down
8 changes: 5 additions & 3 deletions src/Resources/JobsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ public function create(Job $job): Job
);
}
$response = $this->httpTransport->post($this->httpTransport->getBaseUri() . '/jobs', [
'tasks' => $tasks,
'tag' => $job->getTag()
'tasks' => $tasks,
'tag' => $job->getTag(),
'webhook_url' => $job->getWebhookUrl()
]);
return $this->hydrator->hydrateObjectByResponse($job, $response);
}
Expand All @@ -68,7 +69,8 @@ public function create(Job $job): Job
*/
public function refresh(Job $job, $query = null): Job
{
$response = $this->httpTransport->get($this->httpTransport->getBaseUri() . '/jobs/' . $job->getId(), $query ?? []);
$response = $this->httpTransport->get($this->httpTransport->getBaseUri() . '/jobs/' . $job->getId(),
$query ?? []);
return $this->hydrator->hydrateObjectByResponse($job, $response);
}

Expand Down

0 comments on commit dd78eb5

Please sign in to comment.