lib/API/ProfilesApi.php
/**
     * Create request for operation 'profileMetricsTimeline'
     *
     * @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 \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
Create request for operation 'profileMetricsTimeline'
@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')


Create request for operation ' profileMetricsTimeline ' @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 ' )
public function profileMetricsTimelineRequest($person_id, $since = null, $count = 50, $sort = 'desc')
    {
        if ($person_id === null || (is_array($person_id) && count($person_id) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $person_id when calling profileMetricsTimeline'
            );
        }
        if ($count !== null && $count > 100) {
            throw new \InvalidArgumentException('invalid value for "$count" when calling ProfilesApi.profileMetricsTimeline, must be smaller than or equal to 100.');
        }
        if ($count !== null && $count < 1) {
            throw new \InvalidArgumentException('invalid value for "$count" when calling ProfilesApi.profileMetricsTimeline, must be bigger than or equal to 1.');
        }
        $resourcePath = '/v1/person/{person_id}/metrics/timeline';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;
        if ($since !== null) {
            if('form' === 'form' && is_array($since)) {
                foreach($since as $key => $value) {
                    $queryParams[$key] = $value;
                }
            }
            else {
                $queryParams['since'] = $since;
            }
        }
        if ($count !== null) {
            if('form' === 'form' && is_array($count)) {
                foreach($count as $key => $value) {
                    $queryParams[$key] = $value;
                }
            }
            else {
                $queryParams['count'] = $count;
            }
        }
        if ($sort !== null) {
            if('form' === 'form' && is_array($sort)) {
                foreach($sort as $key => $value) {
                    $queryParams[$key] = $value;
                }
            }
            else {
                $queryParams['sort'] = $sort;
            }
        }
        if ($person_id !== null) {
            $resourcePath = str_replace(
                '{' . 'person_id' . '}',
                ObjectSerializer::toPathValue($person_id),
                $resourcePath
            );
        }
        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                []
            );
        }
        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(
            'GET',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }
public function profileMetricsTimelineRequest ( $ person_id , $ since = null , $ count = 50 , $ sort = 'desc' ) { if ( $ person_id === null || ( is_array ( $ person_id ) && count ( $ person_id ) === 0 ) ) { throw new \ InvalidArgumentException ( 'Missing the required parameter $person_id when calling profileMetricsTimeline' ) ; } if ( $ count !== null && $ count > 100 ) { throw new \ InvalidArgumentException ( 'invalid value for "$count" when calling ProfilesApi.profileMetricsTimeline, must be smaller than or equal to 100.' ) ; } if ( $ count !== null && $ count < 1 ) { throw new \ InvalidArgumentException ( 'invalid value for "$count" when calling ProfilesApi.profileMetricsTimeline, must be bigger than or equal to 1.' ) ; } $ resourcePath = '/v1/person/{person_id}/metrics/timeline' ; $ formParams = [ ] ; $ queryParams = [ ] ; $ headerParams = [ ] ; $ httpBody = '' ; $ multipart = false ; if ( $ since !== null ) { if ( 'form' === 'form' && is_array ( $ since ) ) { foreach ( $ since as $ key => $ value ) { $ queryParams [ $ key ] = $ value ; } } else { $ queryParams [ 'since' ] = $ since ; } } if ( $ count !== null ) { if ( 'form' === 'form' && is_array ( $ count ) ) { foreach ( $ count as $ key => $ value ) { $ queryParams [ $ key ] = $ value ; } } else { $ queryParams [ 'count' ] = $ count ; } } if ( $ sort !== null ) { if ( 'form' === 'form' && is_array ( $ sort ) ) { foreach ( $ sort as $ key => $ value ) { $ queryParams [ $ key ] = $ value ; } } else { $ queryParams [ 'sort' ] = $ sort ; } } if ( $ person_id !== null ) { $ resourcePath = str_replace ( '{' . 'person_id' . '}' , ObjectSerializer :: toPathValue ( $ person_id ) , $ resourcePath ) ; } if ( $ multipart ) { $ headers = $ this -> headerSelector -> selectHeadersForMultipart ( [ 'application/json' ] ) ; } else { $ headers = $ this -> headerSelector -> selectHeaders ( [ 'application/json' ] , [ ] ) ; } 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 ( 'GET' , $ this -> config -> getHost ( ) . $ resourcePath . ( $ query ? " ? { $ query } " : '' ) , $ headers , $ httpBody ) ; }
Create request for operation 'profileMetricsTimeline'
 @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.
Create request for operation ' profileMetricsTimeline ' @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 .
// verify the required parameter 'person_id' is set // query params // query params // query params // path params // for model (json/xml) // for HTTP post (form) // for HTTP post (form) // this endpoint requires API key authentication