Trendsic Platform Service

<back to all web services

ReportMetricsRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/report/metrics
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class ReportMetricComponentDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Field=null,
        /** @var string|null */
        public ?string $Agg=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Field'])) $this->Field = $o['Field'];
        if (isset($o['Agg'])) $this->Agg = $o['Agg'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Field)) $o['Field'] = $this->Field;
        if (isset($this->Agg)) $o['Agg'] = $this->Agg;
        return empty($o) ? new class(){} : $o;
    }
}

class ReportMetricDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $Base=null,
        /** @var string|null */
        public ?string $Op=null,
        /** @var array<ReportMetricComponentDto>|null */
        public ?array $Components=null,
        /** @var array<string>|null */
        public ?array $Joins=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Base'])) $this->Base = $o['Base'];
        if (isset($o['Op'])) $this->Op = $o['Op'];
        if (isset($o['Components'])) $this->Components = JsonConverters::fromArray('ReportMetricComponentDto', $o['Components']);
        if (isset($o['Joins'])) $this->Joins = JsonConverters::fromArray('string', $o['Joins']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Base)) $o['Base'] = $this->Base;
        if (isset($this->Op)) $o['Op'] = $this->Op;
        if (isset($this->Components)) $o['Components'] = JsonConverters::toArray('ReportMetricComponentDto', $this->Components);
        if (isset($this->Joins)) $o['Joins'] = JsonConverters::toArray('string', $this->Joins);
        return empty($o) ? new class(){} : $o;
    }
}

class ReportMetricsResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<ReportMetricDto>|null */
        public ?array $Metrics=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Metrics'])) $this->Metrics = JsonConverters::fromArray('ReportMetricDto', $o['Metrics']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Metrics)) $o['Metrics'] = JsonConverters::toArray('ReportMetricDto', $this->Metrics);
        return empty($o) ? new class(){} : $o;
    }
}

class ReportMetricsRequest implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP ReportMetricsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /v1/report/metrics HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Metrics":[{"Code":"String","Name":"String","Description":"String","Unit":"String","Status":"String","Base":"String","Op":"String","Components":[{"Field":"String","Agg":"String"}],"Joins":["String"]}]}