Skip to content
Snippets Groups Projects
Commit 961a06c2 authored by Carsten Karbach's avatar Carsten Karbach
Browse files

Update generated code with POST function

parent 8cd17ed3
Branches
No related tags found
No related merge requests found
......@@ -183,6 +183,118 @@ class FilesApi
}
}
/**
* Operation filesAppidFilePost
*
* @param int $appid ID of the application. (required)
* @param string $file Name of requested file. (required)
* @param \SplFileObject $fileupload The PDF file to upload. (required)
* @throws \jards\gcsjardsapiclient\Swagger\Client\ApiException on non-2xx response
* @return string
*/
public function filesAppidFilePost($appid, $file, $fileupload)
{
list($response) = $this->filesAppidFilePostWithHttpInfo($appid, $file, $fileupload);
return $response;
}
/**
* Operation filesAppidFilePostWithHttpInfo
*
* @param int $appid ID of the application. (required)
* @param string $file Name of requested file. (required)
* @param \SplFileObject $fileupload The PDF file to upload. (required)
* @throws \jards\gcsjardsapiclient\Swagger\Client\ApiException on non-2xx response
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function filesAppidFilePostWithHttpInfo($appid, $file, $fileupload)
{
// verify the required parameter 'appid' is set
if ($appid === null) {
throw new \InvalidArgumentException('Missing the required parameter $appid when calling filesAppidFilePost');
}
// verify the required parameter 'file' is set
if ($file === null) {
throw new \InvalidArgumentException('Missing the required parameter $file when calling filesAppidFilePost');
}
// verify the required parameter 'fileupload' is set
if ($fileupload === null) {
throw new \InvalidArgumentException('Missing the required parameter $fileupload when calling filesAppidFilePost');
}
// parse inputs
$resourcePath = "/files/{appid}/{file}";
$httpBody = '';
$queryParams = [];
$headerParams = [];
$formParams = [];
$_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['multipart/form-data']);
// path params
if ($appid !== null) {
$resourcePath = str_replace(
"{" . "appid" . "}",
$this->apiClient->getSerializer()->toPathValue($appid),
$resourcePath
);
}
// path params
if ($file !== null) {
$resourcePath = str_replace(
"{" . "file" . "}",
$this->apiClient->getSerializer()->toPathValue($file),
$resourcePath
);
}
// form params
if ($fileupload !== null) {
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
// See: https://wiki.php.net/rfc/curl-file-upload
if (function_exists('curl_file_create')) {
$formParams['fileupload'] = curl_file_create($this->apiClient->getSerializer()->toFormValue($fileupload));
} else {
$formParams['fileupload'] = '@' . $this->apiClient->getSerializer()->toFormValue($fileupload);
}
}
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath,
'POST',
$queryParams,
$httpBody,
$headerParams,
'string',
'/files/{appid}/{file}'
);
return [$this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
case 404:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Operation filesAppidGet
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment