| POST | /api/riskstore/eventset/ingest | Ingest EventSet Request | Ingest EventSet Request |
|---|
<?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 ProcessingStatus : int
{
case New = 0;
case Processing = 1;
case Failed = 10;
case Successful = 20;
}
class EventSetTelemetry implements JsonSerializable
{
public function __construct(
/** @var int */
public int $eventSetId=0,
/** @var DateTime|null */
public ?DateTime $startedDateTimeUtc=null,
/** @var DateTime|null */
public ?DateTime $endedDateTimeUct=null,
/** @var int */
public int $eventLossCount=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['eventSetId'])) $this->eventSetId = $o['eventSetId'];
if (isset($o['startedDateTimeUtc'])) $this->startedDateTimeUtc = JsonConverters::from('DateTime', $o['startedDateTimeUtc']);
if (isset($o['endedDateTimeUct'])) $this->endedDateTimeUct = JsonConverters::from('DateTime', $o['endedDateTimeUct']);
if (isset($o['eventLossCount'])) $this->eventLossCount = $o['eventLossCount'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->eventSetId)) $o['eventSetId'] = $this->eventSetId;
if (isset($this->startedDateTimeUtc)) $o['startedDateTimeUtc'] = JsonConverters::to('DateTime', $this->startedDateTimeUtc);
if (isset($this->endedDateTimeUct)) $o['endedDateTimeUct'] = JsonConverters::to('DateTime', $this->endedDateTimeUct);
if (isset($this->eventLossCount)) $o['eventLossCount'] = $this->eventLossCount;
return empty($o) ? new class(){} : $o;
}
}
class EventSet implements JsonSerializable
{
public function __construct(
/** @var int */
public int $eventSetId=0,
/** @var ProcessingStatus|null */
public ?ProcessingStatus $processingStatus=null,
/** @var string|null */
public ?string $sourceModelSystem=null,
/** @var string|null */
public ?string $sourceEventSetId=null,
/** @var string|null */
public ?string $modelId=null,
/** @var int */
public int $perspectiveId=0,
/** @var int */
public int $simulationCount=0,
/** @var string|null */
public ?string $programCalculationId=null,
/** @var string|null */
public ?string $description=null,
/** @var float */
public float $limit=0.0,
/** @var int */
public int $reinstatements=0,
/** @var string|null */
public ?string $eventSourceType=null,
/** @var string|null */
public ?string $eventSetOriginId=null,
/** @var string|null */
public ?string $eventSetOriginName=null,
/** @var string|null */
public ?string $eventSetOriginType=null,
/** @var string|null */
public ?string $sourceEventSetLossContainer=null,
/** @var string|null */
public ?string $sourceEventSetLossPath=null,
/** @var string|null */
public ?string $resolution=null,
/** @var string|null */
public ?string $resultsHash=null,
/** @var float */
public float $expectedLossAggregate=0.0,
/** @var float */
public float $expectedLossOccurrence=0.0,
/** @var float */
public float $probabilityOfAttachment=0.0,
/** @var float */
public float $probabilityOfExhaustion=0.0,
/** @var DateTime */
public DateTime $approvedDateTimeUtc=new DateTime(),
/** @var string|null */
public ?string $approvedBy=null,
/** @var int */
public int $eventSourceId=0,
/** @var DateTime */
public DateTime $validFromUtc=new DateTime(),
/** @var DateTime */
public DateTime $validToUtc=new DateTime(),
/** @var string|null */
public ?string $container=null,
/** @var string|null */
public ?string $blobName=null,
/** @var DateTime */
public DateTime $updatedDateUtc=new DateTime(),
/** @var bool|null */
public ?bool $isArchived=null,
/** @var string|null */
public ?string $archivedLossDataBlobPath=null,
/** @var string|null */
public ?string $archivedLossDataHash=null,
/** @var EventSetTelemetry|null */
public ?EventSetTelemetry $eventSetTelemetry=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['eventSetId'])) $this->eventSetId = $o['eventSetId'];
if (isset($o['processingStatus'])) $this->processingStatus = JsonConverters::from('ProcessingStatus', $o['processingStatus']);
if (isset($o['sourceModelSystem'])) $this->sourceModelSystem = $o['sourceModelSystem'];
if (isset($o['sourceEventSetId'])) $this->sourceEventSetId = $o['sourceEventSetId'];
if (isset($o['modelId'])) $this->modelId = $o['modelId'];
if (isset($o['perspectiveId'])) $this->perspectiveId = $o['perspectiveId'];
if (isset($o['simulationCount'])) $this->simulationCount = $o['simulationCount'];
if (isset($o['programCalculationId'])) $this->programCalculationId = $o['programCalculationId'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['limit'])) $this->limit = $o['limit'];
if (isset($o['reinstatements'])) $this->reinstatements = $o['reinstatements'];
if (isset($o['eventSourceType'])) $this->eventSourceType = $o['eventSourceType'];
if (isset($o['eventSetOriginId'])) $this->eventSetOriginId = $o['eventSetOriginId'];
if (isset($o['eventSetOriginName'])) $this->eventSetOriginName = $o['eventSetOriginName'];
if (isset($o['eventSetOriginType'])) $this->eventSetOriginType = $o['eventSetOriginType'];
if (isset($o['sourceEventSetLossContainer'])) $this->sourceEventSetLossContainer = $o['sourceEventSetLossContainer'];
if (isset($o['sourceEventSetLossPath'])) $this->sourceEventSetLossPath = $o['sourceEventSetLossPath'];
if (isset($o['resolution'])) $this->resolution = $o['resolution'];
if (isset($o['resultsHash'])) $this->resultsHash = $o['resultsHash'];
if (isset($o['expectedLossAggregate'])) $this->expectedLossAggregate = $o['expectedLossAggregate'];
if (isset($o['expectedLossOccurrence'])) $this->expectedLossOccurrence = $o['expectedLossOccurrence'];
if (isset($o['probabilityOfAttachment'])) $this->probabilityOfAttachment = $o['probabilityOfAttachment'];
if (isset($o['probabilityOfExhaustion'])) $this->probabilityOfExhaustion = $o['probabilityOfExhaustion'];
if (isset($o['approvedDateTimeUtc'])) $this->approvedDateTimeUtc = JsonConverters::from('DateTime', $o['approvedDateTimeUtc']);
if (isset($o['approvedBy'])) $this->approvedBy = $o['approvedBy'];
if (isset($o['eventSourceId'])) $this->eventSourceId = $o['eventSourceId'];
if (isset($o['validFromUtc'])) $this->validFromUtc = JsonConverters::from('DateTime', $o['validFromUtc']);
if (isset($o['validToUtc'])) $this->validToUtc = JsonConverters::from('DateTime', $o['validToUtc']);
if (isset($o['container'])) $this->container = $o['container'];
if (isset($o['blobName'])) $this->blobName = $o['blobName'];
if (isset($o['updatedDateUtc'])) $this->updatedDateUtc = JsonConverters::from('DateTime', $o['updatedDateUtc']);
if (isset($o['isArchived'])) $this->isArchived = $o['isArchived'];
if (isset($o['archivedLossDataBlobPath'])) $this->archivedLossDataBlobPath = $o['archivedLossDataBlobPath'];
if (isset($o['archivedLossDataHash'])) $this->archivedLossDataHash = $o['archivedLossDataHash'];
if (isset($o['eventSetTelemetry'])) $this->eventSetTelemetry = JsonConverters::from('EventSetTelemetry', $o['eventSetTelemetry']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->eventSetId)) $o['eventSetId'] = $this->eventSetId;
if (isset($this->processingStatus)) $o['processingStatus'] = JsonConverters::to('ProcessingStatus', $this->processingStatus);
if (isset($this->sourceModelSystem)) $o['sourceModelSystem'] = $this->sourceModelSystem;
if (isset($this->sourceEventSetId)) $o['sourceEventSetId'] = $this->sourceEventSetId;
if (isset($this->modelId)) $o['modelId'] = $this->modelId;
if (isset($this->perspectiveId)) $o['perspectiveId'] = $this->perspectiveId;
if (isset($this->simulationCount)) $o['simulationCount'] = $this->simulationCount;
if (isset($this->programCalculationId)) $o['programCalculationId'] = $this->programCalculationId;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->limit)) $o['limit'] = $this->limit;
if (isset($this->reinstatements)) $o['reinstatements'] = $this->reinstatements;
if (isset($this->eventSourceType)) $o['eventSourceType'] = $this->eventSourceType;
if (isset($this->eventSetOriginId)) $o['eventSetOriginId'] = $this->eventSetOriginId;
if (isset($this->eventSetOriginName)) $o['eventSetOriginName'] = $this->eventSetOriginName;
if (isset($this->eventSetOriginType)) $o['eventSetOriginType'] = $this->eventSetOriginType;
if (isset($this->sourceEventSetLossContainer)) $o['sourceEventSetLossContainer'] = $this->sourceEventSetLossContainer;
if (isset($this->sourceEventSetLossPath)) $o['sourceEventSetLossPath'] = $this->sourceEventSetLossPath;
if (isset($this->resolution)) $o['resolution'] = $this->resolution;
if (isset($this->resultsHash)) $o['resultsHash'] = $this->resultsHash;
if (isset($this->expectedLossAggregate)) $o['expectedLossAggregate'] = $this->expectedLossAggregate;
if (isset($this->expectedLossOccurrence)) $o['expectedLossOccurrence'] = $this->expectedLossOccurrence;
if (isset($this->probabilityOfAttachment)) $o['probabilityOfAttachment'] = $this->probabilityOfAttachment;
if (isset($this->probabilityOfExhaustion)) $o['probabilityOfExhaustion'] = $this->probabilityOfExhaustion;
if (isset($this->approvedDateTimeUtc)) $o['approvedDateTimeUtc'] = JsonConverters::to('DateTime', $this->approvedDateTimeUtc);
if (isset($this->approvedBy)) $o['approvedBy'] = $this->approvedBy;
if (isset($this->eventSourceId)) $o['eventSourceId'] = $this->eventSourceId;
if (isset($this->validFromUtc)) $o['validFromUtc'] = JsonConverters::to('DateTime', $this->validFromUtc);
if (isset($this->validToUtc)) $o['validToUtc'] = JsonConverters::to('DateTime', $this->validToUtc);
if (isset($this->container)) $o['container'] = $this->container;
if (isset($this->blobName)) $o['blobName'] = $this->blobName;
if (isset($this->updatedDateUtc)) $o['updatedDateUtc'] = JsonConverters::to('DateTime', $this->updatedDateUtc);
if (isset($this->isArchived)) $o['isArchived'] = $this->isArchived;
if (isset($this->archivedLossDataBlobPath)) $o['archivedLossDataBlobPath'] = $this->archivedLossDataBlobPath;
if (isset($this->archivedLossDataHash)) $o['archivedLossDataHash'] = $this->archivedLossDataHash;
if (isset($this->eventSetTelemetry)) $o['eventSetTelemetry'] = JsonConverters::to('EventSetTelemetry', $this->eventSetTelemetry);
return empty($o) ? new class(){} : $o;
}
}
class IngestEventSetRequest implements IPost, JsonSerializable
{
public function __construct(
/** @var EventSet|null */
public ?EventSet $eventSet=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['eventSet'])) $this->eventSet = JsonConverters::from('EventSet', $o['eventSet']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->eventSet)) $o['eventSet'] = JsonConverters::to('EventSet', $this->eventSet);
return empty($o) ? new class(){} : $o;
}
}
PHP IngestEventSetRequest 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.
POST /api/riskstore/eventset/ingest HTTP/1.1
Host: riskstoreng-dev.nephila.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"eventSet":{"eventSetId":0,"processingStatus":"New","sourceModelSystem":"String","sourceEventSetId":"String","modelId":"String","perspectiveId":0,"simulationCount":0,"programCalculationId":"String","description":"String","limit":0,"reinstatements":0,"eventSourceType":"String","eventSetOriginId":"String","eventSetOriginName":"String","eventSetOriginType":"String","sourceEventSetLossContainer":"String","sourceEventSetLossPath":"String","resolution":"String","resultsHash":"String","expectedLossAggregate":0,"expectedLossOccurrence":0,"probabilityOfAttachment":0,"probabilityOfExhaustion":0,"approvedDateTimeUtc":"0001-01-01T00:00:00.0000000Z","approvedBy":"String","eventSourceId":0,"validFromUtc":"0001-01-01T00:00:00.0000000Z","validToUtc":"0001-01-01T00:00:00.0000000Z","container":"String","blobName":"String","updatedDateUtc":"0001-01-01T00:00:00.0000000Z","isArchived":false,"archivedLossDataBlobPath":"String","archivedLossDataHash":"String","eventSetTelemetry":{"eventSetId":0,"startedDateTimeUtc":"0001-01-01T00:00:00.0000000Z","endedDateTimeUct":"0001-01-01T00:00:00.0000000Z","eventLossCount":0}}}