POST | /v2/{ApiKey}/club/{StoreId}/prospect | (obsolete) Create a Prospect |
---|
import Foundation
import ServiceStack
public class CreateProspectRequestV2 : CreateProspectRequestV2Dto, IRestrictedApiRequest
{
/**
* Api Key - grants access to resources
*/
// @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
public var apiKey:String
/**
* ClubReady Club ID (StoreID internally)
*/
// @ApiMember(DataType="integer", Description="ClubReady Club ID (StoreID internally)", IsRequired=true, Name="StoreId", ParameterType="query")
public var storeId:Int?
/**
* First Name
*/
// @ApiMember(DataType="string", Description="First Name", IsRequired=true, Name="FirstName", ParameterType="query")
public var firstName:String
/**
* Last Name
*/
// @ApiMember(DataType="string", Description="Last Name", IsRequired=true, Name="LastName", ParameterType="query")
public var lastName:String
/**
* Email Address
*/
// @ApiMember(DataType="string", Description="Email Address", IsRequired=true, Name="Email", ParameterType="query")
public var email:String
/**
* Gender
*/
// @ApiMember(DataType="string", Description="Gender", Name="Gender", ParameterType="query")
public var gender:String
/**
* Address
*/
// @ApiMember(DataType="string", Description="Address", Name="Address", ParameterType="query")
public var address:String
/**
* City
*/
// @ApiMember(DataType="string", Description="City", Name="City", ParameterType="query")
public var city:String
// @ApiMember(DataType="string", Name="State", ParameterType="query")
public var state:String
// @ApiMember(DataType="string", Name="Zip", ParameterType="query")
public var zip:String
public var phone:String
public var workPhone:String
public var dateOfBirth:Date?
public var cellPhone:String
/**
* Specify a Package to apply to the new prospect
*/
// @ApiMember(DataType="integer", Description="Specify a Package to apply to the new prospect", Name="AddPackageId", ParameterType="query")
public var addPackageId:Int?
/**
* Specify a specific Prospect Type for the new prospect
*/
// @ApiMember(DataType="integer", Description="Specify a specific Prospect Type for the new prospect", Name="ProspectTypeId", ParameterType="query")
public var prospectTypeId:Int?
/**
* Specify a specific Referral Type for the new prospect
*/
// @ApiMember(DataType="integer", Description="Specify a specific Referral Type for the new prospect", Name="ReferralTypeId", ParameterType="query")
public var referralTypeId:Int?
/**
* Send a Welcome email to the new prospect
*/
// @ApiMember(DataType="boolean", Description="Send a Welcome email to the new prospect", IsRequired=true, Name="SendEmail", ParameterType="query")
public var sendEmail:Bool
/**
* Only used if SendEmail = True
*/
// @ApiMember(DataType="integer", Description="Only used if SendEmail = True", Name="EmailTemplateId", ParameterType="query")
public var emailTemplateId:Int?
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="Coupon", ParameterType="query")
public var coupon:String
/**
* Add an internal note for the new prospect
*/
// @ApiMember(DataType="string", Description="Add an internal note for the new prospect", Name="Note", ParameterType="query")
public var note:String
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case apiKey
case storeId
case firstName
case lastName
case email
case gender
case address
case city
case state
case zip
case phone
case workPhone
case dateOfBirth
case cellPhone
case addPackageId
case prospectTypeId
case referralTypeId
case sendEmail
case emailTemplateId
case coupon
case note
case restrictedId
case restrictedResourceType
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
email = try container.decodeIfPresent(String.self, forKey: .email)
gender = try container.decodeIfPresent(String.self, forKey: .gender)
address = try container.decodeIfPresent(String.self, forKey: .address)
city = try container.decodeIfPresent(String.self, forKey: .city)
state = try container.decodeIfPresent(String.self, forKey: .state)
zip = try container.decodeIfPresent(String.self, forKey: .zip)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
workPhone = try container.decodeIfPresent(String.self, forKey: .workPhone)
dateOfBirth = try container.decodeIfPresent(Date.self, forKey: .dateOfBirth)
cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
addPackageId = try container.decodeIfPresent(Int.self, forKey: .addPackageId)
prospectTypeId = try container.decodeIfPresent(Int.self, forKey: .prospectTypeId)
referralTypeId = try container.decodeIfPresent(Int.self, forKey: .referralTypeId)
sendEmail = try container.decodeIfPresent(Bool.self, forKey: .sendEmail)
emailTemplateId = try container.decodeIfPresent(Int.self, forKey: .emailTemplateId)
coupon = try container.decodeIfPresent(String.self, forKey: .coupon)
note = try container.decodeIfPresent(String.self, forKey: .note)
restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId)
restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if email != nil { try container.encode(email, forKey: .email) }
if gender != nil { try container.encode(gender, forKey: .gender) }
if address != nil { try container.encode(address, forKey: .address) }
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 phone != nil { try container.encode(phone, forKey: .phone) }
if workPhone != nil { try container.encode(workPhone, forKey: .workPhone) }
if dateOfBirth != nil { try container.encode(dateOfBirth, forKey: .dateOfBirth) }
if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
if addPackageId != nil { try container.encode(addPackageId, forKey: .addPackageId) }
if prospectTypeId != nil { try container.encode(prospectTypeId, forKey: .prospectTypeId) }
if referralTypeId != nil { try container.encode(referralTypeId, forKey: .referralTypeId) }
if sendEmail != nil { try container.encode(sendEmail, forKey: .sendEmail) }
if emailTemplateId != nil { try container.encode(emailTemplateId, forKey: .emailTemplateId) }
if coupon != nil { try container.encode(coupon, forKey: .coupon) }
if note != nil { try container.encode(note, forKey: .note) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
}
}
public class CreateProspectRequestV2Dto : ApiDtoBase
{
public var firstName:String
public var lastName:String
public var address:String
public var city:String
public var state:String
public var zip:String
public var email:String
public var gender:String
public var addPackageId:Int?
public var prospectTypeId:Int?
public var referralTypeId:Int?
public var sendEmail:Bool
public var phone:String
public var workPhone:String
public var dateOfBirth:Date?
public var cellPhone:String
public var coupon:String
public var note:String
public var emailTemplateId:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case firstName
case lastName
case address
case city
case state
case zip
case email
case gender
case addPackageId
case prospectTypeId
case referralTypeId
case sendEmail
case phone
case workPhone
case dateOfBirth
case cellPhone
case coupon
case note
case emailTemplateId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
address = try container.decodeIfPresent(String.self, forKey: .address)
city = try container.decodeIfPresent(String.self, forKey: .city)
state = try container.decodeIfPresent(String.self, forKey: .state)
zip = try container.decodeIfPresent(String.self, forKey: .zip)
email = try container.decodeIfPresent(String.self, forKey: .email)
gender = try container.decodeIfPresent(String.self, forKey: .gender)
addPackageId = try container.decodeIfPresent(Int.self, forKey: .addPackageId)
prospectTypeId = try container.decodeIfPresent(Int.self, forKey: .prospectTypeId)
referralTypeId = try container.decodeIfPresent(Int.self, forKey: .referralTypeId)
sendEmail = try container.decodeIfPresent(Bool.self, forKey: .sendEmail)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
workPhone = try container.decodeIfPresent(String.self, forKey: .workPhone)
dateOfBirth = try container.decodeIfPresent(Date.self, forKey: .dateOfBirth)
cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
coupon = try container.decodeIfPresent(String.self, forKey: .coupon)
note = try container.decodeIfPresent(String.self, forKey: .note)
emailTemplateId = try container.decodeIfPresent(Int.self, forKey: .emailTemplateId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if address != nil { try container.encode(address, forKey: .address) }
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 email != nil { try container.encode(email, forKey: .email) }
if gender != nil { try container.encode(gender, forKey: .gender) }
if addPackageId != nil { try container.encode(addPackageId, forKey: .addPackageId) }
if prospectTypeId != nil { try container.encode(prospectTypeId, forKey: .prospectTypeId) }
if referralTypeId != nil { try container.encode(referralTypeId, forKey: .referralTypeId) }
if sendEmail != nil { try container.encode(sendEmail, forKey: .sendEmail) }
if phone != nil { try container.encode(phone, forKey: .phone) }
if workPhone != nil { try container.encode(workPhone, forKey: .workPhone) }
if dateOfBirth != nil { try container.encode(dateOfBirth, forKey: .dateOfBirth) }
if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
if coupon != nil { try container.encode(coupon, forKey: .coupon) }
if note != nil { try container.encode(note, forKey: .note) }
if emailTemplateId != nil { try container.encode(emailTemplateId, forKey: .emailTemplateId) }
}
}
public class ApiDtoBase : Codable
{
public var apiKey:String
public var storeId:Int?
public var chainId:Int?
required public init(){}
}
public enum RestrictedResourceType : String, Codable
{
case Store
case Chain
case User
case Undefined
}
Swift CreateProspectRequestV2 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 /v2/{ApiKey}/club/{StoreId}/prospect HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateProspectRequestV2 xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Members.Model">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
<ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
<StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
<AddPackageId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</AddPackageId>
<Address xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Address>
<CellPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</CellPhone>
<City xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</City>
<Coupon xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Coupon>
<DateOfBirth xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</DateOfBirth>
<Email xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Email>
<EmailTemplateId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</EmailTemplateId>
<FirstName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</FirstName>
<Gender xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Gender>
<LastName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</LastName>
<Note xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Note>
<Phone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Phone>
<ProspectTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ProspectTypeId>
<ReferralTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ReferralTypeId>
<SendEmail xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</SendEmail>
<State xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</State>
<WorkPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</WorkPhone>
<Zip xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Zip>
</CreateProspectRequestV2>