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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ReportMetricsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Metrics>
    <ReportMetricDto>
      <Base>String</Base>
      <Code>String</Code>
      <Components>
        <ReportMetricComponentDto>
          <Agg>String</Agg>
          <Field>String</Field>
        </ReportMetricComponentDto>
      </Components>
      <Description>String</Description>
      <Joins xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </Joins>
      <Name>String</Name>
      <Op>String</Op>
      <Status>String</Status>
      <Unit>String</Unit>
    </ReportMetricDto>
  </Metrics>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</ReportMetricsResponse>