| POST | /api/riskstore/eventset/deal-expected-loss | Get the deals expected losses by metarisk |
|---|
<?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 DealExpectedLoss implements JsonSerializable
{
public function __construct(
/** @var int */
public int $sourceDealId=0,
/** @var int */
public int $perspectiveId=0,
/** @var int */
public int $metaRiskId=0,
/** @var float */
public float $elAgg=0.0,
/** @var float */
public float $elOcc=0.0,
/** @var float */
public float $pAtt=0.0,
/** @var float */
public float $pExh=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sourceDealId'])) $this->sourceDealId = $o['sourceDealId'];
if (isset($o['perspectiveId'])) $this->perspectiveId = $o['perspectiveId'];
if (isset($o['metaRiskId'])) $this->metaRiskId = $o['metaRiskId'];
if (isset($o['elAgg'])) $this->elAgg = $o['elAgg'];
if (isset($o['elOcc'])) $this->elOcc = $o['elOcc'];
if (isset($o['pAtt'])) $this->pAtt = $o['pAtt'];
if (isset($o['pExh'])) $this->pExh = $o['pExh'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sourceDealId)) $o['sourceDealId'] = $this->sourceDealId;
if (isset($this->perspectiveId)) $o['perspectiveId'] = $this->perspectiveId;
if (isset($this->metaRiskId)) $o['metaRiskId'] = $this->metaRiskId;
if (isset($this->elAgg)) $o['elAgg'] = $this->elAgg;
if (isset($this->elOcc)) $o['elOcc'] = $this->elOcc;
if (isset($this->pAtt)) $o['pAtt'] = $this->pAtt;
if (isset($this->pExh)) $o['pExh'] = $this->pExh;
return empty($o) ? new class(){} : $o;
}
}
class GetDealExpectedLossResponse implements JsonSerializable
{
public function __construct(
/** @var array<DealExpectedLoss>|null */
public ?array $dealExpectedLosses=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['dealExpectedLosses'])) $this->dealExpectedLosses = JsonConverters::fromArray('DealExpectedLoss', $o['dealExpectedLosses']);
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->dealExpectedLosses)) $o['dealExpectedLosses'] = JsonConverters::toArray('DealExpectedLoss', $this->dealExpectedLosses);
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
class GetDealExpectedLossRequest implements IPost, JsonSerializable
{
public function __construct(
/** @description The source deal system (IGN) to get the date for */
// @ApiMember(DataType="string", Description="The source deal system (IGN) to get the date for", IsRequired=true)
/** @var string */
public string $sourceDealSystem='',
/** @description The as of date to query */
// @ApiMember(DataType="string", Description="The as of date to query", Format="date-time")
/** @var DateTime|null */
public ?DateTime $asOf=null,
/** @description The metarisks to query for */
// @ApiMember(DataType="array", Description="The metarisks to query for", Format="int32", IsRequired=true)
/** @var array<int>|null */
public ?array $metaRiskIds=null,
/** @description The perspectives to query for */
// @ApiMember(DataType="array", Description="The perspectives to query for", Format="int32")
/** @var array<int>|null */
public ?array $perspectiveIds=null,
/** @description The perspectives types to query for (0 - Vendor, 10 - Nephila 1.0, 16 - Nephila 2.0 etc...) */
// @ApiMember(DataType="array", Description="The perspectives types to query for (0 - Vendor, 10 - Nephila 1.0, 16 - Nephila 2.0 etc...)", Format="int32")
/** @var array<int>|null */
public ?array $perspectiveTypeIds=null,
/** @description The source deal ids to query for */
// @ApiMember(DataType="array", Description="The source deal ids to query for", Format="int64", IsRequired=true)
/** @var array<int>|null */
public ?array $sourceDealIds=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sourceDealSystem'])) $this->sourceDealSystem = $o['sourceDealSystem'];
if (isset($o['asOf'])) $this->asOf = JsonConverters::from('DateTime', $o['asOf']);
if (isset($o['metaRiskIds'])) $this->metaRiskIds = JsonConverters::fromArray('int', $o['metaRiskIds']);
if (isset($o['perspectiveIds'])) $this->perspectiveIds = JsonConverters::fromArray('int', $o['perspectiveIds']);
if (isset($o['perspectiveTypeIds'])) $this->perspectiveTypeIds = JsonConverters::fromArray('int', $o['perspectiveTypeIds']);
if (isset($o['sourceDealIds'])) $this->sourceDealIds = JsonConverters::fromArray('int', $o['sourceDealIds']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sourceDealSystem)) $o['sourceDealSystem'] = $this->sourceDealSystem;
if (isset($this->asOf)) $o['asOf'] = JsonConverters::to('DateTime', $this->asOf);
if (isset($this->metaRiskIds)) $o['metaRiskIds'] = JsonConverters::toArray('int', $this->metaRiskIds);
if (isset($this->perspectiveIds)) $o['perspectiveIds'] = JsonConverters::toArray('int', $this->perspectiveIds);
if (isset($this->perspectiveTypeIds)) $o['perspectiveTypeIds'] = JsonConverters::toArray('int', $this->perspectiveTypeIds);
if (isset($this->sourceDealIds)) $o['sourceDealIds'] = JsonConverters::toArray('int', $this->sourceDealIds);
return empty($o) ? new class(){} : $o;
}
}
PHP GetDealExpectedLossRequest 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/deal-expected-loss HTTP/1.1
Host: riskstoreng-dev.nephila.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"sourceDealSystem":"String","asOf":"0001-01-01T00:00:00.0000000Z","metaRiskIds":[0],"perspectiveIds":[0],"perspectiveTypeIds":[0],"sourceDealIds":[0]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"dealExpectedLosses":[{"sourceDealId":0,"perspectiveId":0,"metaRiskId":0,"elAgg":0,"elOcc":0,"pAtt":0,"pExh":0}],"responseStatus":{"__type":"ServiceStack.ResponseStatus, ServiceStack.Interfaces","errorCode":"String","message":"String","stackTrace":"String","errors":[{"__type":"ServiceStack.ResponseError, ServiceStack.Interfaces","errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}