| POST | /api/riskstore/eventset/deal-expected-loss | Get the deals expected losses by metarisk |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DealExpectedLoss:
source_deal_id: int = 0
perspective_id: int = 0
meta_risk_id: int = 0
el_agg: Decimal = decimal.Decimal(0)
el_occ: Decimal = decimal.Decimal(0)
p_att: Decimal = decimal.Decimal(0)
p_exh: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetDealExpectedLossResponse:
deal_expected_losses: Optional[List[DealExpectedLoss]] = None
response_status: Optional[ResponseStatus] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetDealExpectedLossRequest(IPost):
# @ApiMember(DataType="string", Description="The source deal system (IGN) to get the date for", IsRequired=true)
source_deal_system: Optional[str] = None
"""
The source deal system (IGN) to get the date for
"""
# @ApiMember(DataType="string", Description="The as of date to query", Format="date-time")
as_of: Optional[datetime.datetime] = None
"""
The as of date to query
"""
# @ApiMember(DataType="array", Description="The metarisks to query for", Format="int32", IsRequired=true)
meta_risk_ids: List[int] = field(default_factory=list)
"""
The metarisks to query for
"""
# @ApiMember(DataType="array", Description="The perspectives to query for", Format="int32")
perspective_ids: Optional[List[int]] = None
"""
The perspectives to query for
"""
# @ApiMember(DataType="array", Description="The perspectives types to query for (0 - Vendor, 10 - Nephila 1.0, 16 - Nephila 2.0 etc...)", Format="int32")
perspective_type_ids: Optional[List[int]] = None
"""
The perspectives types to query for (0 - Vendor, 10 - Nephila 1.0, 16 - Nephila 2.0 etc...)
"""
# @ApiMember(DataType="array", Description="The source deal ids to query for", Format="int64", IsRequired=true)
source_deal_ids: List[int] = field(default_factory=list)
"""
The source deal ids to query for
"""
Python GetDealExpectedLossRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
Content-Type: text/csv
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: text/csv
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"}}}