All Verbs | /config |
---|
<?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 TechnologyTier : string
{
case ProgrammingLanguage = 'ProgrammingLanguage';
case Client = 'Client';
case Http = 'Http';
case Server = 'Server';
case Data = 'Data';
case SoftwareInfrastructure = 'SoftwareInfrastructure';
case OperatingSystem = 'OperatingSystem';
case HardwareInfrastructure = 'HardwareInfrastructure';
case ThirdPartyServices = 'ThirdPartyServices';
}
// @DataContract
class Option implements JsonSerializable
{
public function __construct(
// @DataMember(Name="name")
/** @var string|null */
public ?string $name=null,
// @DataMember(Name="title")
/** @var string|null */
public ?string $title=null,
// @DataMember(Name="value")
/** @var TechnologyTier|null */
public ?TechnologyTier $value=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['title'])) $this->title = $o['title'];
if (isset($o['value'])) $this->value = JsonConverters::from('TechnologyTier', $o['value']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->title)) $o['title'] = $this->title;
if (isset($this->value)) $o['value'] = JsonConverters::to('TechnologyTier', $this->value);
return empty($o) ? new class(){} : $o;
}
}
class GetConfigResponse implements JsonSerializable
{
public function __construct(
/** @var array<Option>|null */
public ?array $allTiers=null,
/** @var array<Option>|null */
public ?array $allPostTypes=null,
/** @var array<Option>|null */
public ?array $allFlagTypes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['allTiers'])) $this->allTiers = JsonConverters::fromArray('Option', $o['allTiers']);
if (isset($o['allPostTypes'])) $this->allPostTypes = JsonConverters::fromArray('Option', $o['allPostTypes']);
if (isset($o['allFlagTypes'])) $this->allFlagTypes = JsonConverters::fromArray('Option', $o['allFlagTypes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->allTiers)) $o['allTiers'] = JsonConverters::toArray('Option', $this->allTiers);
if (isset($this->allPostTypes)) $o['allPostTypes'] = JsonConverters::toArray('Option', $this->allPostTypes);
if (isset($this->allFlagTypes)) $o['allFlagTypes'] = JsonConverters::toArray('Option', $this->allFlagTypes);
return empty($o) ? new class(){} : $o;
}
}
class GetConfig implements IGet, JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /config HTTP/1.1
Host: techstacks.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetConfig xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TechStacks.ServiceModel" />
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <GetConfigResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TechStacks.ServiceModel"> <AllFlagTypes> <Option> <name>String</name> <title>String</title> <value>ProgrammingLanguage</value> </Option> </AllFlagTypes> <AllPostTypes> <Option> <name>String</name> <title>String</title> <value>ProgrammingLanguage</value> </Option> </AllPostTypes> <AllTiers> <Option> <name>String</name> <title>String</title> <value>ProgrammingLanguage</value> </Option> </AllTiers> </GetConfigResponse>