in lib/Api/ConsoleAdminApi.php [5060:5131]
protected function uploadGameVersionByDownloadRequest($varForms)
{
// verify the required parameter 'hash' is set
if ($varForms['hash'] === null || (is_array($varForms['hash']) && count($varForms['hash']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'hash\'] when calling uploadGameVersionByDownload'
);
}
// verify the required parameter 'game_id' is set
if ($varForms['game_id'] === null || (is_array($varForms['game_id']) && count($varForms['game_id']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'game_id\'] when calling uploadGameVersionByDownload'
);
}
// verify the required parameter 'download_type' is set
if ($varForms['download_type'] === null || (is_array($varForms['download_type']) && count($varForms['download_type']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'download_type\'] when calling uploadGameVersionByDownload'
);
}
// verify the required parameter 'version_name' is set
if ($varForms['version_name'] === null || (is_array($varForms['version_name']) && count($varForms['version_name']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'version_name\'] when calling uploadGameVersionByDownload'
);
}
$resourcePath = '/consoleAdmin/uploadGameVersionByDownload';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
// form params
$formParams['hash'] = ObjectSerializer::toFormValue($varForms['hash']);
$formParams['gameId'] = ObjectSerializer::toFormValue($varForms['game_id']);
$formParams['downloadType'] = ObjectSerializer::toFormValue($varForms['download_type']);
$formParams['versionName'] = ObjectSerializer::toFormValue($varForms['version_name']);
$headers = $this->headerSelector->selectHeaders(
['application/json'],
['application/x-www-form-urlencoded']
);
// for model (json/xml)
if (count($formParams) > 0) {
if ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode($formParams);
} else {
// for HTTP post (form)
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
}
}
$signHeaders = $this->headerSelector->prepareSignHeader($formParams, $queryParams, 'POST', $this->config);
$headers = array_merge(
['User-Agent' => 'cgw-client/1.0.0/php'],
$signHeaders,
$headerParams,
$headers
);
$query = \GuzzleHttp\Psr7\build_query($queryParams);
return new Request(
'POST',
$this->config->getScheme() . '://' . $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}