| 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 .xml suffix or ?format=xml
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/xml
Content-Type: application/xml
Content-Length: length
<GetDealExpectedLossRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Nephila.RiskStore.ServiceModel.Requests">
<AsOf>0001-01-01T00:00:00</AsOf>
<MetaRiskIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</MetaRiskIds>
<PerspectiveIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</PerspectiveIds>
<PerspectiveTypeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:int>0</d2p1:int>
</PerspectiveTypeIds>
<SourceDealIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:long>0</d2p1:long>
</SourceDealIds>
<SourceDealSystem>String</SourceDealSystem>
</GetDealExpectedLossRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetDealExpectedLossResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Nephila.RiskStore.ServiceModel.Requests">
<DealExpectedLosses xmlns:d2p1="http://schemas.datacontract.org/2004/07/Nephila.RiskStore.ServiceModel.Types">
<d2p1:DealExpectedLoss>
<d2p1:ELAgg>0</d2p1:ELAgg>
<d2p1:ELOcc>0</d2p1:ELOcc>
<d2p1:MetaRiskId>0</d2p1:MetaRiskId>
<d2p1:PAtt>0</d2p1:PAtt>
<d2p1:PExh>0</d2p1:PExh>
<d2p1:PerspectiveId>0</d2p1:PerspectiveId>
<d2p1:SourceDealId>0</d2p1:SourceDealId>
</d2p1:DealExpectedLoss>
</DealExpectedLosses>
<ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:Message>String</d2p1:Message>
<d2p1:StackTrace>String</d2p1:StackTrace>
<d2p1:Errors>
<d2p1:ResponseError>
<d2p1:ErrorCode>String</d2p1:ErrorCode>
<d2p1:FieldName>String</d2p1:FieldName>
<d2p1:Message>String</d2p1:Message>
<d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d5p1:KeyValueOfstringstring>
<d5p1:Key>String</d5p1:Key>
<d5p1:Value>String</d5p1:Value>
</d5p1:KeyValueOfstringstring>
</d2p1:Meta>
</d2p1:ResponseError>
</d2p1:Errors>
<d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d3p1:KeyValueOfstringstring>
<d3p1:Key>String</d3p1:Key>
<d3p1:Value>String</d3p1:Value>
</d3p1:KeyValueOfstringstring>
</d2p1:Meta>
</ResponseStatus>
</GetDealExpectedLossResponse>