Beispiel #1
0
 /**
  * @param $documentId
  * @param int|\DateTime $expiration
  * @param bool $isDownloadable
  * @param bool $isTextSelectable
  * @return Response\Entity\Document
  */
 public function createSession($documentId, $expiration = 60, $isDownloadable = false, $isTextSelectable = true)
 {
     $postData = ['document_id' => $documentId, 'is_downloadable' => $isDownloadable ? 'true' : 'false', 'is_text_selectable' => $isTextSelectable ? 'true' : 'false'];
     if ($expiration instanceof \DateTime) {
         $postData['expires_at'] = $expiration->format(\DateTime::RFC3339);
     } else {
         $postData['duration'] = $expiration;
     }
     return $this->responseHandler->getSession($this->sendRequest($this->clientManager->getApiClient(), 'POST', 'sessions', ['json' => $postData]));
 }