My ServiceStack Backend

<back to all web services

SubsRequest

The following routes are available for this service:
GET/subs
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 SubsResponse implements IConvertible
{
    List<MSubscription>? subscriptions;
    int? responseCode;
    String? responseMessage;

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

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

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

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

class SubsRequest implements IConvertible
{
    String? lang;

    SubsRequest({this.lang});
    SubsRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        lang = json['lang'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'lang': lang
    };

    getTypeName() => "SubsRequest";
    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>[]),
    'SubsResponse': TypeInfo(TypeOf.Class, create:() => SubsResponse()),
    'List<MSubscription>': TypeInfo(TypeOf.Class, create:() => <MSubscription>[]),
    'SubsRequest': TypeInfo(TypeOf.Class, create:() => SubsRequest()),
});

Dart SubsRequest 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 HTTP/1.1 
Host: portal-api.migrantleap.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	subscriptions: 
	[
		{
			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
}