POST, GET | /api/C2BGetInstrumentDetail |
---|
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 BaseRequest:
# @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
api_key: Optional[str] = None
"""
This is your AIM API Key provided by Tri-Tech
"""
# @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
o_auth_token: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseSecureRequest(BaseRequest):
# @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
token: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
device_id: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
app_id: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponseResult:
# @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
status_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
login: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
error_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
error_display_text: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
error_message: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
domain_name: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
ip_address: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
# @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
status: Optional[BaseResponseResult] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BPlanCodeGeneric:
code: Optional[str] = None
name: Optional[str] = None
months: int = 0
topic: Optional[str] = None
url: Optional[str] = None
final_topic: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BDeliveryInfo:
first_delivery: datetime.datetime = datetime.datetime(1, 1, 1)
delivery_time: datetime.datetime = datetime.datetime(1, 1, 1)
delivery_threshold: int = 0
sunday_delivery: bool = False
monday_delivery: bool = False
tuesday_delivery: bool = False
wednesday_delivery: bool = False
thursday_delivery: bool = False
friday_delivery: bool = False
saturday_delivery: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BTeacherGeneric:
teacher_name: Optional[str] = None
school_name: Optional[str] = None
district_name: Optional[str] = None
topic: Optional[str] = None
id: int = 0
delivery_info: Optional[C2BDeliveryInfo] = None
aim_school_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BSchoolGeneric:
school_name: Optional[str] = None
district_name: Optional[str] = None
teacher_count: int = 0
topic: Optional[str] = None
id: int = 0
delivery_info: Optional[C2BDeliveryInfo] = None
aim_school_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BDistrictGeneric:
district_name: Optional[str] = None
school_count: int = 0
teacher_count: int = 0
topic: Optional[str] = None
id: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BGradeGeneric:
level: int = 0
grade: Optional[str] = None
down_pay: Decimal = decimal.Decimal(0)
down_maint: Decimal = decimal.Decimal(0)
mo_pay: Decimal = decimal.Decimal(0)
mo_maint: Decimal = decimal.Decimal(0)
id: int = 0
out_of_stock: bool = False
rent_price: Decimal = decimal.Decimal(0)
cash_price: Decimal = decimal.Decimal(0)
down_pay_tax: Optional[Decimal] = None
down_maint_tax: Optional[Decimal] = None
mo_pay_tax: Optional[Decimal] = None
mo_maint_tax: Optional[Decimal] = None
rent_price_plus_tax: Decimal = decimal.Decimal(0)
rent_price_plus_tax_less_downpay: Decimal = decimal.Decimal(0)
months: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BAccessoryGeneric:
accessory_desc: Optional[str] = None
price: Decimal = decimal.Decimal(0)
required: bool = False
default: bool = False
requires_location: bool = False
type: Optional[str] = None
topic: Optional[str] = None
id: int = 0
display_order: int = 0
sku: Optional[str] = None
tax_amount: Optional[Decimal] = None
cat_num: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BInstrumentGeneric:
instrument_name: Optional[str] = None
sku: Optional[str] = None
topic: Optional[str] = None
image: Optional[str] = None
level: int = 0
rent_price: Optional[Decimal] = None
cash_price: Optional[Decimal] = None
token: Optional[str] = None
instrument_id: int = 0
instrument_teacher_id: int = 0
grade_list: Optional[List[C2BGradeGeneric]] = None
has_grades: bool = False
display_order: int = 0
accessory_list: Optional[List[C2BAccessoryGeneric]] = None
delivery_list: Optional[List[C2BAccessoryGeneric]] = None
maintenance_list: Optional[List[C2BAccessoryGeneric]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BInstrumentDetailGeneric:
plan_code: Optional[C2BPlanCodeGeneric] = None
teacher: Optional[C2BTeacherGeneric] = None
school: Optional[C2BSchoolGeneric] = None
delivery_date: Optional[str] = None
sales_person: Optional[str] = None
district: Optional[C2BDistrictGeneric] = None
instrument: Optional[C2BInstrumentGeneric] = None
grade: Optional[C2BGradeGeneric] = None
accessory_list: Optional[List[C2BAccessoryGeneric]] = None
delivery_list: Optional[List[C2BAccessoryGeneric]] = None
maintenance_list: Optional[List[C2BAccessoryGeneric]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MobileLayout:
title: Optional[str] = None
returnurl: Optional[str] = None
sections: Optional[List[Section]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BGetInstrumentDetailResponse(BaseResponse):
instrument_details: Optional[C2BInstrumentDetailGeneric] = None
mobile_layout: Optional[MobileLayout] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BGetInstrumentDetailRequest(BaseSecureRequest):
"""
C2BGetInstrumentDetailRequires active-e Contracts Service.
"""
# @ApiMember(DataType="integer", Description="ID of the Teacher/Instrument record. Either this *or* TeacherId + InstrumentId must be sent.", Format="int64", Name="RsiPk", ParameterType="query")
rsi_pk: Optional[int] = None
"""
ID of the Teacher/Instrument record. Either this *or* TeacherId + InstrumentId must be sent.
"""
# @ApiMember(DataType="integer", Description="ID of the Teacher record. Either this+InstrumentID *or* RsiPk must be sent.", Format="int64", Name="TeacherId", ParameterType="query")
teacher_id: Optional[int] = None
"""
ID of the Teacher record. Either this+InstrumentID *or* RsiPk must be sent.
"""
# @ApiMember(DataType="integer", Description="ID of the Instrument record. Either this+TeacherID *or* RsiPk must be sent.", Format="int64", Name="InstrumentId", ParameterType="query")
instrument_id: Optional[int] = None
"""
ID of the Instrument record. Either this+TeacherID *or* RsiPk must be sent.
"""
# @ApiMember(DataType="integer", Description="ID of the Rate to be used. This is required.", Format="int64", IsRequired=true, Name="RateId", ParameterType="query")
rate_id: Optional[int] = None
"""
ID of the Rate to be used. This is required.
"""
# @ApiMember(DataType="string", Description="If 'Y', then Mobile Layout will be returned.", Name="IncludeMobileLayout", ParameterType="query")
include_mobile_layout: Optional[str] = None
"""
If 'Y', then Mobile Layout will be returned.
"""
# @ApiMember(DataType="integer", Description="ID of the Delivery option to be used.", Format="int64", IsRequired=true, Name="DeliveryId", ParameterType="query")
delivery_id: Optional[int] = None
"""
ID of the Delivery option to be used.
"""
# @ApiMember(DataType="integer", Description="ID of the Location. Used for Location required Delivery options.", Format="int64", IsRequired=true, Name="LocationId", ParameterType="query")
location_id: Optional[int] = None
"""
ID of the Location. Used for Location required Delivery options.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Section:
header: Optional[str] = None
id: Optional[str] = None
margin: Optional[str] = None
elements: Optional[List[Element]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LicenseMap:
name: Optional[str] = None
value: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Element:
type: Optional[str] = None
label: Optional[str] = None
id: Optional[str] = None
fontsize: Optional[str] = None
margin: Optional[str] = None
backgroundcolor: Optional[str] = None
textcolor: Optional[str] = None
height: Optional[str] = None
width: Optional[str] = None
value: Optional[str] = None
addvalue: bool = False
values: Optional[List[str]] = None
textalign: Optional[str] = None
required: Optional[bool] = None
placeholder: Optional[str] = None
fontbold: Optional[bool] = None
selected: Optional[bool] = None
disabled: Optional[bool] = None
totalamount: Optional[bool] = None
elements: Optional[List[Element]] = None
map: Optional[List[LicenseMap]] = None
Python C2BGetInstrumentDetailRequest 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/C2BGetInstrumentDetail HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<C2BGetInstrumentDetailRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<OAuthToken>String</OAuthToken>
<AppId>String</AppId>
<DeviceId>String</DeviceId>
<Token>String</Token>
<DeliveryId>0</DeliveryId>
<IncludeMobileLayout>String</IncludeMobileLayout>
<InstrumentId>0</InstrumentId>
<LocationId>0</LocationId>
<RateId>0</RateId>
<RsiPk>0</RsiPk>
<TeacherId>0</TeacherId>
</C2BGetInstrumentDetailRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <C2BGetInstrumentDetailResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService"> <Status> <DomainName>String</DomainName> <ErrorCode>String</ErrorCode> <ErrorDisplayText>String</ErrorDisplayText> <ErrorMessage>String</ErrorMessage> <IpAddress>String</IpAddress> <Login>String</Login> <StatusCode>String</StatusCode> </Status> <InstrumentDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/AIM" i:nil="true" /> <MobileLayout xmlns:d2p1="http://schemas.datacontract.org/2004/07/AIM.BL.Core.ExternalAPIs.MobileRentals"> <d2p1:returnurl>String</d2p1:returnurl> <d2p1:sections> <d2p1:MobileLayout.Section> <d2p1:elements> <d2p1:MobileLayout.Element> <d2p1:addvalue>false</d2p1:addvalue> <d2p1:backgroundcolor>String</d2p1:backgroundcolor> <d2p1:disabled>false</d2p1:disabled> <d2p1:elements i:nil="true" /> <d2p1:fontbold>false</d2p1:fontbold> <d2p1:fontsize>String</d2p1:fontsize> <d2p1:height>String</d2p1:height> <d2p1:id>String</d2p1:id> <d2p1:label>String</d2p1:label> <d2p1:map i:nil="true" /> <d2p1:margin>String</d2p1:margin> <d2p1:placeholder>String</d2p1:placeholder> <d2p1:required>false</d2p1:required> <d2p1:selected>false</d2p1:selected> <d2p1:textalign>String</d2p1:textalign> <d2p1:textcolor>String</d2p1:textcolor> <d2p1:totalamount>false</d2p1:totalamount> <d2p1:type>String</d2p1:type> <d2p1:value>String</d2p1:value> <d2p1:values xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d7p1:string>String</d7p1:string> </d2p1:values> <d2p1:width>String</d2p1:width> </d2p1:MobileLayout.Element> </d2p1:elements> <d2p1:header>String</d2p1:header> <d2p1:id>String</d2p1:id> <d2p1:margin>String</d2p1:margin> </d2p1:MobileLayout.Section> </d2p1:sections> <d2p1:title>String</d2p1:title> </MobileLayout> </C2BGetInstrumentDetailResponse>