You are here

private function AcquiaContentHubWebhookInterestCommands::findWebhook in Acquia Content Hub 8.2

Find webhook information.

Throws

\Exception

3 calls to AcquiaContentHubWebhookInterestCommands::findWebhook()
AcquiaContentHubWebhookInterestCommands::contenthubWebhookInterestsAdd in src/Commands/AcquiaContentHubWebhookInterestCommands.php
Perform a webhook interest management operation.
AcquiaContentHubWebhookInterestCommands::contenthubWebhookInterestsDelete in src/Commands/AcquiaContentHubWebhookInterestCommands.php
Perform a webhook interest management operation.
AcquiaContentHubWebhookInterestCommands::contenthubWebhookInterestsList in src/Commands/AcquiaContentHubWebhookInterestCommands.php
Perform a webhook interest management operation.

File

src/Commands/AcquiaContentHubWebhookInterestCommands.php, line 88

Class

AcquiaContentHubWebhookInterestCommands
Tests commands that interact with webhook interests.

Namespace

Drupal\acquia_contenthub\Commands

Code

private function findWebhook() : void {
  $this->client = $this->clientFactory
    ->getClient();
  if (!$this->client) {
    throw new \Exception(dt('The Content Hub client is not connected so the webhook operations could not be performed.'));
  }
  $this->webhookUrl = $this
    ->formatWebhookUrl($this
    ->input()
    ->getOptions()['webhook_url'] ?? $this->client
    ->getSettings()
    ->getWebhook('url'));
  $this->webhook = $this->client
    ->getWebHook($this->webhookUrl);
  if (!$this->webhook) {
    throw new \Exception(dt('The webhook is not available so the operation could not complete.'));
  }
  $this->webhookUuid = $this->webhook
    ->getUuid();
  if (!$this->webhookUuid) {
    throw new \Exception(dt('The webhook uuid is not available so the operation could not complete.'));
  }
}