| Required role: | TenantReader |
| All Verbs | /api/collections/{Id}/cost | ||
|---|---|---|---|
| All Verbs | /collections/{Id}/cost |
<?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};
/** @description Get collections costs */
// @Api(Description="Get collections costs")
// @ApiResponse(Description="The request ended successful", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.TimeSeries.Reponses.UnitValueDto)", StatusCode=200)
class GetCollectionCost implements IBaseRequest, IGet, IHasId, IHasTenantName, JsonSerializable
{
public function __construct(
/** @description The unique id of the collection */
// @ApiMember(DataType="string", Description="The unique id of the collection", Format="guid", IsRequired=true, ParameterType="path")
/** @var string */
public string $id='',
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
/** @var string */
public string $tenantName='',
/** @description By default only the current months cost are returned. Specify how many previous months should be included */
// @ApiMember(DataType="int", Description="By default only the current months cost are returned. Specify how many previous months should be included", ParameterType="query")
// @Validate(Validator="InclusiveBetween(0,14)")
/** @var int */
public int $includePreviousMonths=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
if (isset($o['includePreviousMonths'])) $this->includePreviousMonths = $o['includePreviousMonths'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
if (isset($this->includePreviousMonths)) $o['includePreviousMonths'] = $this->includePreviousMonths;
return empty($o) ? new class(){} : $o;
}
}
enum ValueDataType : string
{
case String = 'String';
case Number = 'Number';
case Boolean = 'Boolean';
case List = 'List';
}
enum Environments : string
{
case Lab = 'Lab';
case Poc = 'Poc';
case Dev = 'Dev';
case Test = 'Test';
case Int = 'Int';
case Uat = 'Uat';
case Prod = 'Prod';
}
class VariableDto implements JsonSerializable
{
public function __construct(
/** @var string */
public string $name='',
/** @description Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false, List = [1,2,3,4]). Note: string values need extra quotes */
/** @var string */
public string $value='',
/** @description The data type of the value property */
/** @var ValueDataType|null */
public ?ValueDataType $type=null,
/** @var string|null */
public ?string $description=null,
/** @var bool|null */
public ?bool $isInherited=null,
/** @var Environments|null */
public ?Environments $environment=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['value'])) $this->value = $o['value'];
if (isset($o['type'])) $this->type = JsonConverters::from('ValueDataType', $o['type']);
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['isInherited'])) $this->isInherited = $o['isInherited'];
if (isset($o['environment'])) $this->environment = JsonConverters::from('Environments', $o['environment']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->value)) $o['value'] = $this->value;
if (isset($this->type)) $o['type'] = JsonConverters::to('ValueDataType', $this->type);
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->isInherited)) $o['isInherited'] = $this->isInherited;
if (isset($this->environment)) $o['environment'] = JsonConverters::to('Environments', $this->environment);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class ItemsResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): ItemsResponse {
$to = new ItemsResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var array<VariableDto>|null */
public mixed $items=null,
/** @var int */
public mixed $offset=0,
/** @var int */
public mixed $total=0,
/** @var bool|null */
public mixed $isGrouped=null,
/** @var ResponseStatus|null */
public mixed $responseStatus=null,
/** @var array<string,string>|null */
public mixed $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['items'])) $this->items = JsonConverters::fromArray('VariableDto', $o['items']);
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['total'])) $this->total = $o['total'];
if (isset($o['isGrouped'])) $this->isGrouped = $o['isGrouped'];
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->items)) $o['items'] = JsonConverters::toArray('VariableDto', $this->items);
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->total)) $o['total'] = $this->total;
if (isset($this->isGrouped)) $o['isGrouped'] = $this->isGrouped;
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/collections/{Id}/cost HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"id":"00000000-0000-0000-0000-000000000000","tenantName":"String","includePreviousMonths":0,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"items":null,"offset":0,"total":0,"isGrouped":false,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}