POST, GET | /api/C2BGetInstrumentInfo |
---|
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 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 C2BGetInstrumentInfoResponse(BaseResponse):
instruments: Optional[List[C2BInstrumentGeneric]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class C2BGetInstrumentInfoRequest(BaseSecureRequest):
"""
C2BGetInstrumentInfoRequires active-e Contracts Service.
"""
# @ApiMember(DataType="integer", Description="ID of the Teacher/Instrument record.", Format="int64", Name="RsiPk", ParameterType="query")
rsi_pk: Optional[int] = None
"""
ID of the Teacher/Instrument record.
"""
# @ApiMember(DataType="integer", Description="ID of the Teacher record.", Format="int64", Name="TeacherId", ParameterType="query")
teacher_id: Optional[int] = None
"""
ID of the Teacher record.
"""
# @ApiMember(DataType="string", Description="Optional Plan Code Override. If not sent, plancode from the school will be used.", Name="PlanCode", ParameterType="query")
plan_code: Optional[str] = None
"""
Optional Plan Code Override. If not sent, plancode from the school will be used.
"""
# @ApiMember(DataType="boolean", Description="If set to false, less details will be sent. Defaults to True.", Name="GetDetails", ParameterType="query")
get_details: Optional[bool] = None
"""
If set to false, less details will be sent. Defaults to True.
"""
# @ApiMember(DataType="boolean", Description="If set to true, Out of Stock items will be included.", Name="IncludeOutOfStockItems", ParameterType="query")
include_out_of_stock_items: Optional[bool] = None
"""
If set to true, Out of Stock items will be included.
"""
# @ApiMember(DataType="boolean", Description="If set to true, each instrument will include a list of accessory options. Defaults to False.", Name="IncludeAccessoryOptions", ParameterType="query")
include_accessory_options: Optional[bool] = None
"""
If set to true, each instrument will include a list of accessory options. Defaults to False.
"""
# @ApiMember(DataType="boolean", Description="If set to true, each instrument will include a list of delivery options. Defaults to False.", Name="IncludeDeliveryOptions", ParameterType="query")
include_delivery_options: Optional[bool] = None
"""
If set to true, each instrument will include a list of delivery options. Defaults to False.
"""
# @ApiMember(DataType="boolean", Description="If set to true, each instrument will include a list of maintenance options. Defaults to False.", Name="IncludeMaintenanceOptions", ParameterType="query")
include_maintenance_options: Optional[bool] = None
"""
If set to true, each instrument will include a list of maintenance options. Defaults to False.
"""
Python C2BGetInstrumentInfoRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/C2BGetInstrumentInfo HTTP/1.1
Host: active-ewebservice.biz
Accept: application/json
Content-Type: application/json
Content-Length: length
{"RsiPk":0,"TeacherId":0,"PlanCode":"String","GetDetails":false,"IncludeOutOfStockItems":false,"IncludeAccessoryOptions":false,"IncludeDeliveryOptions":false,"IncludeMaintenanceOptions":false,"Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Instruments":[{}],"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}