| POST | /warranty/v1/GetCustomerSuggestion |
|---|
import Foundation
import ServiceStack
public class GetCustomerSuggestion : BaseRequest<GetCustomerSuggestionResponse>
{
public var emailAddress:String
public var posId:Int
public var brandTrigram:String
public var phoneNumber:String
public var prefixCountryId:String
public var countryId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case emailAddress
case posId
case brandTrigram
case phoneNumber
case prefixCountryId
case countryId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
emailAddress = try container.decodeIfPresent(String.self, forKey: .emailAddress)
posId = try container.decodeIfPresent(Int.self, forKey: .posId)
brandTrigram = try container.decodeIfPresent(String.self, forKey: .brandTrigram)
phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber)
prefixCountryId = try container.decodeIfPresent(String.self, forKey: .prefixCountryId)
countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if emailAddress != nil { try container.encode(emailAddress, forKey: .emailAddress) }
if posId != nil { try container.encode(posId, forKey: .posId) }
if brandTrigram != nil { try container.encode(brandTrigram, forKey: .brandTrigram) }
if phoneNumber != nil { try container.encode(phoneNumber, forKey: .phoneNumber) }
if prefixCountryId != nil { try container.encode(prefixCountryId, forKey: .prefixCountryId) }
if countryId != nil { try container.encode(countryId, forKey: .countryId) }
}
}
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 GetCustomerSuggestionResponse : BaseResponse
{
public var customerType:String
public var customerRef:String
public var title:Int?
public var titleDs:String
public var firstName:String
public var lastName:String
public var firstNameNotLatin:String
public var lastNameNotLatin:String
public var birthday:String
public var birthDayEventId:String?
public var weddingDate:String
public var canBeContacted:Bool?
public var seller:String?
public var language:String
public var languageDs:String
public var nameSuffix:String
public var gender:String
public var companyName:String
public var middleName:String
public var customerId:String?
public var personId:String?
public var boosterCustomerId:Int?
public var posOwnerId:Int?
public var brandOwnerId:String
public var businessUnitId:Int?
public var sapGenderId:String
public var allowStoreDataAbroad:Bool?
public var privacyPolicyAcceptanceStorage:Bool?
public var tvAllowStoreDataAbroad:Bool?
public var tvPrivacyPolicyAcceptanceStorage:Bool?
public var contactByMail:Bool?
public var contactByEmail:Bool?
public var contactByPhone:Bool?
public var contactBySMS:Bool?
public var contactBySocialMedia:Bool?
public var addresses:[CustomerAddress] = []
public var emails:[CustomerEmail] = []
public var phones:[CustomerPhone] = []
public var responseStatus:ResponseStatus
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case customerType
case customerRef
case title
case titleDs
case firstName
case lastName
case firstNameNotLatin
case lastNameNotLatin
case birthday
case birthDayEventId
case weddingDate
case canBeContacted
case seller
case language
case languageDs
case nameSuffix
case gender
case companyName
case middleName
case customerId
case personId
case boosterCustomerId
case posOwnerId
case brandOwnerId
case businessUnitId
case sapGenderId
case allowStoreDataAbroad
case privacyPolicyAcceptanceStorage
case tvAllowStoreDataAbroad
case tvPrivacyPolicyAcceptanceStorage
case contactByMail
case contactByEmail
case contactByPhone
case contactBySMS
case contactBySocialMedia
case addresses
case emails
case phones
case responseStatus
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
customerType = try container.decodeIfPresent(String.self, forKey: .customerType)
customerRef = try container.decodeIfPresent(String.self, forKey: .customerRef)
title = try container.decodeIfPresent(Int.self, forKey: .title)
titleDs = try container.decodeIfPresent(String.self, forKey: .titleDs)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
firstNameNotLatin = try container.decodeIfPresent(String.self, forKey: .firstNameNotLatin)
lastNameNotLatin = try container.decodeIfPresent(String.self, forKey: .lastNameNotLatin)
birthday = try container.decodeIfPresent(String.self, forKey: .birthday)
birthDayEventId = try container.decodeIfPresent(String.self, forKey: .birthDayEventId)
weddingDate = try container.decodeIfPresent(String.self, forKey: .weddingDate)
canBeContacted = try container.decodeIfPresent(Bool.self, forKey: .canBeContacted)
seller = try container.decodeIfPresent(String.self, forKey: .seller)
language = try container.decodeIfPresent(String.self, forKey: .language)
languageDs = try container.decodeIfPresent(String.self, forKey: .languageDs)
nameSuffix = try container.decodeIfPresent(String.self, forKey: .nameSuffix)
gender = try container.decodeIfPresent(String.self, forKey: .gender)
companyName = try container.decodeIfPresent(String.self, forKey: .companyName)
middleName = try container.decodeIfPresent(String.self, forKey: .middleName)
customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
personId = try container.decodeIfPresent(String.self, forKey: .personId)
boosterCustomerId = try container.decodeIfPresent(Int.self, forKey: .boosterCustomerId)
posOwnerId = try container.decodeIfPresent(Int.self, forKey: .posOwnerId)
brandOwnerId = try container.decodeIfPresent(String.self, forKey: .brandOwnerId)
businessUnitId = try container.decodeIfPresent(Int.self, forKey: .businessUnitId)
sapGenderId = try container.decodeIfPresent(String.self, forKey: .sapGenderId)
allowStoreDataAbroad = try container.decodeIfPresent(Bool.self, forKey: .allowStoreDataAbroad)
privacyPolicyAcceptanceStorage = try container.decodeIfPresent(Bool.self, forKey: .privacyPolicyAcceptanceStorage)
tvAllowStoreDataAbroad = try container.decodeIfPresent(Bool.self, forKey: .tvAllowStoreDataAbroad)
tvPrivacyPolicyAcceptanceStorage = try container.decodeIfPresent(Bool.self, forKey: .tvPrivacyPolicyAcceptanceStorage)
contactByMail = try container.decodeIfPresent(Bool.self, forKey: .contactByMail)
contactByEmail = try container.decodeIfPresent(Bool.self, forKey: .contactByEmail)
contactByPhone = try container.decodeIfPresent(Bool.self, forKey: .contactByPhone)
contactBySMS = try container.decodeIfPresent(Bool.self, forKey: .contactBySMS)
contactBySocialMedia = try container.decodeIfPresent(Bool.self, forKey: .contactBySocialMedia)
addresses = try container.decodeIfPresent([CustomerAddress].self, forKey: .addresses) ?? []
emails = try container.decodeIfPresent([CustomerEmail].self, forKey: .emails) ?? []
phones = try container.decodeIfPresent([CustomerPhone].self, forKey: .phones) ?? []
responseStatus = try container.decodeIfPresent(ResponseStatus.self, forKey: .responseStatus)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if customerType != nil { try container.encode(customerType, forKey: .customerType) }
if customerRef != nil { try container.encode(customerRef, forKey: .customerRef) }
if title != nil { try container.encode(title, forKey: .title) }
if titleDs != nil { try container.encode(titleDs, forKey: .titleDs) }
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if firstNameNotLatin != nil { try container.encode(firstNameNotLatin, forKey: .firstNameNotLatin) }
if lastNameNotLatin != nil { try container.encode(lastNameNotLatin, forKey: .lastNameNotLatin) }
if birthday != nil { try container.encode(birthday, forKey: .birthday) }
if birthDayEventId != nil { try container.encode(birthDayEventId, forKey: .birthDayEventId) }
if weddingDate != nil { try container.encode(weddingDate, forKey: .weddingDate) }
if canBeContacted != nil { try container.encode(canBeContacted, forKey: .canBeContacted) }
if seller != nil { try container.encode(seller, forKey: .seller) }
if language != nil { try container.encode(language, forKey: .language) }
if languageDs != nil { try container.encode(languageDs, forKey: .languageDs) }
if nameSuffix != nil { try container.encode(nameSuffix, forKey: .nameSuffix) }
if gender != nil { try container.encode(gender, forKey: .gender) }
if companyName != nil { try container.encode(companyName, forKey: .companyName) }
if middleName != nil { try container.encode(middleName, forKey: .middleName) }
if customerId != nil { try container.encode(customerId, forKey: .customerId) }
if personId != nil { try container.encode(personId, forKey: .personId) }
if boosterCustomerId != nil { try container.encode(boosterCustomerId, forKey: .boosterCustomerId) }
if posOwnerId != nil { try container.encode(posOwnerId, forKey: .posOwnerId) }
if brandOwnerId != nil { try container.encode(brandOwnerId, forKey: .brandOwnerId) }
if businessUnitId != nil { try container.encode(businessUnitId, forKey: .businessUnitId) }
if sapGenderId != nil { try container.encode(sapGenderId, forKey: .sapGenderId) }
if allowStoreDataAbroad != nil { try container.encode(allowStoreDataAbroad, forKey: .allowStoreDataAbroad) }
if privacyPolicyAcceptanceStorage != nil { try container.encode(privacyPolicyAcceptanceStorage, forKey: .privacyPolicyAcceptanceStorage) }
if tvAllowStoreDataAbroad != nil { try container.encode(tvAllowStoreDataAbroad, forKey: .tvAllowStoreDataAbroad) }
if tvPrivacyPolicyAcceptanceStorage != nil { try container.encode(tvPrivacyPolicyAcceptanceStorage, forKey: .tvPrivacyPolicyAcceptanceStorage) }
if contactByMail != nil { try container.encode(contactByMail, forKey: .contactByMail) }
if contactByEmail != nil { try container.encode(contactByEmail, forKey: .contactByEmail) }
if contactByPhone != nil { try container.encode(contactByPhone, forKey: .contactByPhone) }
if contactBySMS != nil { try container.encode(contactBySMS, forKey: .contactBySMS) }
if contactBySocialMedia != nil { try container.encode(contactBySocialMedia, forKey: .contactBySocialMedia) }
if addresses.count > 0 { try container.encode(addresses, forKey: .addresses) }
if emails.count > 0 { try container.encode(emails, forKey: .emails) }
if phones.count > 0 { try container.encode(phones, forKey: .phones) }
if responseStatus != nil { try container.encode(responseStatus, forKey: .responseStatus) }
}
}
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 CustomerAddress : Codable
{
public var addressId:String
public var Description:String
public var addressLine1:String
public var addressLine2:String
public var addressLine3:String
public var addressLine4:String
public var addressLine5:String
public var houseNumber:String
public var city:String
public var region:String
public var county:String
public var stateOrProvinceId:String
public var countryId:String
public var countryDs:String
public var zipCode:String
public var addressTypeId:String
public var isMailingAddress:Bool
public var isMainAddress:Bool
required public init(){}
}
public class CustomerEmail : Codable
{
public var emailId:String
public var Description:String
public var email:String
public var isMainEmail:Bool
public var type:Lookup<String>
required public init(){}
}
public class Lookup<T : Codable> : Codable
{
public var id:T
public var Description:String
required public init(){}
}
public class CustomerPhone : Codable
{
public var phoneId:String
public var Description:String
public var phone:String
public var isMainPhone:Bool
public var prefixCountryId:String
public var telephonePrefix:String
public var type:Lookup<Int>
required public init(){}
}
Swift GetCustomerSuggestion 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/GetCustomerSuggestion HTTP/1.1
Host: qp-microservices-booster.richemont.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"emailAddress":"String","posId":0,"brandTrigram":"String","phoneNumber":"String","prefixCountryId":"String","countryId":"String","sid":"String","app":"String","_os":"String","_appVersion":"String","_searchMethod":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"customerType":"String","customerRef":"String","title":0,"titleDs":"String","firstName":"String","lastName":"String","firstNameNotLatin":"String","lastNameNotLatin":"String","birthday":"String","birthDayEventId":"00000000000000000000000000000000","weddingDate":"String","canBeContacted":false,"seller":"00000000000000000000000000000000","language":"String","languageDs":"String","nameSuffix":"String","gender":"String","companyName":"String","middleName":"String","customerId":"00000000000000000000000000000000","personId":"00000000000000000000000000000000","boosterCustomerId":0,"posOwnerId":0,"brandOwnerId":"String","businessUnitId":0,"sapGenderId":"String","allowStoreDataAbroad":false,"privacyPolicyAcceptanceStorage":false,"tvAllowStoreDataAbroad":false,"tvPrivacyPolicyAcceptanceStorage":false,"contactByMail":false,"contactByEmail":false,"contactByPhone":false,"contactBySMS":false,"contactBySocialMedia":false,"addresses":[{"addressId":"00000000000000000000000000000000","description":"String","addressLine1":"String","addressLine2":"String","addressLine3":"String","addressLine4":"String","addressLine5":"String","houseNumber":"String","city":"String","region":"String","county":"String","stateOrProvinceId":"String","countryId":"String","countryDs":"String","zipCode":"String","addressTypeId":"String","isMailingAddress":false,"isMainAddress":false}],"emails":[{"emailId":"00000000000000000000000000000000","description":"String","email":"String","isMainEmail":false,"type":{"Id":"\u0000","Description":"String"}}],"phones":[{"phoneId":"00000000000000000000000000000000","description":"String","phone":"String","isMainPhone":false,"prefixCountryId":"String","telephonePrefix":"String","type":{"Id":0,"Description":"String"}}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"_xmlns":"String","_type":"String","_source":"String","_tstamp":"String","_user":"String","_env":"String","_uri":"String","_query":"String"}