| GET,OPTIONS | /v1/project/{ProjectID}/agreements | ||
|---|---|---|---|
| GET,POST,PUT,DELETE,OPTIONS | /v1/serviceagreement | ||
| GET,DELETE,OPTIONS | /v1/serviceagreement/{AgreementID} |
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 ServiceAgreement:
agreement_i_d: int = 0
agreement_u_i_d: Optional[str] = None
tenant_id: Optional[str] = None
branch_id: Optional[str] = None
branch_name: Optional[str] = None
project_i_d: int = 0
project_name: Optional[str] = None
name: Optional[str] = None
status: Optional[str] = None
pricing_shape: Optional[str] = None
monthly_amount: Optional[Decimal] = None
per_visit_amount: Optional[Decimal] = None
skip_policy: Optional[str] = None
season_start_month: Optional[int] = None
season_start_day: Optional[int] = None
season_end_month: Optional[int] = None
season_end_day: Optional[int] = None
recurrence_frequency: Optional[str] = None
recurrence_by: Optional[str] = None
recurrence_by_value: Optional[str] = None
effective_start_date: Optional[datetime.datetime] = None
end_date: Optional[datetime.datetime] = None
preferred_crew_i_d: Optional[int] = None
preferred_crew_name: Optional[str] = None
external_ref: Optional[str] = None
created_by: Optional[str] = None
created_at: Optional[datetime.datetime] = None
updated_by: Optional[str] = None
updated_at: Optional[datetime.datetime] = None
next_visit_date: Optional[datetime.datetime] = None
visits_this_period: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ServiceAgreementResponse:
response_status: Optional[ResponseStatus] = None
service_agreement: List[ServiceAgreement] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ServiceAgreementRequest:
agreement_i_d: int = 0
project_i_d: int = 0
service_agreement: List[ServiceAgreement] = field(default_factory=list)
Python ServiceAgreementRequest DTOs
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.
POST /v1/serviceagreement HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
AgreementID: 0,
ProjectID: 0,
ServiceAgreement:
[
{
AgreementID: 0,
AgreementUID: 00000000000000000000000000000000,
TenantId: 00000000000000000000000000000000,
BranchId: 00000000000000000000000000000000,
BranchName: String,
ProjectID: 0,
ProjectName: String,
Name: String,
Status: String,
PricingShape: String,
MonthlyAmount: 0,
PerVisitAmount: 0,
SkipPolicy: String,
SeasonStartMonth: 0,
SeasonStartDay: 0,
SeasonEndMonth: 0,
SeasonEndDay: 0,
RecurrenceFrequency: String,
RecurrenceBy: String,
RecurrenceByValue: String,
EffectiveStartDate: 0001-01-01,
EndDate: 0001-01-01,
PreferredCrewID: 0,
PreferredCrewName: String,
ExternalRef: String,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedBy: String,
UpdatedAt: 0001-01-01,
NextVisitDate: 0001-01-01,
VisitsThisPeriod: 0
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
ServiceAgreement:
[
{
AgreementID: 0,
AgreementUID: 00000000000000000000000000000000,
TenantId: 00000000000000000000000000000000,
BranchId: 00000000000000000000000000000000,
BranchName: String,
ProjectID: 0,
ProjectName: String,
Name: String,
Status: String,
PricingShape: String,
MonthlyAmount: 0,
PerVisitAmount: 0,
SkipPolicy: String,
SeasonStartMonth: 0,
SeasonStartDay: 0,
SeasonEndMonth: 0,
SeasonEndDay: 0,
RecurrenceFrequency: String,
RecurrenceBy: String,
RecurrenceByValue: String,
EffectiveStartDate: 0001-01-01,
EndDate: 0001-01-01,
PreferredCrewID: 0,
PreferredCrewName: String,
ExternalRef: String,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedBy: String,
UpdatedAt: 0001-01-01,
NextVisitDate: 0001-01-01,
VisitsThisPeriod: 0
}
]
}