in lib/Api/MultiplayApi.php [907:974]
protected function leaveRequest($varForms)
{
// verify the required parameter 'mp_id' is set
if ($varForms['mp_id'] === null || (is_array($varForms['mp_id']) && count($varForms['mp_id']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'mp_id\'] when calling leave'
);
}
// verify the required parameter 'kick_out' is set
if ($varForms['kick_out'] === null || (is_array($varForms['kick_out']) && count($varForms['kick_out']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'kick_out\'] when calling leave'
);
}
// verify the required parameter 'token_ids' is set
if ($varForms['token_ids'] === null || (is_array($varForms['token_ids']) && count($varForms['token_ids']) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter $varForms[\'token_ids\'] when calling leave'
);
}
$resourcePath = '/multiplay/leave';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
// form params
$formParams['mpId'] = ObjectSerializer::toFormValue($varForms['mp_id']);
$formParams['kickOut'] = ObjectSerializer::toFormValue($varForms['kick_out']);
if ($varForms['reason'] !== null) {
$formParams['reason'] = ObjectSerializer::toFormValue($varForms['reason']);
}
$formParams['tokenIds'] = ObjectSerializer::toFormValue($varForms['token_ids']);
$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
);
}