PUT | /users/{UserId} | Update user account info |
---|
import Foundation
import ServiceStack
public class UserAccountRequest : UserAccountRequestDto, 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
/**
*
*/
// @ApiMember(DataType="integer", Description="", IsRequired=true, Name="UserId", ParameterType="query")
public var userId:Int
/**
* StoreId OR ChainId is required
*/
// @ApiMember(DataType="integer", Description="StoreId OR ChainId is required", Name="StoreId", ParameterType="query")
public var storeId:Int?
/**
* StoreId OR ChainId is required
*/
// @ApiMember(DataType="integer", Description="StoreId OR ChainId is required", Name="ChainId", ParameterType="query")
public var chainId:Int?
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="FirstName", ParameterType="query")
public var firstName:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="LastName", ParameterType="query")
public var lastName:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="HomePhone", ParameterType="query")
public var homePhone:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="CellPhone", ParameterType="query")
public var cellPhone:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="Address1", ParameterType="query")
public var address1:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="City", ParameterType="query")
public var city:String
/**
* (Format:2 characters; Example:'MO')
*/
// @ApiMember(DataType="string", Description="(Format:2 characters; Example:'MO')", Name="State", ParameterType="query")
public var state:String
/**
*
*/
// @ApiMember(DataType="string", Description="", Name="Zip", ParameterType="query")
public var zip:String
/**
*
*/
// @ApiMember(DataType="string", Description="", 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
/**
* 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?
/**
* Username should be between 4 and 255 characters long
*/
// @ApiMember(DataType="string", Description="Username should be between 4 and 255 characters long", Name="Username", ParameterType="query")
public var username: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
/**
* 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
/**
* Prospect Type Id
*/
// @ApiMember(DataType="integer", Description="Prospect Type Id", Name="ProspectTypeId", ParameterType="query")
public var prospectTypeId:Int?
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case apiKey
case userId
case storeId
case chainId
case firstName
case lastName
case homePhone
case cellPhone
case address1
case city
case state
case zip
case email
case gender
case dateOfBirth
case username
case externalId
case emergencyContactName
case emergencyContactPhone
case emergencyContactType
case prospectTypeId
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)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
chainId = try container.decodeIfPresent(Int.self, forKey: .chainId)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
homePhone = try container.decodeIfPresent(String.self, forKey: .homePhone)
cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
address1 = try container.decodeIfPresent(String.self, forKey: .address1)
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)
dateOfBirth = try container.decodeIfPresent(Date.self, forKey: .dateOfBirth)
username = try container.decodeIfPresent(String.self, forKey: .username)
externalId = try container.decodeIfPresent(String.self, forKey: .externalId)
emergencyContactName = try container.decodeIfPresent(String.self, forKey: .emergencyContactName)
emergencyContactPhone = try container.decodeIfPresent(String.self, forKey: .emergencyContactPhone)
emergencyContactType = try container.decodeIfPresent(String.self, forKey: .emergencyContactType)
prospectTypeId = try container.decodeIfPresent(Int.self, forKey: .prospectTypeId)
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 userId != nil { try container.encode(userId, forKey: .userId) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if chainId != nil { try container.encode(chainId, forKey: .chainId) }
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if homePhone != nil { try container.encode(homePhone, forKey: .homePhone) }
if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
if address1 != nil { try container.encode(address1, forKey: .address1) }
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 dateOfBirth != nil { try container.encode(dateOfBirth, forKey: .dateOfBirth) }
if username != nil { try container.encode(username, forKey: .username) }
if externalId != nil { try container.encode(externalId, forKey: .externalId) }
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 prospectTypeId != nil { try container.encode(prospectTypeId, forKey: .prospectTypeId) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
}
}
public class UserAccountRequestDto : ApiDtoBase
{
public var userId:Int
public var firstName:String
public var lastName:String
public var homePhone:String
public var cellPhone:String
public var address1:String
public var city:String
public var state:String
public var zip:String
public var email:String
public var gender:String
public var dateOfBirth:Date?
public var username:String
public var externalId:String
public var emergencyContactName:String
public var emergencyContactPhone:String
public var emergencyContactType:String
public var prospectTypeId:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case userId
case firstName
case lastName
case homePhone
case cellPhone
case address1
case city
case state
case zip
case email
case gender
case dateOfBirth
case username
case externalId
case emergencyContactName
case emergencyContactPhone
case emergencyContactType
case prospectTypeId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
homePhone = try container.decodeIfPresent(String.self, forKey: .homePhone)
cellPhone = try container.decodeIfPresent(String.self, forKey: .cellPhone)
address1 = try container.decodeIfPresent(String.self, forKey: .address1)
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)
dateOfBirth = try container.decodeIfPresent(Date.self, forKey: .dateOfBirth)
username = try container.decodeIfPresent(String.self, forKey: .username)
externalId = try container.decodeIfPresent(String.self, forKey: .externalId)
emergencyContactName = try container.decodeIfPresent(String.self, forKey: .emergencyContactName)
emergencyContactPhone = try container.decodeIfPresent(String.self, forKey: .emergencyContactPhone)
emergencyContactType = try container.decodeIfPresent(String.self, forKey: .emergencyContactType)
prospectTypeId = try container.decodeIfPresent(Int.self, forKey: .prospectTypeId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if userId != nil { try container.encode(userId, forKey: .userId) }
if firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if homePhone != nil { try container.encode(homePhone, forKey: .homePhone) }
if cellPhone != nil { try container.encode(cellPhone, forKey: .cellPhone) }
if address1 != nil { try container.encode(address1, forKey: .address1) }
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 dateOfBirth != nil { try container.encode(dateOfBirth, forKey: .dateOfBirth) }
if username != nil { try container.encode(username, forKey: .username) }
if externalId != nil { try container.encode(externalId, forKey: .externalId) }
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 prospectTypeId != nil { try container.encode(prospectTypeId, forKey: .prospectTypeId) }
}
}
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
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /users/{UserId} HTTP/1.1
Host: clubready.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
UserId: 0,
StoreId: 0,
ChainId: 0,
FirstName: String,
LastName: String,
HomePhone: String,
CellPhone: String,
Address1: String,
City: String,
State: String,
Zip: String,
Email: String,
Gender: String,
DateOfBirth: 0001-01-01,
Username: String,
ExternalId: String,
EmergencyContactName: String,
EmergencyContactPhone: String,
EmergencyContactType: String,
ProspectTypeId: 0,
RestrictedId: 0,
RestrictedResourceType: User
}