Mercedes.VehicleManagement.API

<back to all web services

DashboardCsvReportsRequest

Reports
Requires Authentication
The following routes are available for this service:
POST/v1/reports/CsvRetrieve Report by ReportName and Filters and return as CSV
<?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 DashboardReportResult implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $totalCount=0,
        /** @var array<Object>|null */
        public ?array $reportResult=null
    ) {
    }

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

enum ReportFilterType : string
{
    case list = 'list';
    case list_like = 'list_like';
    case date = 'date';
    case range = 'range';
}

class ReportFilter implements JsonSerializable
{
    public function __construct(
        /** @var ReportFilterType|null */
        public ?ReportFilterType $type=null,
        /** @var array<string>|null */
        public ?array $values=null,
        /** @var DateTime|null */
        public ?DateTime $start=null,
        /** @var DateTime|null */
        public ?DateTime $end=null,
        /** @var int|null */
        public ?int $higherThan=null,
        /** @var int|null */
        public ?int $lowerThan=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['type'])) $this->type = JsonConverters::from('ReportFilterType', $o['type']);
        if (isset($o['values'])) $this->values = JsonConverters::fromArray('string', $o['values']);
        if (isset($o['start'])) $this->start = JsonConverters::from('DateTime', $o['start']);
        if (isset($o['end'])) $this->end = JsonConverters::from('DateTime', $o['end']);
        if (isset($o['higherThan'])) $this->higherThan = $o['higherThan'];
        if (isset($o['lowerThan'])) $this->lowerThan = $o['lowerThan'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->type)) $o['type'] = JsonConverters::to('ReportFilterType', $this->type);
        if (isset($this->values)) $o['values'] = JsonConverters::toArray('string', $this->values);
        if (isset($this->start)) $o['start'] = JsonConverters::to('DateTime', $this->start);
        if (isset($this->end)) $o['end'] = JsonConverters::to('DateTime', $this->end);
        if (isset($this->higherThan)) $o['higherThan'] = $this->higherThan;
        if (isset($this->lowerThan)) $o['lowerThan'] = $this->lowerThan;
        return empty($o) ? new class(){} : $o;
    }
}

class DashboardCsvReportsRequest implements IPost, JsonSerializable
{
    public function __construct(
        /** @description Report Name */
        // @ApiMember(Description="Report Name", IsRequired=true, ParameterType="body")
        /** @var string */
        public string $reportName='',

        /** @description Filters */
        // @ApiMember(Description="Filters", IsRequired=true, ParameterType="body")
        /** @var array<string,ReportFilter>|null */
        public ?array $filters=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['reportName'])) $this->reportName = $o['reportName'];
        if (isset($o['filters'])) $this->filters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','ReportFilter']), $o['filters']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->reportName)) $o['reportName'] = $this->reportName;
        if (isset($this->filters)) $o['filters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','ReportFilter']), $this->filters);
        return empty($o) ? new class(){} : $o;
    }
}

PHP DashboardCsvReportsRequest DTOs

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

HTTP + JSV

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

POST /v1/reports/Csv HTTP/1.1 
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	reportName: String,
	filters: 
	{
		String: 
		{
			type: list,
			start: 0001-01-01,
			end: 0001-01-01,
			higherThan: 0,
			lowerThan: 0
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	totalCount: 0
}