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 .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 /changelogsbystatus HTTP/1.1
Host: hcbtas-q-albamfs-api.azurewebsites.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"country":"String","language":"String","section":"String","itemCode":"String","status":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"referenceId":"String","country":"String","language":"String","section":"String","itemCode":"String","itemId":"String","history":[{"updatedBy":"String","dateCreated":"0001-01-01T00:00:00.0000000","element":"String","old":"String","new":"String","status":"String","approvedBy":"String","dateApproved":"0001-01-01T00:00:00.0000000"}],"id":"String"}