POST | /changelogsbystatus |
---|
import Foundation
import ServiceStack
public class ChangeLogsByStatusReq : Codable
{
public var country:String?
public var language:String?
public var section:String?
public var itemCode:String?
public var status:String?
required public init(){}
}
public class ChangeLog : Entity
{
public var referenceId:String?
public var country:String?
public var language:String?
public var section:String?
public var itemCode:String?
public var itemId:String?
public var history:[ChangeHistory] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case referenceId
case country
case language
case section
case itemCode
case itemId
case history
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
referenceId = try container.decodeIfPresent(String.self, forKey: .referenceId)
country = try container.decodeIfPresent(String.self, forKey: .country)
language = try container.decodeIfPresent(String.self, forKey: .language)
section = try container.decodeIfPresent(String.self, forKey: .section)
itemCode = try container.decodeIfPresent(String.self, forKey: .itemCode)
itemId = try container.decodeIfPresent(String.self, forKey: .itemId)
history = try container.decodeIfPresent([ChangeHistory].self, forKey: .history) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if referenceId != nil { try container.encode(referenceId, forKey: .referenceId) }
if country != nil { try container.encode(country, forKey: .country) }
if language != nil { try container.encode(language, forKey: .language) }
if section != nil { try container.encode(section, forKey: .section) }
if itemCode != nil { try container.encode(itemCode, forKey: .itemCode) }
if itemId != nil { try container.encode(itemId, forKey: .itemId) }
if history.count > 0 { try container.encode(history, forKey: .history) }
}
}
public class Entity : IEntity, Codable
{
public var id:String?
required public init(){}
}
public class ChangeHistory : Codable
{
public var updatedBy:String?
public var dateCreated:Date?
public var element:String?
public var old:String?
public var `new`:String?
public var status:String?
public var approvedBy:String?
public var dateApproved:Date?
required public init(){}
}
Swift ChangeLogsByStatusReq DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /changelogsbystatus HTTP/1.1
Host: hcbtas-q-albamfs-api.azurewebsites.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ChangeLogsByStatusReq xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AlbaApi.ServiceModel">
<Country>String</Country>
<ItemCode>String</ItemCode>
<Language>String</Language>
<Section>String</Section>
<Status>String</Status>
</ChangeLogsByStatusReq>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ChangeLog xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AlbaApi.Model"> <Id xmlns="http://schemas.datacontract.org/2004/07/TasSyd.Model.Base">String</Id> <Country>String</Country> <History> <ChangeHistory> <ApprovedBy>String</ApprovedBy> <DateApproved>0001-01-01T00:00:00</DateApproved> <DateCreated>0001-01-01T00:00:00</DateCreated> <Element>String</Element> <New>String</New> <Old>String</Old> <Status>String</Status> <UpdatedBy>String</UpdatedBy> </ChangeHistory> </History> <ItemCode>String</ItemCode> <ItemId>String</ItemId> <Language>String</Language> <ReferenceId>String</ReferenceId> <Section>String</Section> </ChangeLog>