GET | /scheduling/{UserId}/credit-detail | Breakdown of a user's credits. |
---|
import 'package:servicestack/servicestack.dart';
class ApiDtoBase implements IConvertible
{
String? ApiKey;
int? StoreId;
int? ChainId;
ApiDtoBase({this.ApiKey,this.StoreId,this.ChainId});
ApiDtoBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ApiKey = json['ApiKey'];
StoreId = json['StoreId'];
ChainId = json['ChainId'];
return this;
}
Map<String, dynamic> toJson() => {
'ApiKey': ApiKey,
'StoreId': StoreId,
'ChainId': ChainId
};
getTypeName() => "ApiDtoBase";
TypeContext? context = _ctx;
}
enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
class CreditDetailRequest extends ApiDtoBase implements IRestrictedApiRequest, IConvertible
{
/**
* Api Key - grants access to resources
*/
// @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
String? ApiKey;
/**
* Chain ID
*/
// @ApiMember(DataType="integer", Description="Chain ID", Name="ChainId", ParameterType="query")
int? ChainId;
/**
* Store ID
*/
// @ApiMember(DataType="integer", Description="Store ID", Name="StoreId", ParameterType="query")
int? StoreId;
/**
* ClubReady User ID
*/
// @ApiMember(DataType="integer", Description="ClubReady User ID", IsRequired=true, Name="UserId", ParameterType="path")
int? UserId;
/**
* Determines if the list of the user's credits are broken out by store ID.
*/
// @ApiMember(DataType="Boolean", Description="Determines if the list of the user's credits are broken out by store ID.", Name="FullDetail", ParameterType="query")
bool? FullDetail;
int? RestrictedId;
RestrictedResourceType? RestrictedResourceType;
CreditDetailRequest({this.ApiKey,this.ChainId,this.StoreId,this.UserId,this.FullDetail,this.RestrictedId,this.RestrictedResourceType});
CreditDetailRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
ApiKey = json['ApiKey'];
ChainId = json['ChainId'];
StoreId = json['StoreId'];
UserId = json['UserId'];
FullDetail = json['FullDetail'];
RestrictedId = json['RestrictedId'];
RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'ApiKey': ApiKey,
'ChainId': ChainId,
'StoreId': StoreId,
'UserId': UserId,
'FullDetail': FullDetail,
'RestrictedId': RestrictedId,
'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
});
getTypeName() => "CreditDetailRequest";
TypeContext? context = _ctx;
}
class ApiResponseBase implements IConvertible
{
bool? Success;
String? Message;
ApiResponseBase({this.Success,this.Message});
ApiResponseBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Success = json['Success'];
Message = json['Message'];
return this;
}
Map<String, dynamic> toJson() => {
'Success': Success,
'Message': Message
};
getTypeName() => "ApiResponseBase";
TypeContext? context = _ctx;
}
class SessionCreditDetail implements IConvertible
{
int? ServiceId;
int? SessionSizeId;
int? ClassId;
String? Name;
int? Total;
int? Available;
int? StoreId;
SessionCreditDetail({this.ServiceId,this.SessionSizeId,this.ClassId,this.Name,this.Total,this.Available,this.StoreId});
SessionCreditDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ServiceId = json['ServiceId'];
SessionSizeId = json['SessionSizeId'];
ClassId = json['ClassId'];
Name = json['Name'];
Total = json['Total'];
Available = json['Available'];
StoreId = json['StoreId'];
return this;
}
Map<String, dynamic> toJson() => {
'ServiceId': ServiceId,
'SessionSizeId': SessionSizeId,
'ClassId': ClassId,
'Name': Name,
'Total': Total,
'Available': Available,
'StoreId': StoreId
};
getTypeName() => "SessionCreditDetail";
TypeContext? context = _ctx;
}
class CreditDetailResponseDto extends ApiResponseBase implements IConvertible
{
int? TotalPurchased;
int? TotalAvailable;
List<SessionCreditDetail>? Credits;
CreditDetailResponseDto({this.TotalPurchased,this.TotalAvailable,this.Credits});
CreditDetailResponseDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
TotalPurchased = json['TotalPurchased'];
TotalAvailable = json['TotalAvailable'];
Credits = JsonConverters.fromJson(json['Credits'],'List<SessionCreditDetail>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'TotalPurchased': TotalPurchased,
'TotalAvailable': TotalAvailable,
'Credits': JsonConverters.toJson(Credits,'List<SessionCreditDetail>',context!)
});
getTypeName() => "CreditDetailResponseDto";
TypeContext? context = _ctx;
}
class CreditDetailResponse extends CreditDetailResponseDto implements IConvertible
{
bool? Success;
String? Message;
int? TotalPurchased;
int? TotalAvailable;
List<SessionCreditDetail>? Credits;
CreditDetailResponse({this.Success,this.Message,this.TotalPurchased,this.TotalAvailable,this.Credits});
CreditDetailResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
Success = json['Success'];
Message = json['Message'];
TotalPurchased = json['TotalPurchased'];
TotalAvailable = json['TotalAvailable'];
Credits = JsonConverters.fromJson(json['Credits'],'List<SessionCreditDetail>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'Success': Success,
'Message': Message,
'TotalPurchased': TotalPurchased,
'TotalAvailable': TotalAvailable,
'Credits': JsonConverters.toJson(Credits,'List<SessionCreditDetail>',context!)
});
getTypeName() => "CreditDetailResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'clubready.com', types: <String, TypeInfo> {
'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
'CreditDetailRequest': TypeInfo(TypeOf.Class, create:() => CreditDetailRequest()),
'ApiResponseBase': TypeInfo(TypeOf.Class, create:() => ApiResponseBase()),
'SessionCreditDetail': TypeInfo(TypeOf.Class, create:() => SessionCreditDetail()),
'CreditDetailResponseDto': TypeInfo(TypeOf.Class, create:() => CreditDetailResponseDto()),
'List<SessionCreditDetail>': TypeInfo(TypeOf.Class, create:() => <SessionCreditDetail>[]),
'CreditDetailResponse': TypeInfo(TypeOf.Class, create:() => CreditDetailResponse()),
});
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 /scheduling/{UserId}/credit-detail HTTP/1.1 Host: clubready.com Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreditDetailResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Scheduling.Model"> <Message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Message> <Success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Success> <Credits xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models"> <SessionCreditDetail> <Available>0</Available> <ClassId>0</ClassId> <Name>String</Name> <ServiceId>0</ServiceId> <SessionSizeId>0</SessionSizeId> <StoreId>0</StoreId> <Total>0</Total> </SessionCreditDetail> </Credits> <TotalAvailable xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</TotalAvailable> <TotalPurchased xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</TotalPurchased> </CreditDetailResponse>