My ServiceStack Backend

<back to all web services

UserSubRequest

The following routes are available for this service:
GET/subs/user
import 'package:servicestack/servicestack.dart';

class MSubBenefit implements IConvertible
{
    int? id;
    String? name;
    bool? status;
    int? order;
    bool? hasContent;
    String? image;
    String? rssHash;

    MSubBenefit({this.id,this.name,this.status,this.order,this.hasContent,this.image,this.rssHash});
    MSubBenefit.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        status = json['status'];
        order = json['order'];
        hasContent = json['hasContent'];
        image = json['image'];
        rssHash = json['rssHash'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'status': status,
        'order': order,
        'hasContent': hasContent,
        'image': image,
        'rssHash': rssHash
    };

    getTypeName() => "MSubBenefit";
    TypeContext? context = _ctx;
}

class MBenefit implements IConvertible
{
    int? id;
    String? name;
    bool? status;
    int? order;
    String? image;
    List<MSubBenefit>? subBenefits;

    MBenefit({this.id,this.name,this.status,this.order,this.image,this.subBenefits});
    MBenefit.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        status = json['status'];
        order = json['order'];
        image = json['image'];
        subBenefits = JsonConverters.fromJson(json['subBenefits'],'List<MSubBenefit>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'status': status,
        'order': order,
        'image': image,
        'subBenefits': JsonConverters.toJson(subBenefits,'List<MSubBenefit>',context!)
    };

    getTypeName() => "MBenefit";
    TypeContext? context = _ctx;
}

class MSubscription implements IConvertible
{
    int? id;
    String? name;
    String? description;
    bool? status;
    double? yearlyPrice;
    double? price;
    int? order;
    String? icon;
    String? paymentLink;
    String? yearlyPaymentLink;
    String? sid;
    String? yearlySid;
    double? discount;
    List<MBenefit>? benefits;

    MSubscription({this.id,this.name,this.description,this.status,this.yearlyPrice,this.price,this.order,this.icon,this.paymentLink,this.yearlyPaymentLink,this.sid,this.yearlySid,this.discount,this.benefits});
    MSubscription.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        description = json['description'];
        status = json['status'];
        yearlyPrice = JsonConverters.toDouble(json['yearlyPrice']);
        price = JsonConverters.toDouble(json['price']);
        order = json['order'];
        icon = json['icon'];
        paymentLink = json['paymentLink'];
        yearlyPaymentLink = json['yearlyPaymentLink'];
        sid = json['sid'];
        yearlySid = json['yearlySid'];
        discount = JsonConverters.toDouble(json['discount']);
        benefits = JsonConverters.fromJson(json['benefits'],'List<MBenefit>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'description': description,
        'status': status,
        'yearlyPrice': yearlyPrice,
        'price': price,
        'order': order,
        'icon': icon,
        'paymentLink': paymentLink,
        'yearlyPaymentLink': yearlyPaymentLink,
        'sid': sid,
        'yearlySid': yearlySid,
        'discount': discount,
        'benefits': JsonConverters.toJson(benefits,'List<MBenefit>',context!)
    };

    getTypeName() => "MSubscription";
    TypeContext? context = _ctx;
}

class UserSubResponse implements IConvertible
{
    MSubscription? subscription;
    int? responseCode;
    String? responseMessage;

    UserSubResponse({this.subscription,this.responseCode,this.responseMessage});
    UserSubResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        subscription = JsonConverters.fromJson(json['subscription'],'MSubscription',context!);
        responseCode = json['responseCode'];
        responseMessage = json['responseMessage'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'subscription': JsonConverters.toJson(subscription,'MSubscription',context!),
        'responseCode': responseCode,
        'responseMessage': responseMessage
    };

    getTypeName() => "UserSubResponse";
    TypeContext? context = _ctx;
}

class UserSubRequest implements IConvertible
{
    UserSubRequest();
    UserSubRequest.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "UserSubRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'portal_api.migrantleap.com', types: <String, TypeInfo> {
    'MSubBenefit': TypeInfo(TypeOf.Class, create:() => MSubBenefit()),
    'MBenefit': TypeInfo(TypeOf.Class, create:() => MBenefit()),
    'List<MSubBenefit>': TypeInfo(TypeOf.Class, create:() => <MSubBenefit>[]),
    'MSubscription': TypeInfo(TypeOf.Class, create:() => MSubscription()),
    'List<MBenefit>': TypeInfo(TypeOf.Class, create:() => <MBenefit>[]),
    'UserSubResponse': TypeInfo(TypeOf.Class, create:() => UserSubResponse()),
    'UserSubRequest': TypeInfo(TypeOf.Class, create:() => UserSubRequest()),
});

Dart UserSubRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /subs/user HTTP/1.1 
Host: portal-api.migrantleap.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	subscription: 
	{
		id: 0,
		name: String,
		description: String,
		status: False,
		yearlyPrice: 0,
		price: 0,
		order: 0,
		icon: String,
		paymentLink: String,
		yearlyPaymentLink: String,
		sid: String,
		yearlySid: String,
		discount: 0,
		benefits: 
		[
			{
				id: 0,
				name: String,
				status: False,
				order: 0,
				image: String,
				subBenefits: 
				[
					{
						id: 0,
						name: String,
						status: False,
						order: 0,
						hasContent: False,
						image: String,
						rssHash: String
					}
				]
			}
		]
	},
	responseCode: 0,
	responseMessage: String
}