diff --git a/src/ModernMT.php b/src/ModernMT.php index 19b1994..188278c 100644 --- a/src/ModernMT.php +++ b/src/ModernMT.php @@ -94,6 +94,8 @@ public function translate($source, $target, $q, $hints = null, $context_vector = $data['format'] = $options['format']; if (isset($options['alt_translations'])) $data['alt_translations'] = $options['alt_translations']; + if (isset($options['session'])) + $data['session'] = $options['session']; } return $this->http->send('get', '/translate', $data); @@ -125,6 +127,8 @@ public function batchTranslate($webhook, $source, $target, $q, $hints = null, $c $data['alt_translations'] = $options['alt_translations']; if (isset($options['metadata'])) $data['metadata'] = $options['metadata']; + if (isset($options['session'])) + $data['session'] = $options['session']; if (isset($options['idempotency_key'])) $headers = ["x-idempotency-key" => $options['idempotency_key']]; diff --git a/src/internal/MemoryServices.php b/src/internal/MemoryServices.php index 036f67e..254c17b 100644 --- a/src/internal/MemoryServices.php +++ b/src/internal/MemoryServices.php @@ -66,26 +66,28 @@ public function delete($id) { /** * @throws ModernMTException */ - public function add($memory, $source, $target, $sentence, $translation, $tuid = null) { + public function add($memory, $source, $target, $sentence, $translation, $tuid = null, $session = null) { return $this->http->send('post', "/memories/$memory/content", [ 'source' => $source, 'target' => $target, 'sentence' => $sentence, 'translation' => $translation, - 'tuid' => $tuid + 'tuid' => $tuid, + 'session' => $session ]); } /** * @throws ModernMTException */ - public function replace($memory, $tuid, $source, $target, $sentence, $translation) { + public function replace($memory, $tuid, $source, $target, $sentence, $translation, $session = null) { return $this->http->send('put', "/memories/$memory/content", [ 'tuid' => $tuid, 'source' => $source, 'target' => $target, 'sentence' => $sentence, - 'translation' => $translation + 'translation' => $translation, + 'session' => $session ]); }