| GET | /test/logging | Simple test method to confirm the logs are working |
|---|
<?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 TestResult implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $wasSuccessful=null,
/** @var string|null */
public ?string $description=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['wasSuccessful'])) $this->wasSuccessful = $o['wasSuccessful'];
if (isset($o['description'])) $this->description = $o['description'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->wasSuccessful)) $o['wasSuccessful'] = $this->wasSuccessful;
if (isset($this->description)) $o['description'] = $this->description;
return empty($o) ? new class(){} : $o;
}
}
class TestResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $environment=null,
/** @var array<string,TestResult>|null */
public ?array $tests=null,
/** @var bool|null */
public ?bool $wasSuccessful=null,
/** @var string|null */
public ?string $db=null,
/** @var bool|null */
public ?bool $debugMode=null,
/** @var bool|null */
public ?bool $serverGC=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['environment'])) $this->environment = $o['environment'];
if (isset($o['tests'])) $this->tests = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','TestResult']), $o['tests']);
if (isset($o['wasSuccessful'])) $this->wasSuccessful = $o['wasSuccessful'];
if (isset($o['db'])) $this->db = $o['db'];
if (isset($o['debugMode'])) $this->debugMode = $o['debugMode'];
if (isset($o['serverGC'])) $this->serverGC = $o['serverGC'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->environment)) $o['environment'] = $this->environment;
if (isset($this->tests)) $o['tests'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','TestResult']), $this->tests);
if (isset($this->wasSuccessful)) $o['wasSuccessful'] = $this->wasSuccessful;
if (isset($this->db)) $o['db'] = $this->db;
if (isset($this->debugMode)) $o['debugMode'] = $this->debugMode;
if (isset($this->serverGC)) $o['serverGC'] = $this->serverGC;
return empty($o) ? new class(){} : $o;
}
}
class TestLogging implements 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 .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /test/logging HTTP/1.1 Host: reservation.api.dev.86degrees.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
environment: String,
tests:
{
String:
{
wasSuccessful: False,
description: String
}
},
wasSuccessful: False,
db: String,
debugMode: False,
serverGC: False
}