Booster.Microservices

<back to all web services

CreateWarrantyCardRequest

Requires Authentication
The following routes are available for this service:
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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<CreateWarrantyCardRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Sale">
  <_appVersion xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_appVersion>
  <_os xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_os>
  <_searchMethod xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_searchMethod>
  <app xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</app>
  <sid xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</sid>
  <activationDate>0001-01-01T00:00:00</activationDate>
  <appVersion>String</appVersion>
  <deviceOS>String</deviceOS>
  <force>false</force>
  <invoiceNumber>String</invoiceNumber>
  <issuedBy>String</issuedBy>
  <nfcCardUID>String</nfcCardUID>
  <note>String</note>
  <promoterTypeId>String</promoterTypeId>
  <ref>String</ref>
  <searchMethod>String</searchMethod>
  <serial>String</serial>
  <siteId>0</siteId>
</CreateWarrantyCardRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CreateWarrantyCardResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Sale">
  <_env xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_env>
  <_query xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_query>
  <_source xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_source>
  <_tstamp xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_tstamp>
  <_type xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_type>
  <_uri xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_uri>
  <_user xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_user>
  <_xmlns xmlns="http://schemas.datacontract.org/2004/07/Booster.Microservices.ServiceModel.Common">String</_xmlns>
</CreateWarrantyCardResponse>