You are here

public function AcquiaContentHubWebhookInterestCommands::contenthubWebhookInterestsList in Acquia Content Hub 8.2

Perform a webhook interest management operation.

@command acquia:contenthub-webhook-interests-list @aliases ach-wi-list

@option webhook_url The webhook URL to use. @default webhook_url null

@usage acquia:contenthub-webhook-interests-list Displays list of registered interests for the webhook

Throws

\Exception

2 calls to AcquiaContentHubWebhookInterestCommands::contenthubWebhookInterestsList()
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.

File

src/Commands/AcquiaContentHubWebhookInterestCommands.php, line 121

Class

AcquiaContentHubWebhookInterestCommands
Tests commands that interact with webhook interests.

Namespace

Drupal\acquia_contenthub\Commands

Code

public function contenthubWebhookInterestsList() {
  $this
    ->findWebhook();
  $message = sprintf('Listing Interests for webhook %s', $this->webhookUrl);
  $interests = $this->client
    ->getInterestsByWebhook($this->webhookUuid);
  if (empty($interests)) {
    $this
      ->output()
      ->writeln(dt('<fg=white;bg=red;options=bold;>No interests found for webhook @url</>', [
      '@url' => $this->webhookUrl,
    ]));
    return;
  }
  $interests = [
    'Index' => 'Interest',
  ] + $interests;
  $webhooks = array_merge([
    'Webhook',
  ], array_fill(0, count($interests) - 1, $this->webhookUrl));
  $this
    ->renderTable($message, TRUE, array_keys($interests), $interests, $webhooks);
}