in lib/Api/DispatchApi.php [3176:3276]
protected function tryToGetSlotRequest($varForms)
{
// verify the required parameter 'account_id' is set
if ($varForms['account_id'] === null || (is_array($varForms['account_id']) && count($varForms['account_id']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'account_id\'] when calling tryToGetSlot'
);
}
// 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 tryToGetSlot'
);
}
// verify the required parameter 'app_key' is set
if ($varForms['app_key'] === null || (is_array($varForms['app_key']) && count($varForms['app_key']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'app_key\'] when calling tryToGetSlot'
);
}
$resourcePath = '/tryToGetSlot';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
// form params
$formParams['accountId'] = ObjectSerializer::toFormValue($varForms['account_id']);
$formParams['gameId'] = ObjectSerializer::toFormValue($varForms['game_id']);
$formParams['appKey'] = ObjectSerializer::toFormValue($varForms['app_key']);
if ($varForms['region_id'] !== null) {
$formParams['regionId'] = ObjectSerializer::toFormValue($varForms['region_id']);
}
if ($varForms['re_connect'] !== null) {
$formParams['reConnect'] = ObjectSerializer::toFormValue($varForms['re_connect']);
}
if ($varForms['biz_param'] !== null) {
$formParams['bizParam'] = ObjectSerializer::toFormValue($varForms['biz_param']);
}
if ($varForms['client_ip'] !== null) {
$formParams['clientIp'] = ObjectSerializer::toFormValue($varForms['client_ip']);
}
if ($varForms['tags'] !== null) {
$formParams['tags'] = ObjectSerializer::toFormValue($varForms['tags']);
}
if ($varForms['user_level'] !== null) {
$formParams['userLevel'] = ObjectSerializer::toFormValue($varForms['user_level']);
}
if ($varForms['codec'] !== null) {
$formParams['codec'] = ObjectSerializer::toFormValue($varForms['codec']);
}
if ($varForms['resolution'] !== null) {
$formParams['resolution'] = ObjectSerializer::toFormValue($varForms['resolution']);
}
if ($varForms['bit_rate'] !== null) {
$formParams['bitRate'] = ObjectSerializer::toFormValue($varForms['bit_rate']);
}
if ($varForms['fps'] !== null) {
$formParams['fps'] = ObjectSerializer::toFormValue($varForms['fps']);
}
if ($varForms['game_cmd_param'] !== null) {
$formParams['gameCmdParam'] = ObjectSerializer::toFormValue($varForms['game_cmd_param']);
}
if ($varForms['start_param'] !== null) {
$formParams['startParam'] = ObjectSerializer::toFormValue($varForms['start_param']);
}
$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
);
}