You are here

public function LingotekApi::getDocumentContent in Lingotek Translation 8

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

File

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

Class

LingotekApi

Namespace

Drupal\lingotek\Remote

Code

public function getDocumentContent($doc_id) {
  try {
    $this->logger
      ->debug('Lingotek::getDocumentContent called with id ' . $doc_id);
    $response = $this->lingotekClient
      ->get('/api/document/' . $doc_id . '/content');
  } catch (\Exception $e) {
    throw new LingotekApiException('Failed to get document: ' . $e
      ->getMessage());
  }
  return $response
    ->getBody()
    ->getContents();
}