lib/API/CampaignsApi.php
/**
     * Create request for operation 'cloneCampaign'
     *
     * @param  string $campaign_id (required)
     * @param  string $name The name for the new campaign. All other properties of the campaign will remain the same. Note, the template for the new campaign will be cloned from the existing template so changes to the existing campaign&#39;s content will not alter the content of the new campaign. (required)
     * @param  string $list_id The list you will send the campaign to. (required)
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
Create request for operation 'cloneCampaign'
@param  string $campaign_id (required)
@param  string $name The name for the new campaign. All other properties of the campaign will remain the same. Note, the template for the new campaign will be cloned from the existing template so changes to the existing campaign's content will not alter the content of the new campaign. (required)
@param  string $list_id The list you will send the campaign to. (required)


Create request for operation ' cloneCampaign ' @param string $campaign_id ( required ) @param string $name The name for the new campaign . All other properties of the campaign will remain the same . Note the template for the new campaign will be cloned from the existing template so changes to the existing campaign ' s content will not alter the content of the new campaign . ( required ) @param string $list_id The list you will send the campaign to . ( required )
public function cloneCampaignRequest($campaign_id, $name, $list_id)
    {
        if ($campaign_id === null || (is_array($campaign_id) && count($campaign_id) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $campaign_id when calling cloneCampaign'
            );
        }
        if ($name === null || (is_array($name) && count($name) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $name when calling cloneCampaign'
            );
        }
        if ($list_id === null || (is_array($list_id) && count($list_id) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $list_id when calling cloneCampaign'
            );
        }
        $resourcePath = '/v1/campaign/{campaign_id}/clone';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;
        if ($campaign_id !== null) {
            $resourcePath = str_replace(
                '{' . 'campaign_id' . '}',
                ObjectSerializer::toPathValue($campaign_id),
                $resourcePath
            );
        }
        if ($name !== null) {
            $formParams['name'] = ObjectSerializer::toFormValue($name);
        }
        if ($list_id !== null) {
            $formParams['list_id'] = ObjectSerializer::toFormValue($list_id);
        }
        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/x-www-form-urlencoded']
            );
        }
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                $httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
            }
        }
        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
        if ($apiKey !== null) {
            $queryParams['api_key'] = $apiKey;
        }
        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }
        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );
        $query = \GuzzleHttp\Psr7\Query::build($queryParams);
        return new Request(
            'POST',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }
public function cloneCampaignRequest ( $ campaign_id , $ name , $ list_id ) { if ( $ campaign_id === null || ( is_array ( $ campaign_id ) && count ( $ campaign_id ) === 0 ) ) { throw new \ InvalidArgumentException ( 'Missing the required parameter $campaign_id when calling cloneCampaign' ) ; } if ( $ name === null || ( is_array ( $ name ) && count ( $ name ) === 0 ) ) { throw new \ InvalidArgumentException ( 'Missing the required parameter $name when calling cloneCampaign' ) ; } if ( $ list_id === null || ( is_array ( $ list_id ) && count ( $ list_id ) === 0 ) ) { throw new \ InvalidArgumentException ( 'Missing the required parameter $list_id when calling cloneCampaign' ) ; } $ resourcePath = '/v1/campaign/{campaign_id}/clone' ; $ formParams = [ ] ; $ queryParams = [ ] ; $ headerParams = [ ] ; $ httpBody = '' ; $ multipart = false ; if ( $ campaign_id !== null ) { $ resourcePath = str_replace ( '{' . 'campaign_id' . '}' , ObjectSerializer :: toPathValue ( $ campaign_id ) , $ resourcePath ) ; } if ( $ name !== null ) { $ formParams [ 'name' ] = ObjectSerializer :: toFormValue ( $ name ) ; } if ( $ list_id !== null ) { $ formParams [ 'list_id' ] = ObjectSerializer :: toFormValue ( $ list_id ) ; } if ( $ multipart ) { $ headers = $ this -> headerSelector -> selectHeadersForMultipart ( [ 'application/json' ] ) ; } else { $ headers = $ this -> headerSelector -> selectHeaders ( [ 'application/json' ] , [ 'application/x-www-form-urlencoded' ] ) ; } if ( count ( $ formParams ) > 0 ) { if ( $ multipart ) { $ multipartContents = [ ] ; foreach ( $ formParams as $ formParamName => $ formParamValue ) { $ formParamValueItems = is_array ( $ formParamValue ) ? $ formParamValue : [ $ formParamValue ] ; foreach ( $ formParamValueItems as $ formParamValueItem ) { $ multipartContents [ ] = [ 'name' => $ formParamName , 'contents' => $ formParamValueItem ] ; } } $ httpBody = new MultipartStream ( $ multipartContents ) ; } elseif ( $ headers [ 'Content-Type' ] === 'application/json' ) { $ httpBody = \ GuzzleHttp \ json_encode ( $ formParams ) ; } else { $ httpBody = \ GuzzleHttp \ Psr7 \ Query :: build ( $ formParams ) ; } } $ apiKey = $ this -> config -> getApiKeyWithPrefix ( 'api_key' ) ; if ( $ apiKey !== null ) { $ queryParams [ 'api_key' ] = $ apiKey ; } $ defaultHeaders = [ ] ; if ( $ this -> config -> getUserAgent ( ) ) { $ defaultHeaders [ 'User-Agent' ] = $ this -> config -> getUserAgent ( ) ; } $ headers = array_merge ( $ defaultHeaders , $ headerParams , $ headers ) ; $ query = \ GuzzleHttp \ Psr7 \ Query :: build ( $ queryParams ) ; return new Request ( 'POST' , $ this -> config -> getHost ( ) . $ resourcePath . ( $ query ? " ? { $ query } " : '' ) , $ headers , $ httpBody ) ; }
Create request for operation 'cloneCampaign'
 @param  string $campaign_id (required)
 @param  string $name The name for the new campaign.
Create request for operation ' cloneCampaign ' @param string $campaign_id ( required ) @param string $name The name for the new campaign .
// verify the required parameter 'campaign_id' is set // verify the required parameter 'name' is set // verify the required parameter 'list_id' is set // path params // form params // form params // for model (json/xml) // for HTTP post (form) // for HTTP post (form) // this endpoint requires API key authentication