lib/API/CampaignsApi.php
/**
     * Operation cloneCampaignWithHttpInfo
     *
     * Clone a Campaign
     *
     * @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 \Klaviyo\ApiException on non-2xx response
     * @throws \InvalidArgumentException
     * @return array of array<string,object>, HTTP status code, HTTP response headers (array of strings)
     */
Operation cloneCampaignWithHttpInfo
Clone a Campaign

@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)

@throws \Klaviyo\ApiException on non-2xx response
@throws \InvalidArgumentException
@return array of array, HTTP status code, HTTP response headers (array of strings)
Operation cloneCampaignWithHttpInfo Clone a Campaign @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 ) @throws \ Klaviyo \ ApiException on non - 2xx response @throws \ InvalidArgumentException @return array of array HTTP status code HTTP response headers ( array of strings )
public function cloneCampaignWithHttpInfo($campaign_id, $name, $list_id)
    {
        $request = $this->cloneCampaignRequest($campaign_id, $name, $list_id);
        try {
            $options = $this->createHttpClientOption();
            try {
                $response = $this->client->send($request, $options);
            } catch (RequestException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
                );
            } catch (ConnectException $e) {
                throw new ApiException(
                    "[{$e->getCode()}] {$e->getMessage()}",
                    (int) $e->getCode(),
                    null,
                    null
                );
            }
            $statusCode = $response->getStatusCode();
            if ($statusCode < 200 || $statusCode > 299) {
                throw new ApiException(
                    sprintf(
                        '[%d] Error connecting to the API (%s)',
                        $statusCode,
                        (string) $request->getUri()
                    ),
                    $statusCode,
                    $response->getHeaders(),
                    (string) $response->getBody()
                );
            }
            switch($statusCode) {
                case 200:
                    if ('array<string,object>' === '\SplFileObject') {
                        $content = $response->getBody(); 
                    } else {
                        $content = (string) $response->getBody();
                    }
                    $parsed_content = json_decode($content, TRUE);
                    if (json_last_error() != JSON_ERROR_NONE) {
                        $parsed_content = $content;
                    }
                    return [
                        $parsed_content,
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
            }
            $returnType = 'array<string,object>';
            if ($returnType === '\SplFileObject') {
                $content = $response->getBody(); 
            } else {
                $content = (string) $response->getBody();
            }
            $parsed_content = json_decode($content, TRUE);
            if (json_last_error() != JSON_ERROR_NONE) {
                $parsed_content = $content;
            }
            return [
                $parsed_content,
                $response->getStatusCode(),
                $response->getHeaders()
            ];
        } catch (ApiException $e) {
            switch ($e->getCode()) {
                case 200:
                    $data = ObjectSerializer::deserialize(
                        $e->getResponseBody(),
                        'array<string,object>',
                        $e->getResponseHeaders()
                    );
                    $e->setResponseObject($data);
                    break;
            }
            throw $e;
        }
    }
public function cloneCampaignWithHttpInfo ( $ campaign_id , $ name , $ list_id ) { $ request = $ this -> cloneCampaignRequest ( $ campaign_id , $ name , $ list_id ) ; try { $ options = $ this -> createHttpClientOption ( ) ; try { $ response = $ this -> client -> send ( $ request , $ options ) ; } catch ( RequestException $ e ) { throw new ApiException ( " [ { $ e -> getCode ( ) } ]  { $ e -> getMessage ( ) } " , ( int ) $ e -> getCode ( ) , $ e -> getResponse ( ) ? $ e -> getResponse ( ) -> getHeaders ( ) : null , $ e -> getResponse ( ) ? ( string ) $ e -> getResponse ( ) -> getBody ( ) : null ) ; } catch ( ConnectException $ e ) { throw new ApiException ( " [ { $ e -> getCode ( ) } ]  { $ e -> getMessage ( ) } " , ( int ) $ e -> getCode ( ) , null , null ) ; } $ statusCode = $ response -> getStatusCode ( ) ; if ( $ statusCode < 200 || $ statusCode > 299 ) { throw new ApiException ( sprintf ( '[%d] Error connecting to the API (%s)' , $ statusCode , ( string ) $ request -> getUri ( ) ) , $ statusCode , $ response -> getHeaders ( ) , ( string ) $ response -> getBody ( ) ) ; } switch ( $ statusCode ) { case 200 : if ( 'array<string,object>' === '\SplFileObject' ) { $ content = $ response -> getBody ( ) ; } else { $ content = ( string ) $ response -> getBody ( ) ; } $ parsed_content = json_decode ( $ content , TRUE ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { $ parsed_content = $ content ; } return [ $ parsed_content , $ response -> getStatusCode ( ) , $ response -> getHeaders ( ) ] ; } $ returnType = 'array<string,object>' ; if ( $ returnType === '\SplFileObject' ) { $ content = $ response -> getBody ( ) ; } else { $ content = ( string ) $ response -> getBody ( ) ; } $ parsed_content = json_decode ( $ content , TRUE ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { $ parsed_content = $ content ; } return [ $ parsed_content , $ response -> getStatusCode ( ) , $ response -> getHeaders ( ) ] ; } catch ( ApiException $ e ) { switch ( $ e -> getCode ( ) ) { case 200 : $ data = ObjectSerializer :: deserialize ( $ e -> getResponseBody ( ) , 'array<string,object>' , $ e -> getResponseHeaders ( ) ) ; $ e -> setResponseObject ( $ data ) ; break ; } throw $ e ; } }
Operation cloneCampaignWithHttpInfo
 Clone a Campaign
Operation cloneCampaignWithHttpInfo Clone a Campaign
//stream goes to serializer //stream goes to serializer