GET | /users/find | Find a member. |
---|
import Foundation
import ServiceStack
public class SearchUsersRequest : SearchUsersRequestDto, 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
/**
* Filter by First Name
*/
// @ApiMember(DataType="string", Description="Filter by First Name", Name="FirstName", ParameterType="query")
public var firstName:String
/**
* Filter by Last Name
*/
// @ApiMember(DataType="string", Description="Filter by Last Name", Name="LastName", ParameterType="query")
public var lastName:String
/**
* 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="string", Description="StoreId OR ChainId is required", Name="ChainId", ParameterType="query")
public var chainId:Int?
/**
* Filter by barcode
*/
// @ApiMember(DataType="string", Description="Filter by barcode", Name="Barcode", ParameterType="query")
public var barcode:String
/**
* Filter by Email Address
*/
// @ApiMember(DataType="string", Description="Filter by Email Address", Name="Email", ParameterType="query")
public var email:String
/**
* Filter by Phone Number
*/
// @ApiMember(DataType="string", Description="Filter by Phone Number", Name="Phone", ParameterType="query")
public var phone:String
/**
* Filter by ClubReady User Type
*/
// @ApiMember(DataType="integer", Description="Filter by ClubReady User Type", Name="UserType", ParameterType="query")
public var userType:Int?
/**
* Page of users to retrieve. Pulls back 100 users per page.
*/
// @ApiMember(DataType="integer", Description="Page of users to retrieve. Pulls back 100 users per page.", Name="Page", ParameterType="query")
public var page:Int?
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case apiKey
case firstName
case lastName
case storeId
case chainId
case barcode
case email
case phone
case userType
case page
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)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
chainId = try container.decodeIfPresent(Int.self, forKey: .chainId)
barcode = try container.decodeIfPresent(String.self, forKey: .barcode)
email = try container.decodeIfPresent(String.self, forKey: .email)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
userType = try container.decodeIfPresent(Int.self, forKey: .userType)
page = try container.decodeIfPresent(Int.self, forKey: .page)
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 firstName != nil { try container.encode(firstName, forKey: .firstName) }
if lastName != nil { try container.encode(lastName, forKey: .lastName) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if chainId != nil { try container.encode(chainId, forKey: .chainId) }
if barcode != nil { try container.encode(barcode, forKey: .barcode) }
if email != nil { try container.encode(email, forKey: .email) }
if phone != nil { try container.encode(phone, forKey: .phone) }
if userType != nil { try container.encode(userType, forKey: .userType) }
if page != nil { try container.encode(page, forKey: .page) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
}
}
public class SearchUsersRequestDto : ApiDtoBase
{
public var barcode:String
public var firstName:String
public var lastName:String
public var email:String
public var phone:String
public var userType:Int?
public var page:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case barcode
case firstName
case lastName
case email
case phone
case userType
case page
}
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)
firstName = try container.decodeIfPresent(String.self, forKey: .firstName)
lastName = try container.decodeIfPresent(String.self, forKey: .lastName)
email = try container.decodeIfPresent(String.self, forKey: .email)
phone = try container.decodeIfPresent(String.self, forKey: .phone)
userType = try container.decodeIfPresent(Int.self, forKey: .userType)
page = try container.decodeIfPresent(Int.self, forKey: .page)
}
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 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 phone != nil { try container.encode(phone, forKey: .phone) }
if userType != nil { try container.encode(userType, forKey: .userType) }
if page != nil { try container.encode(page, forKey: .page) }
}
}
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 .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /users/find HTTP/1.1 Host: clubready.com Accept: application/xml