POST | /sales/agreement/addNewUser | Set up a package that will be sold to an existing user | Set up a package that will be sold to an existing user. The header `X-Forwarded-For` is required and should be set to the IP address of the end user. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="", ResponseType=typeof(AddNewUserResponse), StatusCode=200)
public class AddNewUserEndpoint : IAddNewUserEndpoint, IRestrictedApiRequest, Codable
{
/**
* IP address of the end user
*/
// @ApiMember(Description="IP address of the end user", IsRequired=true, Name="X-Forwarded-For", ParameterType="header")
public var xForwardedFor:String
/**
* Api Authentication Key
*/
// @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
public var apiKey:String
/**
* Member Id of the user buying the Package
*/
// @ApiMember(Description="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")
public var memberId:Int
/**
* Id of the store for the user
*/
// @ApiMember(Description="Id of the store for the user", IsRequired=true)
public var storeId:Int?
public var chainId:Int?
/**
* Package Id number of the package being purchased
*/
// @ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)
public var packageId:Int
/**
* Installment Plan Id being purchased. If empty, the default package will be selected.
*/
// @ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")
public var installmentId:Int?
/**
* Date contract takes affect
*/
// @ApiMember(Description="Date contract takes affect")
public var startDate:Date?
/**
* Promo code to apply a discount.
*/
// @ApiMember(Description="Promo code to apply a discount.")
public var promoCode:String
/**
* Staff Id of salesperson who sold the agreement.
*/
// @ApiMember(Description="Staff Id of salesperson who sold the agreement.")
public var staffId:Int?
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
/**
* First Name
*/
// @ApiMember(Description="First Name", IsRequired=true)
public var firstName:String
/**
* Last Name
*/
// @ApiMember(Description="Last Name", IsRequired=true)
public var lastName:String
/**
* Email Address
*/
// @ApiMember(Description="Email Address", IsRequired=true)
public var email:String
/**
* Gender
*/
// @ApiMember(Description="Gender")
public var gender:String
/**
* Address
*/
// @ApiMember(Description="Address")
public var address:String
/**
* City
*/
// @ApiMember(Description="City")
public var city:String
/**
* State
*/
// @ApiMember(Description="State")
public var state:String
/**
* Zip Code
*/
// @ApiMember(Description="Zip Code")
public var zip:String
/**
* Home phone
*/
// @ApiMember(Description="Home phone")
public var phone:String
/**
* Work phone
*/
// @ApiMember(Description="Work phone")
public var workPhone:String
/**
* Date of Birth
*/
// @ApiMember(Description="Date of Birth")
public var dateOfBirth:Date?
/**
* Cell phone
*/
// @ApiMember(Description="Cell phone")
public var cellPhone:String
/**
* Add an internal note for the new prospect
*/
// @ApiMember(Description="Add an internal note for the new prospect")
public var note:String
/**
* Unique Id for the user from your system. We store internally as ExternalUserId
*/
// @ApiMember(Description="Unique Id for the user from your system. We store internally as ExternalUserId")
public var externalId:String
/**
* Username should be between 4 and 255 characters long
*/
// @ApiMember(Description="Username should be between 4 and 255 characters long")
public var username:String
/**
* ReferralTypeId
*/
// @ApiMember(Description="ReferralTypeId")
public var referralTypeId:Int?
/**
* Emergency contact name
*/
// @ApiMember(Description="Emergency contact name")
public var emergencyContactName:String
/**
* Emergency contact phone number
*/
// @ApiMember(Description="Emergency contact phone number")
public var emergencyContactPhone:String
/**
* Emergency contact relationship
*/
// @ApiMember(Description="Emergency contact relationship")
public var emergencyContactType:String
required public init(){}
}
public enum RestrictedResourceType : String, Codable
{
case Store
case Chain
case User
case Undefined
}
public class AddNewUserResponse : ApiResponse2Base
{
public var incompleteAgreementToken:String
public var memberId:Int?
public var contractId:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case incompleteAgreementToken
case memberId
case contractId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
incompleteAgreementToken = try container.decodeIfPresent(String.self, forKey: .incompleteAgreementToken)
memberId = try container.decodeIfPresent(Int.self, forKey: .memberId)
contractId = try container.decodeIfPresent(Int.self, forKey: .contractId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if incompleteAgreementToken != nil { try container.encode(incompleteAgreementToken, forKey: .incompleteAgreementToken) }
if memberId != nil { try container.encode(memberId, forKey: .memberId) }
if contractId != nil { try container.encode(contractId, forKey: .contractId) }
}
}
public class ApiResponse2Base : Codable
{
public var success:Bool
public var message:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /sales/agreement/addNewUser HTTP/1.1
Host: www.clubready.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"XForwardedFor":"String","ApiKey":"String","MemberId":0,"StoreId":0,"ChainId":0,"PackageId":0,"InstallmentId":0,"StartDate":"0001-01-01T00:00:00.0000000","PromoCode":"String","StaffId":0,"RestrictedId":0,"RestrictedResourceType":"Store","FirstName":"String","LastName":"String","Email":"String","Gender":"String","Address":"String","City":"String","State":"String","Zip":"String","Phone":"String","WorkPhone":"String","DateOfBirth":"0001-01-01T00:00:00.0000000","CellPhone":"String","Note":"String","ExternalId":"String","Username":"String","ReferralTypeId":0,"EmergencyContactName":"String","EmergencyContactPhone":"String","EmergencyContactType":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"incompleteAgreementToken":"String","memberId":0,"contractId":0,"success":false,"message":"String"}