mirror of
https://github.com/brunofontes/Memsource-API.git
synced 2024-11-23 19:00:50 +00:00
feat: added async module
This commit is contained in:
parent
f14492d744
commit
1a3c690138
32
src/Async.php
Normal file
32
src/Async.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* A very compact and simple Memsource API library
|
||||
*
|
||||
* @author Bruno Fontes <developer@brunofontes.net>
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user