| POST | /api/invoice/search/sender | Search invoice based on search parameters |
|---|
import Foundation
import ServiceStack
/**
* Invoice
*/
// @Api(Description="Invoice")
// @ApiResponse(Description="Paged Purchase data", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
public class SearchSenderInvoice : Codable
{
/**
* Search query
*/
// @ApiMember(Description="Search query", ParameterType="model")
public var query:SearchInvoiceByDateFilter
required public init(){}
}
public class SearchInvoiceByDateFilter : ISearchInvoiceByDateFilter, Codable
{
public var fromDate:Date
public var toDate:Date
public var continuationToken:String
public var requestedPage:Int
public var numberOfRecordsPerPage:Int
public var orderBy:String
public var order:ORDER
required public init(){}
}
public enum ORDER : String, Codable
{
case ASC
case DESC
}
public class PagedQueryResponseWithToken<T : Codable> : PagedQueryResult<ResultItem<InvoiceMessage>>
{
public var continuationToken:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case continuationToken
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
continuationToken = try container.decodeIfPresent(String.self, forKey: .continuationToken)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if continuationToken != nil { try container.encode(continuationToken, forKey: .continuationToken) }
}
}
public class PagedQueryResult<T : Codable> : Codable
{
public var startIndex:Int
public var endIndex:Int
public var numberOfRecordsReturned:Int
public var totalNumberOfPages:Int
public var totalNumberOfRecords:Int
public var results:[ResultItem<ClaimMessage>] = []
required public init(){}
}
Swift SearchSenderInvoice 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/invoice/search/sender HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"query":{"continuationToken":"String","requestedPage":0,"numberOfRecordsPerPage":0,"orderBy":"String","order":"ASC"}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"continuationToken":"String","startIndex":0,"endIndex":0,"numberOfRecordsReturned":0,"totalNumberOfPages":0,"totalNumberOfRecords":0,"results":[{}]}