POST | /api/UpdateCustomer |
---|
import Foundation
import ServiceStack
/**
* UpdateCustomerRequires active-e Customer Service.
*/
// @DataContract
public class UpdateCustomerRequest : BaseSecureRequest
{
/**
* Customer Acct #
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Customer Acct #", Format="int32", IsRequired=true, Name="Acct", ParameterType="query")
public var acct:Int
/**
* Location ID
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Location ID", Format="int64", Name="LocationId", ParameterType="query")
public var locationId:Int?
/**
* Customer Default Id
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Customer Default Id", Format="int64", Name="CustomerDefaultId", ParameterType="query")
public var customerDefaultId:Int?
/**
* Tax Authority Id
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Tax Authority Id", Format="int64", Name="TaxAuthorityId", ParameterType="query")
public var taxAuthorityId:Int?
// @DataMember
public var name:String
// @DataMember
public var attn:String
// @DataMember
public var address1:String
// @DataMember
public var address2:String
// @DataMember
public var city:String
// @DataMember
public var state:String
// @DataMember
public var zip:String
// @DataMember
public var country:String
// @DataMember
public var homePhone:String
// @DataMember
public var workPhone:String
// @DataMember
public var cellPhone:String
// @DataMember
public var employer:String
// @DataMember
public var ss:String
// @DataMember
public var email:String
/**
* Email Method. Set this to Word, PDF, HTML, or None
*/
// @DataMember
// @ApiMember(DataType="string", Description="Email Method. Set this to Word, PDF, HTML, or None", Name="EmailMethod", ParameterType="query")
public var emailMethod:String
// @DataMember
public var notes:String
// @DataMember
public var driversLicenseInfo:LicenseInfo
/**
* If TRUE, all applicable settings from the customer default will be copied over to the customer. Generally only used when changing the customer default.
*/
// @DataMember
// @ApiMember(DataType="bool", Description="If TRUE, all applicable settings from the customer default will be copied over to the customer. Generally only used when changing the customer default.", Name="RefreshCustomerDefaults", ParameterType="query")
public var refreshCustomerDefaults:Bool
/**
*
*/
// @DataMember
// @ApiMember(DataType="array", Description="", Name="FormInputList", ParameterType="query")
public var formInputList:[FormInput] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case acct
case locationId
case customerDefaultId
case taxAuthorityId
case name
case attn
case address1
case address2
case city
case state
case zip
case country
case homePhone
case workPhone
case cellPhone
case employer
case ss
case email
case emailMethod
case notes
case driversLicenseInfo
case refreshCustomerDefaults
case formInputList
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
acct = try container.decodeIfPresent(Int.self, forKey: .acct)
locationId = try container.decodeIfPresent(Int.self, forKey: .locationId)
customerDefaultId = try container.decodeIfPresent(Int.self, forKey: .customerDefaultId)
taxAuthorityId = try container.decodeIfPresent(Int.self, forKey: .taxAuthorityId)
name = try container.decodeIfPresent(String.self, forKey: .name)
attn = try container.decodeIfPresent(String.self, forKey: .attn)
address1 = try container.decodeIfPresent(String.self, forKey: .address1)
address2 = try container.decodeIfPresent(String.self, forKey: .address2)
city = try container.decodeIfPresent(String.self, forKey: .city)
state = try container.decodeIfPresent(String.self, forKey: .state)
zip = try container.decodeIfPresent(String.self, forKey: .zip)
country = try container.decodeIfPresent(String.self, forKey: .country)
homePhone = try container.decodeIfPresent(String.self, forKey: .homePhone)
workPhone = try container.decodeIfPresent(String.self, forKey: .workPhone)
cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
employer = try container.decodeIfPresent(String.self, forKey: .employer)
ss = try container.decodeIfPresent(String.self, forKey: .ss)
email = try container.decodeIfPresent(String.self, forKey: .email)
emailMethod = try container.decodeIfPresent(String.self, forKey: .emailMethod)
notes = try container.decodeIfPresent(String.self, forKey: .notes)
driversLicenseInfo = try container.decodeIfPresent(LicenseInfo.self, forKey: .driversLicenseInfo)
refreshCustomerDefaults = try container.decodeIfPresent(Bool.self, forKey: .refreshCustomerDefaults)
formInputList = try container.decodeIfPresent([FormInput].self, forKey: .formInputList) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if acct != nil { try container.encode(acct, forKey: .acct) }
if locationId != nil { try container.encode(locationId, forKey: .locationId) }
if customerDefaultId != nil { try container.encode(customerDefaultId, forKey: .customerDefaultId) }
if taxAuthorityId != nil { try container.encode(taxAuthorityId, forKey: .taxAuthorityId) }
if name != nil { try container.encode(name, forKey: .name) }
if attn != nil { try container.encode(attn, forKey: .attn) }
if address1 != nil { try container.encode(address1, forKey: .address1) }
if address2 != nil { try container.encode(address2, forKey: .address2) }
if city != nil { try container.encode(city, forKey: .city) }
if state != nil { try container.encode(state, forKey: .state) }
if zip != nil { try container.encode(zip, forKey: .zip) }
if country != nil { try container.encode(country, forKey: .country) }
if homePhone != nil { try container.encode(homePhone, forKey: .homePhone) }
if workPhone != nil { try container.encode(workPhone, forKey: .workPhone) }
if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
if employer != nil { try container.encode(employer, forKey: .employer) }
if ss != nil { try container.encode(ss, forKey: .ss) }
if email != nil { try container.encode(email, forKey: .email) }
if emailMethod != nil { try container.encode(emailMethod, forKey: .emailMethod) }
if notes != nil { try container.encode(notes, forKey: .notes) }
if driversLicenseInfo != nil { try container.encode(driversLicenseInfo, forKey: .driversLicenseInfo) }
if refreshCustomerDefaults != nil { try container.encode(refreshCustomerDefaults, forKey: .refreshCustomerDefaults) }
if formInputList.count > 0 { try container.encode(formInputList, forKey: .formInputList) }
}
}
// @DataContract
public class BaseSecureRequest : BaseRequest
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
public var token:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
public var deviceId:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
public var appId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case token
case deviceId
case appId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
token = try container.decodeIfPresent(String.self, forKey: .token)
deviceId = try container.decodeIfPresent(String.self, forKey: .deviceId)
appId = try container.decodeIfPresent(String.self, forKey: .appId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if token != nil { try container.encode(token, forKey: .token) }
if deviceId != nil { try container.encode(deviceId, forKey: .deviceId) }
if appId != nil { try container.encode(appId, forKey: .appId) }
}
}
// @DataContract
public class BaseRequest : Codable
{
/**
* This is your AIM API Key provided by Tri-Tech
*/
// @DataMember
// @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
public var apiKey:String
// @DataMember
// @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
public var oAuthToken:String
required public init(){}
}
// @DataContract
public class LicenseInfo : Codable
{
// @DataMember
public var number:String
// @DataMember
public var height:String
// @DataMember
public var weight:String
// @DataMember
public var hair:String
// @DataMember
public var eyes:String
// @DataMember
public var expiration:String
// @DataMember
public var birthday:String
// @DataMember
public var ethnicity:String
// @DataMember
public var gender:String
// @DataMember
public var state:String
required public init(){}
}
// @DataContract(Name="FormInput")
public class FormInput : Codable
{
/**
* Field Name of the Input Field
*/
// @DataMember
// @ApiMember(DataType="string", Description="Field Name of the Input Field", IsRequired=true, Name="Key", ParameterType="query")
public var key:String
/**
* Value of the Input Field.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Value of the Input Field.", IsRequired=true, Name="Value", ParameterType="query")
public var value:String
/**
* Whether or not the field is encryped with the C2B encryption key.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Whether or not the field is encryped with the C2B encryption key.", IsRequired=true, Name="Encrypted", ParameterType="query")
public var encrypted:Bool
required public init(){}
}
// @DataContract
public class UpdateCustomerResponse : 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)
}
}
// @DataContract
public class BaseResponse : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
public var status:BaseResponseResult
required public init(){}
}
// @DataContract
public class BaseResponseResult : Codable
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
public var statusCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
public var login:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
public var errorCode:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
public var errorDisplayText:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
public var errorMessage:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
public var domainName:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
public var ipAddress:String
required public init(){}
}
Swift UpdateCustomerRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/UpdateCustomer HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateCustomerRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<OAuthToken>String</OAuthToken>
<AppId>String</AppId>
<DeviceId>String</DeviceId>
<Token>String</Token>
<Acct>0</Acct>
<Address1>String</Address1>
<Address2>String</Address2>
<Attn>String</Attn>
<CellPhone>String</CellPhone>
<City>String</City>
<Country>String</Country>
<CustomerDefaultId>0</CustomerDefaultId>
<DriversLicenseInfo>
<Birthday>String</Birthday>
<Ethnicity>String</Ethnicity>
<Expiration>String</Expiration>
<Eyes>String</Eyes>
<Gender>String</Gender>
<Hair>String</Hair>
<Height>String</Height>
<Number>String</Number>
<State>String</State>
<Weight>String</Weight>
</DriversLicenseInfo>
<Email>String</Email>
<EmailMethod>String</EmailMethod>
<Employer>String</Employer>
<FormInputList>
<FormInput>
<Encrypted>false</Encrypted>
<Key>String</Key>
<Value>String</Value>
</FormInput>
</FormInputList>
<HomePhone>String</HomePhone>
<LocationId>0</LocationId>
<Name>String</Name>
<Notes>String</Notes>
<RefreshCustomerDefaults>false</RefreshCustomerDefaults>
<SS>String</SS>
<State>String</State>
<TaxAuthorityId>0</TaxAuthorityId>
<WorkPhone>String</WorkPhone>
<Zip>String</Zip>
</UpdateCustomerRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <UpdateCustomerResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService"> <Status> <DomainName>String</DomainName> <ErrorCode>String</ErrorCode> <ErrorDisplayText>String</ErrorDisplayText> <ErrorMessage>String</ErrorMessage> <IpAddress>String</IpAddress> <Login>String</Login> <StatusCode>String</StatusCode> </Status> </UpdateCustomerResponse>