You are here

public function ContentHubConnectionManager::suppressWebhook in Acquia Content Hub 8.2

Suppress webhook.

Parameters

string $webhook_uuid: Webhook uuid.

Return value

bool TRUE if we get the response with success TRUE value.

File

src/ContentHubConnectionManager.php, line 467

Class

ContentHubConnectionManager
Responsible for connection management actions.

Namespace

Drupal\acquia_contenthub

Code

public function suppressWebhook(string $webhook_uuid) : bool {
  $this
    ->initialize();
  $response_body = $this->client
    ->suppressWebhook($webhook_uuid);
  if (!empty($response_body) && $response_body['success'] === TRUE) {
    return TRUE;
  }
  if (empty($response_body)) {
    $this->logger
      ->error('PUT request against webhook suppression endpoint returned with an empty body.');
    return FALSE;
  }
  $this->logger
    ->error('Something went wrong during webhook suppression: @e_message', [
    '@e_message' => $response_body['error']['message'],
  ]);
  return FALSE;
}