POST | /users/checkin | Check User Into Club |
---|
import Foundation
import ServiceStack
/**
* Check a user into a club
*/
// @Api(Description="Check a user into a club")
public class DoCheckInRequest : DoCheckInRequestDto, 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
/**
* User barcode
*/
// @ApiMember(DataType="string", Description="User barcode", IsRequired=true, Name="Barcode", ParameterType="query")
public var barcode:String
/**
* ClubReady StoreId required
*/
// @ApiMember(DataType="integer", Description="ClubReady StoreId required", IsRequired=true, Name="StoreId", ParameterType="query")
public var storeId:Int?
/**
* UserId to check into club
*/
// @ApiMember(DataType="integer", Description="UserId to check into club", Name="UserId", ParameterType="query")
public var userId:Int?
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case apiKey
case barcode
case storeId
case userId
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)
barcode = try container.decodeIfPresent(String.self, forKey: .barcode)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
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 barcode != nil { try container.encode(barcode, forKey: .barcode) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if userId != nil { try container.encode(userId, forKey: .userId) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
}
}
public class DoCheckInRequestDto : ApiDtoBase
{
public var barcode:String
public var userId:Int?
public var utcTimeStamp:Date
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case barcode
case userId
case utcTimeStamp
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
barcode = try container.decodeIfPresent(String.self, forKey: .barcode)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
utcTimeStamp = try container.decodeIfPresent(Date.self, forKey: .utcTimeStamp)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if barcode != nil { try container.encode(barcode, forKey: .barcode) }
if userId != nil { try container.encode(userId, forKey: .userId) }
if utcTimeStamp != nil { try container.encode(utcTimeStamp, forKey: .utcTimeStamp) }
}
}
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.
POST /users/checkin HTTP/1.1
Host: clubready.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
Barcode: String,
StoreId: 0,
UserId: 0,
RestrictedId: 0,
RestrictedResourceType: Store,
UtcTimeStamp: 0001-01-01,
ChainId: 0
}