GET | /users | Get users list filtered by date |
---|
import Foundation
import ServiceStack
public class UsersListRequest : UsersListRequestDto, 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
/**
* 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?
/**
* Date to use for filter
*/
// @ApiMember(DataType="Date", Description="Date to use for filter", IsRequired=true, Name="ActivityDate", ParameterType="query")
public var activityDate:String
/**
* The operator to use when comparing ActivityDate. Options are GT,EQ and LT for Greater Than, Equal and Less Than. Defaults to GT if not provided.
*/
// @ApiMember(DataType="String", Description="The operator to use when comparing ActivityDate. Options are GT,EQ and LT for Greater Than, Equal and Less Than. Defaults to GT if not provided.", Name="ActivityOperator", ParameterType="query")
public var activityOperator:String
/**
* Filter by a specific segment. Types: Prospects, Active, Inactive, All, PastDue
*/
// @ApiMember(DataType="string", Description="Filter by a specific segment. Types: Prospects, Active, Inactive, All, PastDue", Name="Segment", ParameterType="query")
public var segment:String
public var restrictedId:Int?
public var restrictedResourceType:RestrictedResourceType
/**
* Version 2 adds email and mobile phone to output
*/
// @ApiMember(DataType="string", Description="Version 2 adds email and mobile phone to output", Name="Version", ParameterType="query")
public var version:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case apiKey
case storeId
case chainId
case activityDate
case activityOperator
case segment
case restrictedId
case restrictedResourceType
case version
}
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)
chainId = try container.decodeIfPresent(Int.self, forKey: .chainId)
activityDate = try container.decodeIfPresent(String.self, forKey: .activityDate)
activityOperator = try container.decodeIfPresent(String.self, forKey: .activityOperator)
segment = try container.decodeIfPresent(String.self, forKey: .segment)
restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId)
restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType)
version = try container.decodeIfPresent(Int.self, forKey: .version)
}
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 chainId != nil { try container.encode(chainId, forKey: .chainId) }
if activityDate != nil { try container.encode(activityDate, forKey: .activityDate) }
if activityOperator != nil { try container.encode(activityOperator, forKey: .activityOperator) }
if segment != nil { try container.encode(segment, forKey: .segment) }
if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
if version != nil { try container.encode(version, forKey: .version) }
}
}
public class UsersListRequestDto : ApiDtoBase
{
public var segment:String
public var activityDate:String
public var activityOperator:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case segment
case activityDate
case activityOperator
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
segment = try container.decodeIfPresent(String.self, forKey: .segment)
activityDate = try container.decodeIfPresent(String.self, forKey: .activityDate)
activityOperator = try container.decodeIfPresent(String.self, forKey: .activityOperator)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if segment != nil { try container.encode(segment, forKey: .segment) }
if activityDate != nil { try container.encode(activityDate, forKey: .activityDate) }
if activityOperator != nil { try container.encode(activityOperator, forKey: .activityOperator) }
}
}
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 HTTP/1.1 Host: clubready.com Accept: application/xml