lib/API/ProfilesApi.php
/**
     * Operation profileMetricsTimelineWithHttpInfo
     *
     * Get Profile&#39;s Events for all Metrics
     *
     * @param  string $person_id (required)
     * @param  string $since Either a 10-digit Unix timestamp (UTC) to use as starting datetime, OR a pagination token obtained from the next attribute of a prior API call. For backwards compatibility, UUIDs will continue to be supported for a limited time. Defaults to current time. (optional)
     * @param  int $count Number of events to return in a batch. Default &#x3D; 50, Max &#x3D; 100 (optional, default to 50)
     * @param  string $sort Sort order to apply to timeline, either descending or ascending. Valid values are &#x60;desc&#x60; or &#x60;asc&#x60;. Defaults to &#x60;desc&#x60;. Always descending when &#x60;since&#x60; is not sent, as &#x60;since&#x60; defaults to current time. (optional, default to 'desc')
     *
     * @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 profileMetricsTimelineWithHttpInfo
Get Profile's Events for all Metrics

@param  string $person_id (required)
@param  string $since Either a 10-digit Unix timestamp (UTC) to use as starting datetime, OR a pagination token obtained from the next attribute of a prior API call. For backwards compatibility, UUIDs will continue to be supported for a limited time. Defaults to current time. (optional)
@param  int $count Number of events to return in a batch. Default = 50, Max = 100 (optional, default to 50)
@param  string $sort Sort order to apply to timeline, either descending or ascending. Valid values are `desc` or `asc`. Defaults to `desc`. Always descending when `since` is not sent, as `since` defaults to current time. (optional, default to 'desc')

@throws \Klaviyo\ApiException on non-2xx response
@throws \InvalidArgumentException
@return array of array, HTTP status code, HTTP response headers (array of strings)
Operation profileMetricsTimelineWithHttpInfo Get Profile ' s Events for all Metrics @param string $person_id ( required ) @param string $since Either a 10 - digit Unix timestamp ( UTC ) to use as starting datetime OR a pagination token obtained from the next attribute of a prior API call . For backwards compatibility UUIDs will continue to be supported for a limited time . Defaults to current time . ( optional ) @param int $count Number of events to return in a batch . Default = 50 Max = 100 ( optional default to 50 ) @param string $sort Sort order to apply to timeline either descending or ascending . Valid values are ` desc ` or ` asc ` . Defaults to ` desc ` . Always descending when ` since ` is not sent as ` since ` defaults to current time . ( optional default to ' desc ' ) @throws \ Klaviyo \ ApiException on non - 2xx response @throws \ InvalidArgumentException @return array of array HTTP status code HTTP response headers ( array of strings )
public function profileMetricsTimelineWithHttpInfo($person_id, $since = null, $count = 50, $sort = 'desc')
    {
        $request = $this->profileMetricsTimelineRequest($person_id, $since, $count, $sort);
        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 profileMetricsTimelineWithHttpInfo ( $ person_id , $ since = null , $ count = 50 , $ sort = 'desc' ) { $ request = $ this -> profileMetricsTimelineRequest ( $ person_id , $ since , $ count , $ sort ) ; 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 profileMetricsTimelineWithHttpInfo
 Get Profile&#39;s Events for all Metrics
Operation profileMetricsTimelineWithHttpInfo Get Profile&#39 ; s Events for all Metrics
//stream goes to serializer //stream goes to serializer