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 .other suffix or ?format=other
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: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"RsiPk":0,"TeacherId":0,"InstrumentId":0,"RateId":0,"IncludeMobileLayout":"String","DeliveryId":0,"LocationId":0,"Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"MobileLayout":{"title":"String","returnurl":"String","sections":[{"header":"String","id":"String","margin":"String","elements":[{"type":"String","label":"String","id":"String","fontsize":"String","margin":"String","backgroundcolor":"String","textcolor":"String","height":"String","width":"String","value":"String","addvalue":false,"values":["String"],"textalign":"String","required":false,"placeholder":"String","fontbold":false,"selected":false,"disabled":false,"totalamount":false}]}]},"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}