You are here

public function LingotekApi::setProjectCallBackUrl in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  2. 4.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  3. 3.0.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  4. 3.1.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  5. 3.2.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  6. 3.3.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  7. 3.4.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  8. 3.5.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  9. 3.6.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  10. 3.7.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()
  11. 3.8.x src/Remote/LingotekApi.php \Drupal\lingotek\Remote\LingotekApi::setProjectCallBackUrl()

File

src/Remote/LingotekApi.php, line 319
Contains \Drupal\lingotek\Remote\LingotekApi.

Class

LingotekApi

Namespace

Drupal\lingotek\Remote

Code

public function setProjectCallBackUrl($project_id, $args) {
  try {
    $this->logger
      ->debug('Lingotek::setProjectCallBackUrl called with id ' . $project_id . ' and ' . var_export($args, TRUE));
    $response = $this->lingotekClient
      ->patch('/api/project/' . $project_id, $args);
  } catch (\Exception $e) {
    $this->logger
      ->error('Error patching project %project_id with %args: %message.', [
      '%project_id' => $project_id,
      '%args' => var_export($args, TRUE),
      '%message' => $e
        ->getMessage(),
    ]);
    throw new LingotekApiException('Failed to patch project: ' . $e
      ->getMessage());
  }
  $this->logger
    ->debug('setProjectCallBackUrl response received, code %code and body %body', [
    '%code' => $response
      ->getStatusCode(),
    '%body' => (string) $response
      ->getBody(TRUE),
  ]);
  return $response;
}