| POST | /warranty/v1/editCustomer |
|---|
import Foundation
import ServiceStack
public class EditCustomerRequest : BaseRequest<EditCustomerResponse>
{
public var customerId:String
public var personId:String
public var addressId:String
public var phoneId:String?
public var emailId:String?
public var cardId:String
public var customerRef:String
public var title:Int?
public var firstName:String
public var lastName:String
public var firstNameNotLatin:String
public var lastNameNotLatin:String
public var birthday:Date?
public var weddingDate:Date?
public var email:String
public var canBeContacted:Bool
public var language:String
public var nameSuffix:String
public var gender:String
public var middleName:String
public var countryId:String
public var phoneCountryId:String
public var prefixCountryId:String
public var phone:String
public var posId:Int
public var birthDayEventId:String?
public var salePersonId:String
public var allowStoreDataAbroad:Bool?
public var tvAllowStoreDataAbroad:Bool?
public var contactByMail:Bool
public var contactByEmail:Bool
public var contactByPhone:Bool
public var contactBySMS:Bool
public var contactBySocialMedia:Bool
public var street:String
public var houseNumber:String
public var city:String
public var postalCode:String
public var region:String
public var street2:String
public var street3:String
public var street4:String
public var street5:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case customerId
case personId
case addressId
case phoneId
case emailId
case cardId
case customerRef
case title
case firstName
case lastName
case firstNameNotLatin
case lastNameNotLatin
case birthday
case weddingDate
case email
case canBeContacted
case language
case nameSuffix
case gender
case middleName
case countryId
case phoneCountryId
case prefixCountryId
case phone
case posId
case birthDayEventId
case salePersonId
case allowStoreDataAbroad
case tvAllowStoreDataAbroad
case contactByMail
case contactByEmail
case contactByPhone
case contactBySMS
case contactBySocialMedia
case street
case houseNumber
case city
case postalCode
case region
case street2
case street3
case street4
case street5
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
customerId = try container.decodeIfPresent(String.self, forKey: .customerId)
personId = try container.decodeIfPresent(String.self, forKey: .personId)
addressId = try container.decodeIfPresent(String.self, forKey: .addressId)
phoneId = try container.decodeIfPresent(String.self, forKey: .phoneId)
emailId = try container.decodeIfPresent(String.self, forKey: .emailId)
cardId = try container.decodeIfPresent(String.self, forKey: .cardId)
customerRef = try container.decodeIfPresent(String.self, forKey: .customerRef)
title = try container.decodeIfPresent(Int.self, forKey: .title)
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(Date.self, forKey: .birthday)
weddingDate = try container.decodeIfPresent(Date.self, forKey: .weddingDate)
email = try container.decodeIfPresent(String.self, forKey: .email)
canBeContacted = try container.decodeIfPresent(Bool.self, forKey: .canBeContacted)
language = try container.decodeIfPresent(String.self, forKey: .language)
nameSuffix = try container.decodeIfPresent(String.self, forKey: .nameSuffix)
gender = try container.decodeIfPresent(String.self, forKey: .gender)
middleName = try container.decodeIfPresent(String.self, forKey: .middleName)
countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
phoneCountryId = try container.decodeIfPresent(String.self, forKey: .phoneCountryId)
prefixCountryId = try container.decodeIfPresent(String.self, forKey: .prefixCountryId)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
posId = try container.decodeIfPresent(Int.self, forKey: .posId)
birthDayEventId = try container.decodeIfPresent(String.self, forKey: .birthDayEventId)
salePersonId = try container.decodeIfPresent(String.self, forKey: .salePersonId)
allowStoreDataAbroad = try container.decodeIfPresent(Bool.self, forKey: .allowStoreDataAbroad)
tvAllowStoreDataAbroad = try container.decodeIfPresent(Bool.self, forKey: .tvAllowStoreDataAbroad)
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)
street = try container.decodeIfPresent(String.self, forKey: .street)
houseNumber = try container.decodeIfPresent(String.self, forKey: .houseNumber)
city = try container.decodeIfPresent(String.self, forKey: .city)
postalCode = try container.decodeIfPresent(String.self, forKey: .postalCode)
region = try container.decodeIfPresent(String.self, forKey: .region)
street2 = try container.decodeIfPresent(String.self, forKey: .street2)
street3 = try container.decodeIfPresent(String.self, forKey: .street3)
street4 = try container.decodeIfPresent(String.self, forKey: .street4)
street5 = try container.decodeIfPresent(String.self, forKey: .street5)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if customerId != nil { try container.encode(customerId, forKey: .customerId) }
if personId != nil { try container.encode(personId, forKey: .personId) }
if addressId != nil { try container.encode(addressId, forKey: .addressId) }
if phoneId != nil { try container.encode(phoneId, forKey: .phoneId) }
if emailId != nil { try container.encode(emailId, forKey: .emailId) }
if cardId != nil { try container.encode(cardId, forKey: .cardId) }
if customerRef != nil { try container.encode(customerRef, forKey: .customerRef) }
if title != nil { try container.encode(title, forKey: .title) }
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 weddingDate != nil { try container.encode(weddingDate, forKey: .weddingDate) }
if email != nil { try container.encode(email, forKey: .email) }
if canBeContacted != nil { try container.encode(canBeContacted, forKey: .canBeContacted) }
if language != nil { try container.encode(language, forKey: .language) }
if nameSuffix != nil { try container.encode(nameSuffix, forKey: .nameSuffix) }
if gender != nil { try container.encode(gender, forKey: .gender) }
if middleName != nil { try container.encode(middleName, forKey: .middleName) }
if countryId != nil { try container.encode(countryId, forKey: .countryId) }
if phoneCountryId != nil { try container.encode(phoneCountryId, forKey: .phoneCountryId) }
if prefixCountryId != nil { try container.encode(prefixCountryId, forKey: .prefixCountryId) }
if phone != nil { try container.encode(phone, forKey: .phone) }
if posId != nil { try container.encode(posId, forKey: .posId) }
if birthDayEventId != nil { try container.encode(birthDayEventId, forKey: .birthDayEventId) }
if salePersonId != nil { try container.encode(salePersonId, forKey: .salePersonId) }
if allowStoreDataAbroad != nil { try container.encode(allowStoreDataAbroad, forKey: .allowStoreDataAbroad) }
if tvAllowStoreDataAbroad != nil { try container.encode(tvAllowStoreDataAbroad, forKey: .tvAllowStoreDataAbroad) }
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 street != nil { try container.encode(street, forKey: .street) }
if houseNumber != nil { try container.encode(houseNumber, forKey: .houseNumber) }
if city != nil { try container.encode(city, forKey: .city) }
if postalCode != nil { try container.encode(postalCode, forKey: .postalCode) }
if region != nil { try container.encode(region, forKey: .region) }
if street2 != nil { try container.encode(street2, forKey: .street2) }
if street3 != nil { try container.encode(street3, forKey: .street3) }
if street4 != nil { try container.encode(street4, forKey: .street4) }
if street5 != nil { try container.encode(street5, forKey: .street5) }
}
}
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 EditCustomerResponse : 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 EditCustomerRequest 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/editCustomer HTTP/1.1
Host: qp-microservices-booster.richemont.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"customerId":"00000000000000000000000000000000","personId":"00000000000000000000000000000000","addressId":"00000000000000000000000000000000","phoneId":"00000000000000000000000000000000","emailId":"00000000000000000000000000000000","cardId":"String","customerRef":"String","title":0,"firstName":"String","lastName":"String","firstNameNotLatin":"String","lastNameNotLatin":"String","birthday":"\/Date(-62135596800000-0000)\/","weddingDate":"\/Date(-62135596800000-0000)\/","email":"String","canBeContacted":false,"language":"String","nameSuffix":"String","gender":"String","middleName":"String","countryId":"String","phoneCountryId":"String","prefixCountryId":"String","phone":"String","posId":0,"birthDayEventId":"00000000000000000000000000000000","salePersonId":"String","allowStoreDataAbroad":false,"tvAllowStoreDataAbroad":false,"contactByMail":false,"contactByEmail":false,"contactByPhone":false,"contactBySMS":false,"contactBySocialMedia":false,"street":"String","houseNumber":"String","city":"String","postalCode":"String","region":"String","street2":"String","street3":"String","street4":"String","street5":"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"}