Booster.Microservices

<back to all web services

ListWarrantyCardsPagedRequest

Requires Authentication
The following routes are available for this service:
GET/warranty/v1/cards/paged
import Foundation
import ServiceStack

public class ListWarrantyCardsPagedRequest : BaseRequest<ListWarrantyCardsPagedResponse>, IPagedRequest
{
    public var referenceId:String
    public var serial:String
    public var brand:String
    public var siteId:Int
    public var page:Int
    public var items:Int
    public var noCount:Bool
    public var sortBy:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case referenceId
        case serial
        case brand
        case siteId
        case page
        case items
        case noCount
        case sortBy
    }

    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)
        serial = try container.decodeIfPresent(String.self, forKey: .serial)
        brand = try container.decodeIfPresent(String.self, forKey: .brand)
        siteId = try container.decodeIfPresent(Int.self, forKey: .siteId)
        page = try container.decodeIfPresent(Int.self, forKey: .page)
        items = try container.decodeIfPresent(Int.self, forKey: .items)
        noCount = try container.decodeIfPresent(Bool.self, forKey: .noCount)
        sortBy = try container.decodeIfPresent(String.self, forKey: .sortBy)
    }

    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 serial != nil { try container.encode(serial, forKey: .serial) }
        if brand != nil { try container.encode(brand, forKey: .brand) }
        if siteId != nil { try container.encode(siteId, forKey: .siteId) }
        if page != nil { try container.encode(page, forKey: .page) }
        if items != nil { try container.encode(items, forKey: .items) }
        if noCount != nil { try container.encode(noCount, forKey: .noCount) }
        if sortBy != nil { try container.encode(sortBy, forKey: .sortBy) }
    }
}

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 ListWarrantyCardsPagedResponse : BaseResponse
{
    public var page:Int
    public var items:Int
    public var totalPages:Int
    public var totalResults:Int
    public var elements:[Warranty] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case page
        case items
        case totalPages
        case totalResults
        case elements
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        page = try container.decodeIfPresent(Int.self, forKey: .page)
        items = try container.decodeIfPresent(Int.self, forKey: .items)
        totalPages = try container.decodeIfPresent(Int.self, forKey: .totalPages)
        totalResults = try container.decodeIfPresent(Int.self, forKey: .totalResults)
        elements = try container.decodeIfPresent([Warranty].self, forKey: .elements) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if page != nil { try container.encode(page, forKey: .page) }
        if items != nil { try container.encode(items, forKey: .items) }
        if totalPages != nil { try container.encode(totalPages, forKey: .totalPages) }
        if totalResults != nil { try container.encode(totalResults, forKey: .totalResults) }
        if elements.count > 0 { try container.encode(elements, forKey: .elements) }
    }
}

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(){}
}

public class Warranty : Codable
{
    public var article:[Article] = []
    public var warrantyId:String
    public var createdBy:String
    public var createdAt:String
    public var issuedBy:String
    public var selloutId:String
    public var activationDate:String
    public var pin:String
    public var promoterTypeId:String
    public var promoterTypeDs:String
    public var site:Site
    public var crmEnabled:Bool
    public var canBeExtended:Bool
    public var canBeRetriggered:Bool

    required public init(){}
}

public class Article : Codable
{
    public var ref:String
    public var serial:String
    public var name:String
    public var site:LookupInt
    public var brand:String
    public var isConsignment:Bool

    required public init(){}
}

public class LookupInt : ILookupInt, Codable
{
    public var object:String
    public var id:Int

    required public init(){}
}

public class Site : Codable
{
    public var object:String
    public var id:String
    public var name:String
    public var address:Address
    public var crmPrivacyPolicyMandatory:Bool
    public var crmAllowStoreDataAbroadVisible:Bool
    public var isTimeVallee:Bool
    public var crmPrivacyPolicyTimeValleeMandatory:Bool
    public var crmAllowStoreDataAbroadTimeValleeVisible:Bool
    public var allowToCreateEndCustomerOutsideChina:Bool
    public var displayFirstLastNameNotLatin:Bool
    public var languageTransliteration:String
    public var doNotDisplayPOSDataInDisclaimers:Bool
    public var crmFirstNameMandatory:Bool
    public var crmCityMandatory:Bool
    public var manageOwnStock:Bool

    required public init(){}
}

public class Address : Codable
{
    public var line1:String
    public var line2:String
    public var city:String
    public var zipCode:String
    public var countryCode:String

    required public init(){}
}


Swift ListWarrantyCardsPagedRequest DTOs

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

HTTP + OTHER

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

GET /warranty/v1/cards/paged HTTP/1.1 
Host: qp-microservices-booster.richemont.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"page":0,"items":0,"totalPages":0,"totalResults":0,"_xmlns":"String","_type":"String","_source":"String","_tstamp":"String","_user":"String","_env":"String","_uri":"String","_query":"String"}