/* Options: Date: 2024-05-15 00:12:44 SwiftVersion: 5.0 Version: 6.50 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://www.clubready.com/api/current //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CreateProspectRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/users/prospect", "POST") public class CreateProspectRequest : CreateProspectRequestDto, 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 (Format:'M'|'F') */ // @ApiMember(DataType="string", Description="Gender (Format:'M'|'F')", 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 /** * Home phone */ // @ApiMember(DataType="string", Description="Home phone", Name="Phone", ParameterType="query") public var phone:String /** * Work phone */ // @ApiMember(DataType="string", Description="Work phone", Name="WorkPhone", ParameterType="query") public var workPhone:String /** * Date of Birth (Format:YYYY-MM-DD) */ // @ApiMember(DataType="date", Description="Date of Birth (Format:YYYY-MM-DD)", Name="DateOfBirth", ParameterType="query") public var dateOfBirth:Date? /** * Cell phone */ // @ApiMember(DataType="string", Description="Cell phone", Name="CellPhone", ParameterType="query") 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 (Format:true|false) */ // @ApiMember(DataType="boolean", Description="Send a Welcome email to the new prospect (Format:true|false)", 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 /** * Unique ID for the user from your system. We store internally as ExternalUserId */ // @ApiMember(DataType="string", Description="Unique ID for the user from your system. We store internally as ExternalUserId", Name="ExternalId", ParameterType="query") public var externalId:String /** * User ID of existing user who referred them. */ // @ApiMember(DataType="integer", Description="User ID of existing user who referred them.", Name="ReferredBy", ParameterType="query") public var referredBy:Int? /** * ClubReady UserId of staff to assign new member to. */ // @ApiMember(DataType="integer", Description="ClubReady UserId of staff to assign new member to.", Name="AssignToId", ParameterType="query") public var assignToId:Int? /** * Who should be assigned to this lead? 0 = Default lead assignments, 1 = When passing in a ReferredBy user, assign the new Lead to that referring user's Staff assignment. */ // @ApiMember(DataType="integer", Description="Who should be assigned to this lead? 0 = Default lead assignments, 1 = When passing in a ReferredBy user, assign the new Lead to that referring user's Staff assignment.", Name="AssignToMethod", ParameterType="query") public var assignToMethod:Int /** * Username needs to be between 4 and 255 characters */ // @ApiMember(DataType="string", Description="Username needs to be between 4 and 255 characters", Name="Username", ParameterType="query") public var username:String /** * Emergency contact name */ // @ApiMember(DataType="string", Description="Emergency contact name", Name="EmergencyContactName", ParameterType="query") public var emergencyContactName:String /** * Emergency contact phone number */ // @ApiMember(DataType="string", Description="Emergency contact phone number", Name="EmergencyContactPhone", ParameterType="query") public var emergencyContactPhone:String /** * Emergency contact relationship */ // @ApiMember(DataType="string", Description="Emergency contact relationship", Name="EmergencyContactType", ParameterType="query") public var emergencyContactType:String /** * Set a prospect's email opt out status (Format:true|false) */ // @ApiMember(DataType="boolean", Description="Set a prospect's email opt out status (Format:true|false)", Name="EmailOptOut", ParameterType="query") public var emailOptOut:Bool 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 externalId case referredBy case assignToId case assignToMethod case username case emergencyContactName case emergencyContactPhone case emergencyContactType case emailOptOut 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) externalId = try container.decodeIfPresent(String.self, forKey: .externalId) referredBy = try container.decodeIfPresent(Int.self, forKey: .referredBy) assignToId = try container.decodeIfPresent(Int.self, forKey: .assignToId) assignToMethod = try container.decodeIfPresent(Int.self, forKey: .assignToMethod) username = try container.decodeIfPresent(String.self, forKey: .username) emergencyContactName = try container.decodeIfPresent(String.self, forKey: .emergencyContactName) emergencyContactPhone = try container.decodeIfPresent(String.self, forKey: .emergencyContactPhone) emergencyContactType = try container.decodeIfPresent(String.self, forKey: .emergencyContactType) emailOptOut = try container.decodeIfPresent(Bool.self, forKey: .emailOptOut) 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 externalId != nil { try container.encode(externalId, forKey: .externalId) } if referredBy != nil { try container.encode(referredBy, forKey: .referredBy) } if assignToId != nil { try container.encode(assignToId, forKey: .assignToId) } if assignToMethod != nil { try container.encode(assignToMethod, forKey: .assignToMethod) } if username != nil { try container.encode(username, forKey: .username) } if emergencyContactName != nil { try container.encode(emergencyContactName, forKey: .emergencyContactName) } if emergencyContactPhone != nil { try container.encode(emergencyContactPhone, forKey: .emergencyContactPhone) } if emergencyContactType != nil { try container.encode(emergencyContactType, forKey: .emergencyContactType) } if emailOptOut != nil { try container.encode(emailOptOut, forKey: .emailOptOut) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } } } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } public class ApiDtoBase : Codable { public var apiKey:String public var storeId:Int? public var chainId:Int? required public init(){} } public class CreateProspectRequestDto : 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? public var externalId:String public var referredBy:Int? public var assignToId:Int? public var assignToMethod:Int public var contactedHow:Int? public var username:String public var emergencyContactName:String public var emergencyContactPhone:String public var emergencyContactType:String public var emailOptOut:Bool 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 case externalId case referredBy case assignToId case assignToMethod case contactedHow case username case emergencyContactName case emergencyContactPhone case emergencyContactType case emailOptOut } 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) externalId = try container.decodeIfPresent(String.self, forKey: .externalId) referredBy = try container.decodeIfPresent(Int.self, forKey: .referredBy) assignToId = try container.decodeIfPresent(Int.self, forKey: .assignToId) assignToMethod = try container.decodeIfPresent(Int.self, forKey: .assignToMethod) contactedHow = try container.decodeIfPresent(Int.self, forKey: .contactedHow) username = try container.decodeIfPresent(String.self, forKey: .username) emergencyContactName = try container.decodeIfPresent(String.self, forKey: .emergencyContactName) emergencyContactPhone = try container.decodeIfPresent(String.self, forKey: .emergencyContactPhone) emergencyContactType = try container.decodeIfPresent(String.self, forKey: .emergencyContactType) emailOptOut = try container.decodeIfPresent(Bool.self, forKey: .emailOptOut) } 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) } if externalId != nil { try container.encode(externalId, forKey: .externalId) } if referredBy != nil { try container.encode(referredBy, forKey: .referredBy) } if assignToId != nil { try container.encode(assignToId, forKey: .assignToId) } if assignToMethod != nil { try container.encode(assignToMethod, forKey: .assignToMethod) } if contactedHow != nil { try container.encode(contactedHow, forKey: .contactedHow) } if username != nil { try container.encode(username, forKey: .username) } if emergencyContactName != nil { try container.encode(emergencyContactName, forKey: .emergencyContactName) } if emergencyContactPhone != nil { try container.encode(emergencyContactPhone, forKey: .emergencyContactPhone) } if emergencyContactType != nil { try container.encode(emergencyContactType, forKey: .emergencyContactType) } if emailOptOut != nil { try container.encode(emailOptOut, forKey: .emailOptOut) } } }