ClubReady Api

<back to all web services

CreateProspectRequestV2

The following routes are available for this service:
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 .jsv suffix or ?format=jsv

HTTP + JSV

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: www.clubready.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ApiKey: String,
	StoreId: 0,
	FirstName: String,
	LastName: String,
	Email: String,
	Gender: String,
	Address: String,
	City: String,
	State: String,
	Zip: String,
	Phone: String,
	WorkPhone: String,
	DateOfBirth: 0001-01-01,
	CellPhone: String,
	AddPackageId: 0,
	ProspectTypeId: 0,
	ReferralTypeId: 0,
	SendEmail: False,
	EmailTemplateId: 0,
	Coupon: String,
	Note: String,
	RestrictedId: 0,
	RestrictedResourceType: Store,
	ChainId: 0
}