GET | /api/coupons | Search for coupons |
---|
import 'package:servicestack/servicestack.dart';
class CouponDto implements IConvertible
{
int? id;
String? name;
String? description;
DateTime? effectiveDate;
String? discountType;
Map<String,double?>? productDiscounts;
CouponDto({this.id,this.name,this.description,this.effectiveDate,this.discountType,this.productDiscounts});
CouponDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
description = json['description'];
effectiveDate = JsonConverters.fromJson(json['effectiveDate'],'DateTime',context!);
discountType = json['discountType'];
productDiscounts = JsonConverters.fromJson(json['productDiscounts'],'Map<String,double?>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'description': description,
'effectiveDate': JsonConverters.toJson(effectiveDate,'DateTime',context!),
'discountType': discountType,
'productDiscounts': JsonConverters.toJson(productDiscounts,'Map<String,double?>',context!)
};
getTypeName() => "CouponDto";
TypeContext? context = _ctx;
}
class GetCouponsResponse implements IConvertible
{
List<CouponDto>? results;
GetCouponsResponse({this.results});
GetCouponsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
results = JsonConverters.fromJson(json['results'],'List<CouponDto>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'results': JsonConverters.toJson(results,'List<CouponDto>',context!)
};
getTypeName() => "GetCouponsResponse";
TypeContext? context = _ctx;
}
class GetCoupons implements IConvertible
{
String? name;
DateTime? fromDate;
DateTime? toDate;
String? discountType;
GetCoupons({this.name,this.fromDate,this.toDate,this.discountType});
GetCoupons.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
fromDate = JsonConverters.fromJson(json['fromDate'],'DateTime',context!);
toDate = JsonConverters.fromJson(json['toDate'],'DateTime',context!);
discountType = json['discountType'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'fromDate': JsonConverters.toJson(fromDate,'DateTime',context!),
'toDate': JsonConverters.toJson(toDate,'DateTime',context!),
'discountType': discountType
};
getTypeName() => "GetCoupons";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'accounts.dev.healthmonix.com', types: <String, TypeInfo> {
'CouponDto': TypeInfo(TypeOf.Class, create:() => CouponDto()),
'Map<String,double?>': TypeInfo(TypeOf.Class, create:() => Map<String,double?>()),
'GetCouponsResponse': TypeInfo(TypeOf.Class, create:() => GetCouponsResponse()),
'List<CouponDto>': TypeInfo(TypeOf.Class, create:() => <CouponDto>[]),
'GetCoupons': TypeInfo(TypeOf.Class, create:() => GetCoupons()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/coupons HTTP/1.1 Host: accounts.dev.healthmonix.com Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"results":[{"id":0,"name":"String","description":"String","effectiveDate":"0001-01-01T00:00:00.0000000","discountType":"String","productDiscounts":{"String":0}}]}