GET | /api/InvoiceDetail |
---|
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 InvoiceLineItem:
quantity: Decimal = decimal.Decimal(0)
sku: Optional[str] = None
description: Optional[str] = None
price_each: Decimal = decimal.Decimal(0)
extended: Decimal = decimal.Decimal(0)
discount: Decimal = decimal.Decimal(0)
total: Decimal = decimal.Decimal(0)
original_ref: Optional[str] = None
notes: Optional[str] = None
source: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoicePaymentItem:
pay_ref: Optional[str] = None
date_time: datetime.datetime = datetime.datetime(1, 1, 1)
amount: Decimal = decimal.Decimal(0)
notes: Optional[str] = None
source: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceInfo:
invoice_number: Optional[str] = None
date_time: datetime.datetime = datetime.datetime(1, 1, 1)
sold_to_acct: int = 0
sold_to_name: Optional[str] = None
bill_to_acct: int = 0
bill_to_name: Optional[str] = None
type: Optional[str] = None
po: Optional[str] = None
original_amount: Decimal = decimal.Decimal(0)
balance: Decimal = decimal.Decimal(0)
location: Optional[str] = None
ship_to_name: Optional[str] = None
ship_to_address: Optional[str] = None
ship_to_id: Optional[int] = None
line_items: Optional[List[InvoiceLineItem]] = None
payments: Optional[List[InvoicePaymentItem]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceDetailResponse(BaseResponse):
invoices: Optional[List[InvoiceInfo]] = None
remaining_records: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceDetailRequest(BaseSecureRequest):
"""
InvoiceDetailRequires active-e Customer Service.
"""
acct: Optional[int] = None
invoice_start_date: Optional[datetime.datetime] = None
invoice_end_date: Optional[datetime.datetime] = None
# @ApiMember(DataType="integer", Description="The Starting Offset. Defaults to 0 if not sent.", Format="int64", Name="StartOffset")
start_offset: Optional[int] = None
"""
The Starting Offset. Defaults to 0 if not sent.
"""
# @ApiMember(DataType="integer", Description="The # of records to be returned. Defaults to 100 if not sent.", Format="int64", Name="RecordCount")
record_count: Optional[int] = None
"""
The # of records to be returned. Defaults to 100 if not sent.
"""
# @ApiMember(DataType="string", Description="The Invoice Ref# to be looked up. If sent, do not send WebRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount", Name="AIMRef")
aim_ref: Optional[str] = None
"""
The Invoice Ref# to be looked up. If sent, do not send WebRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount
"""
# @ApiMember(DataType="string", Description="The WebRef to be looked up. If sent, do not send AIMRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount", Name="WebRef")
web_ref: Optional[str] = None
"""
The WebRef to be looked up. If sent, do not send AIMRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount
"""
Python InvoiceDetailRequest 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.
GET /api/InvoiceDetail HTTP/1.1 Host: active-ewebservice.biz Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Invoices":[{"InvoiceNumber":"String","SoldToAcct":0,"SoldToName":"String","BillToAcct":0,"BillToName":"String","Type":"String","PO":"String","OriginalAmount":0,"Balance":0,"Location":"String","ShipToName":"String","ShipToAddress":"String","ShipToId":0,"LineItems":[{"Quantity":0,"Sku":"String","Description":"String","PriceEach":0,"Extended":0,"Discount":0,"Total":0,"OriginalRef":"String","Notes":"String","Source":"String"}],"Payments":[{"PayRef":"String","Amount":0,"Notes":"String","Source":"String"}]}],"RemainingRecords":0,"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}