| POST | /warranty/v1/site/{siteId}/card |
|---|
import Foundation
import ServiceStack
public class CreateWarrantyCardRequest : BaseRequest<CreateWarrantyCardResponse>
{
public var siteId:Int
public var force:Bool?
public var ref:String
public var serial:String
public var invoiceNumber:String
public var activationDate:Date?
public var note:String
public var promoterTypeId:String
public var issuedBy:String
public var nfcCardUID:String
public var appVersion:String
public var searchMethod:String
public var deviceOS:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case siteId
case force
case ref
case serial
case invoiceNumber
case activationDate
case note
case promoterTypeId
case issuedBy
case nfcCardUID
case appVersion
case searchMethod
case deviceOS
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
siteId = try container.decodeIfPresent(Int.self, forKey: .siteId)
force = try container.decodeIfPresent(Bool.self, forKey: .force)
ref = try container.decodeIfPresent(String.self, forKey: .ref)
serial = try container.decodeIfPresent(String.self, forKey: .serial)
invoiceNumber = try container.decodeIfPresent(String.self, forKey: .invoiceNumber)
activationDate = try container.decodeIfPresent(Date.self, forKey: .activationDate)
note = try container.decodeIfPresent(String.self, forKey: .note)
promoterTypeId = try container.decodeIfPresent(String.self, forKey: .promoterTypeId)
issuedBy = try container.decodeIfPresent(String.self, forKey: .issuedBy)
nfcCardUID = try container.decodeIfPresent(String.self, forKey: .nfcCardUID)
appVersion = try container.decodeIfPresent(String.self, forKey: .appVersion)
searchMethod = try container.decodeIfPresent(String.self, forKey: .searchMethod)
deviceOS = try container.decodeIfPresent(String.self, forKey: .deviceOS)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if siteId != nil { try container.encode(siteId, forKey: .siteId) }
if force != nil { try container.encode(force, forKey: .force) }
if ref != nil { try container.encode(ref, forKey: .ref) }
if serial != nil { try container.encode(serial, forKey: .serial) }
if invoiceNumber != nil { try container.encode(invoiceNumber, forKey: .invoiceNumber) }
if activationDate != nil { try container.encode(activationDate, forKey: .activationDate) }
if note != nil { try container.encode(note, forKey: .note) }
if promoterTypeId != nil { try container.encode(promoterTypeId, forKey: .promoterTypeId) }
if issuedBy != nil { try container.encode(issuedBy, forKey: .issuedBy) }
if nfcCardUID != nil { try container.encode(nfcCardUID, forKey: .nfcCardUID) }
if appVersion != nil { try container.encode(appVersion, forKey: .appVersion) }
if searchMethod != nil { try container.encode(searchMethod, forKey: .searchMethod) }
if deviceOS != nil { try container.encode(deviceOS, forKey: .deviceOS) }
}
}
public class BaseRequest<TResponse : Codable> : IRequest, Codable
{
public var sid:String
public var app:String
public var _os:String
public var _appVersion:String
public var _searchMethod:String
required public init(){}
}
public class CreateWarrantyCardResponse : BaseResponse
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class BaseResponse : IRespose, Codable
{
public var _xmlns:String
public var _type:String
public var _source:String
public var _tstamp:String
public var _user:String
public var _env:String
public var _uri:String
public var _query:String
required public init(){}
}
Swift CreateWarrantyCardRequest 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 /warranty/v1/site/{siteId}/card HTTP/1.1
Host: qp-microservices-booster.richemont.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"siteId":0,"force":false,"ref":"String","serial":"String","invoiceNumber":"String","activationDate":"\/Date(-62135596800000-0000)\/","note":"String","promoterTypeId":"String","issuedBy":"String","nfcCardUID":"String","appVersion":"String","searchMethod":"String","deviceOS":"String","sid":"String","app":"String","_os":"String","_appVersion":"String","_searchMethod":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"_xmlns":"String","_type":"String","_source":"String","_tstamp":"String","_user":"String","_env":"String","_uri":"String","_query":"String"}