mirror of
https://github.com/brunofontes/Memsource-API.git
synced 2024-11-23 19:00:50 +00:00
Included the Jobs class
This commit is contained in:
parent
898f03fd92
commit
39c135be60
29
src/Jobs.php
Normal file
29
src/Jobs.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* A very compact and simple Memsource API library
|
||||||
|
*
|
||||||
|
* @author Bruno Fontes <developer@brunofontes.net>
|
||||||
|
* @link https://github.com/brunofontes
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace BrunoFontes\Memsource;
|
||||||
|
|
||||||
|
class Jobs extends \BrunoFontes\Memsource\BaseApi
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List jobs of a project
|
||||||
|
* The API request returns a MAX of 50 Jobs.
|
||||||
|
* To get more jobs you need to make more requests for next pages
|
||||||
|
*
|
||||||
|
* @param string $projectUid The project uid on which has the jobs to be shown
|
||||||
|
* @param array $parameters List of Memsource Parameters
|
||||||
|
*
|
||||||
|
* @return string The JSON answer from Memsource
|
||||||
|
*/
|
||||||
|
public function listJobs(string $projectUid, array $parameters = []): string
|
||||||
|
{
|
||||||
|
$url = "/api2/v2/projects/{$projectUid}/jobs";
|
||||||
|
return $this->fetchApi->fetch('get', $url, $parameters);
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,7 @@ class Memsource
|
|||||||
{
|
{
|
||||||
private $_oauth;
|
private $_oauth;
|
||||||
private $_bilingualFile;
|
private $_bilingualFile;
|
||||||
|
private $_jobs;
|
||||||
private $_project;
|
private $_project;
|
||||||
private $_fetchApi;
|
private $_fetchApi;
|
||||||
|
|
||||||
@ -36,16 +37,6 @@ class Memsource
|
|||||||
return $this->_oauth ?? $this->_oauth = new \BrunoFontes\Memsource\oauth();
|
return $this->_oauth ?? $this->_oauth = new \BrunoFontes\Memsource\oauth();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Memsource API Project related functions
|
|
||||||
*
|
|
||||||
* @return \BrunoFontes\Memsource\Project
|
|
||||||
*/
|
|
||||||
public function project(): \BrunoFontes\Memsource\Project
|
|
||||||
{
|
|
||||||
return $this->_project ?? $this->_project = new \BrunoFontes\Memsource\Project($this->_fetchApi);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memsource API BilingualFile related functions
|
* Memsource API BilingualFile related functions
|
||||||
*
|
*
|
||||||
@ -55,4 +46,25 @@ class Memsource
|
|||||||
{
|
{
|
||||||
return $this->_bilingualFile ?? $this->_bilingualFile = new \BrunoFontes\Memsource\BilingualFile($this->_fetchApi);
|
return $this->_bilingualFile ?? $this->_bilingualFile = new \BrunoFontes\Memsource\BilingualFile($this->_fetchApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memsource API Jobs related functions
|
||||||
|
*
|
||||||
|
* @return \BrunoFontes\Memsource\Jobs
|
||||||
|
*/
|
||||||
|
public function jobs(): \BrunoFontes\Memsource\Jobs
|
||||||
|
{
|
||||||
|
return $this->_jobs ?? $this->_jobs = new \BrunoFontes\Memsource\Jobs($this->_fetchApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memsource API Project related functions
|
||||||
|
*
|
||||||
|
* @return \BrunoFontes\Memsource\Project
|
||||||
|
*/
|
||||||
|
public function project(): \BrunoFontes\Memsource\Project
|
||||||
|
{
|
||||||
|
return $this->_project ?? $this->_project = new \BrunoFontes\Memsource\Project($this->_fetchApi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user