From 1a3c69013871420678865ef3a4969a1df3f799f6 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Fri, 23 Dec 2022 00:24:24 -0300 Subject: [PATCH] feat: added async module --- src/Async.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Async.php diff --git a/src/Async.php b/src/Async.php new file mode 100644 index 0000000..b26014f --- /dev/null +++ b/src/Async.php @@ -0,0 +1,32 @@ + + * @link https://github.com/brunofontes + */ + +namespace BrunoFontes\Memsource; + +class Async extends \BrunoFontes\Memsource\BaseApi +{ + private $_url = '/api2/v1/async'; + + /** + * Get asynchronous request + * + * @param string $queryParams An array with the Query parameters to filter projects + * + * @return string The JSON answer from Memsource + */ + public function getAsyncRequest(string $asyncRequestId, array $queryParams = []): string + { + $response = $this->fetchApi->fetch('get', "{$this->_url}/{$asyncRequestId}", $queryParams); + if ($this->hasError($response)) { + throw new \Exception("Error listing AsyncRequest: " . $this->getError($response), 1); + } + return $response; + } + + +}