| POST | /api/purchaseCondition/search/sender | Search purchase condition based on search parameters |
|---|
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
Object = TypeVar('Object')
class ORDER(str, Enum):
ASC = 'ASC'
DESC = 'DESC'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchPurchaseConditionByDateFilter(ISearchPurchaseConditionByDateFilter):
from_date: datetime.datetime = datetime.datetime(1, 1, 1)
to_date: datetime.datetime = datetime.datetime(1, 1, 1)
continuation_token: Optional[str] = None
requested_page: int = 0
number_of_records_per_page: int = 0
order_by: Optional[str] = None
order: Optional[ORDER] = None
# @Api(Description="Purchase Conditions")
# @ApiResponse(Description="Paged Purchase data", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchSenderPurchaseCondition:
"""
Purchase Conditions
"""
# @ApiMember(Description="Search query", ParameterType="model")
query: Optional[SearchPurchaseConditionByDateFilter] = None
"""
Search query
"""
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagedQueryResult(Generic[T]):
start_index: int = 0
end_index: int = 0
number_of_records_returned: int = 0
total_number_of_pages: int = 0
total_number_of_records: int = 0
results: List[ResultItem[ClaimMessage]] = field(default_factory=list)
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagedQueryResponseWithToken(Generic[T], PagedQueryResult[ResultItem[InvoiceMessage]]):
continuation_token: Optional[str] = None
Python SearchSenderPurchaseCondition DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/purchaseCondition/search/sender HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"query":{"continuationToken":"String","requestedPage":0,"numberOfRecordsPerPage":0,"orderBy":"String","order":"ASC"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"continuationToken":"String","startIndex":0,"endIndex":0,"numberOfRecordsReturned":0,"totalNumberOfPages":0,"totalNumberOfRecords":0,"results":[{}]}