Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct ($host, $username=null, $token=null) | |
downloadFile ($jobId, $filename='documents.zip', $destinationDir=null) | |
getCitationList () | |
getJobStatus ($jobId) | |
statusCodeToLabel ($code) | |
submitJob ($fileName, $fileContent, $citationStyleHash, $metadata=null) | |
Data Fields | |
const | DEFAULT_DEMO_HOST = 'https://pkp-xml-demo.lib.sfu.ca' |
const | JOB_CONVERSION_STAGE_ZIP = 10 |
const | JOB_STATUS_COMPLETED = 2 |
const | JOB_STATUS_FAILED = 3 |
const | JOB_STATUS_PENDING = 0 |
const | JOB_STATUS_PROCESSING = 1 |
Protected Member Functions | |
_buildRequestUrl ($endpoint, $params=array()) | |
_getFileUrl ($jobId) | |
_makeApiRequest ($endpoint, $params, $authRequired=false, $isPost=false) | |
_withLoginCredentials ($params) | |
Protected Attributes | |
$_host = null | |
$_token = null | |
$_username = null | |
Wrapper class for XML Parsing Service.
Definition at line 16 of file XMLPSWrapper.inc.php.
XMLPSWrapper::__construct | ( | $host, | |
$username = null , |
|||
$token = null |
|||
) |
Initialize object with server parameters
$host | string server hostname |
$username | string username |
$token | string token |
Definition at line 52 of file XMLPSWrapper.inc.php.
References DEFAULT_DEMO_HOST.
|
protected |
Internal helper method to build request url
$endpoint | string api endpoint |
$params | array parameters |
Definition at line 71 of file XMLPSWrapper.inc.php.
Referenced by _getFileUrl(), and _makeApiRequest().
|
protected |
Get the converted file URL
$jobId | int job id |
Definition at line 217 of file XMLPSWrapper.inc.php.
References _buildRequestUrl(), and _withLoginCredentials().
Referenced by downloadFile().
|
protected |
Internal helper method that makes request to api endpoint
$endpoint | string api endpoint |
$params | array parameters |
$authRequired | boolean whether authentication is required |
$isPost | boolean Whether to use GET/POST request |
Exception | login credentials are not set for and api call requires authentication |
Exception | When request fails. |
Definition at line 108 of file XMLPSWrapper.inc.php.
References _buildRequestUrl(), and _withLoginCredentials().
Referenced by getCitationList(), getJobStatus(), and submitJob().
|
protected |
adds login credentials to array of parameters
@params $params array parameters
Definition at line 86 of file XMLPSWrapper.inc.php.
Referenced by _getFileUrl(), and _makeApiRequest().
XMLPSWrapper::downloadFile | ( | $jobId, | |
$filename = 'documents.zip' , |
|||
$destinationDir = null |
|||
) |
Get a job final stage archive zip file
$jobId | int job id |
$filename | Name for downloaded file |
$destinationDir | Destination directory |
Definition at line 238 of file XMLPSWrapper.inc.php.
References _getFileUrl().
XMLPSWrapper::getCitationList | ( | ) |
Get list of citation styles
Exception | When response status is not equal to success. |
Definition at line 265 of file XMLPSWrapper.inc.php.
References _makeApiRequest().
XMLPSWrapper::getJobStatus | ( | $jobId | ) |
Query a job's status
$jobId | int job id |
Exception | When response status is not equal to success. |
Definition at line 195 of file XMLPSWrapper.inc.php.
References _makeApiRequest().
XMLPSWrapper::statusCodeToLabel | ( | $code | ) |
Returns the label for a status code
int | $code | Status code |
Definition at line 281 of file XMLPSWrapper.inc.php.
References JOB_STATUS_COMPLETED, JOB_STATUS_FAILED, JOB_STATUS_PENDING, and JOB_STATUS_PROCESSING.
XMLPSWrapper::submitJob | ( | $fileName, | |
$fileContent, | |||
$citationStyleHash, | |||
$metadata = null |
|||
) |
Submit a file for conversion
$fileName | string file name |
$fileContent | string content |
$citationStyleHash | string citation style hash |
$metadata | array document metadata |
Exception | When response status is not equal to success. |
Definition at line 165 of file XMLPSWrapper.inc.php.
References _makeApiRequest().
|
protected |
string server host
Definition at line 42 of file XMLPSWrapper.inc.php.
|
protected |
string user token
Definition at line 36 of file XMLPSWrapper.inc.php.
|
protected |
string user login
Definition at line 30 of file XMLPSWrapper.inc.php.
const XMLPSWrapper::DEFAULT_DEMO_HOST = 'https://pkp-xml-demo.lib.sfu.ca' |
Definition at line 24 of file XMLPSWrapper.inc.php.
Referenced by __construct().
const XMLPSWrapper::JOB_CONVERSION_STAGE_ZIP = 10 |
Definition at line 18 of file XMLPSWrapper.inc.php.
const XMLPSWrapper::JOB_STATUS_COMPLETED = 2 |
Definition at line 21 of file XMLPSWrapper.inc.php.
Referenced by MarkupHandler\fetchConversionJobStatus(), MarkupConversionHelper\retrieveConversionJobArchive(), and statusCodeToLabel().
const XMLPSWrapper::JOB_STATUS_FAILED = 3 |
Definition at line 22 of file XMLPSWrapper.inc.php.
Referenced by MarkupHandler\fetchConversionJobStatus(), and statusCodeToLabel().
const XMLPSWrapper::JOB_STATUS_PENDING = 0 |
Definition at line 19 of file XMLPSWrapper.inc.php.
Referenced by MarkupConversionHelper\retrieveConversionJobArchive(), and statusCodeToLabel().
const XMLPSWrapper::JOB_STATUS_PROCESSING = 1 |
Definition at line 20 of file XMLPSWrapper.inc.php.
Referenced by MarkupConversionHelper\retrieveConversionJobArchive(), and statusCodeToLabel().