protected function getPartyRequest()

in lib/Api/InteractiveApi.php [239:313]


    protected function getPartyRequest($varForms)
    {
        // verify the required parameter 'mix_game_id' is set
        if ($varForms['mix_game_id'] === null || (is_array($varForms['mix_game_id']) && count($varForms['mix_game_id']) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $varForms[\'mix_game_id\'] when calling getParty'
            );
        }
        // verify the required parameter 'user_id' is set
        if ($varForms['user_id'] === null || (is_array($varForms['user_id']) && count($varForms['user_id']) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $varForms[\'user_id\'] when calling getParty'
            );
        }
        // verify the required parameter 're_connect' is set
        if ($varForms['re_connect'] === null || (is_array($varForms['re_connect']) && count($varForms['re_connect']) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $varForms[\'re_connect\'] when calling getParty'
            );
        }
        // verify the required parameter 'project_id' is set
        if ($varForms['project_id'] === null || (is_array($varForms['project_id']) && count($varForms['project_id']) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $varForms[\'project_id\'] when calling getParty'
            );
        }

        $resourcePath = '/interactive/getParty';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';

        // form params
        $formParams['mixGameId'] = ObjectSerializer::toFormValue($varForms['mix_game_id']);
        $formParams['userId'] = ObjectSerializer::toFormValue($varForms['user_id']);
        $formParams['reConnect'] = ObjectSerializer::toFormValue($varForms['re_connect']);
        $formParams['projectId'] = ObjectSerializer::toFormValue($varForms['project_id']);
        if ($varForms['config'] !== null) {
            $formParams['config'] = ObjectSerializer::toFormValue($varForms['config']);
        }

        $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
        );
    }