| Required role: | TenantReader |
| GET | /api/collections/{Id}/variables | Gets the collection's variables | |
|---|---|---|---|
| GET | /collections/{Id}/variables | Gets the collection's variables |
<?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};
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;
}
}
/** @description Gets the collection's variables */
// @Api(Description="Gets the collection's variables")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(YCO.Dune.Models.Dtos.Common.Responses.ItemsResponse`1[[CoreService.ServiceModel.Dtos.Base.Responses.VariableDto, CoreService.ServiceModel, Version=0.15.14.0, Culture=neutral, PublicKeyToken=null]])", StatusCode=200)
class GetCollectionVariables implements IBaseRequest, IHasId, IHasTenantName, IGet, JsonSerializable
{
public function __construct(
// @ApiMember(DataType="string", 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 Include inherited variables */
// @ApiMember(Description="Include inherited variables", ParameterType="query")
/** @var bool|null */
public ?bool $includeInherited=null
) {
}
/** @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['includeInherited'])) $this->includeInherited = $o['includeInherited'];
}
/** @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->includeInherited)) $o['includeInherited'] = $this->includeInherited;
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;
}
}
PHP GetCollectionVariables DTOs
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.
GET /api/collections/{Id}/variables HTTP/1.1
Host: core.starburst.svc
Accept: application/json
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"}}