AlbaApi

<back to all web services

ContentMergeReqUpdated

The following routes are available for this service:
POST/contentmerge/changelog
import Foundation
import ServiceStack

public class ContentMergeReqUpdated : Codable
{
    public var changeLogs:[ChangeLog] = []

    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 ContentMergeReqUpdated DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /contentmerge/changelog HTTP/1.1 
Host: hcbtas-q-albamfs-api.azurewebsites.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	changeLogs: 
	[
		{
			referenceId: String,
			country: String,
			language: String,
			section: String,
			itemCode: String,
			itemId: String,
			history: 
			[
				{
					updatedBy: String,
					dateCreated: 0001-01-01,
					element: String,
					old: String,
					new: String,
					status: String,
					approvedBy: String,
					dateApproved: 0001-01-01
				}
			],
			id: String
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	referenceId: String,
	country: String,
	language: String,
	section: String,
	itemCode: String,
	itemId: String,
	history: 
	[
		{
			updatedBy: String,
			dateCreated: 0001-01-01,
			element: String,
			old: String,
			new: String,
			status: String,
			approvedBy: String,
			dateApproved: 0001-01-01
		}
	],
	id: String
}