Pecuario.Backend

<back to all web services

GetBanners

The following routes are available for this service:
GET/api/v1/banners
import 'package:servicestack/servicestack.dart';

class Status implements IConvertible
{
    String? message;
    int? statusCode;

    Status({this.message,this.statusCode});
    Status.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class BaseResponse implements IConvertible
{
    Status? status;

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

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

    Map<String, dynamic> toJson() => {
        'status': JsonConverters.toJson(status,'Status',context!)
    };

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

class AdBanner implements IConvertible
{
    String? name;
    String? image;
    String? url;

    AdBanner({this.name,this.image,this.url});
    AdBanner.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'name': name,
        'image': image,
        'url': url
    };

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

class GetBannersResponse extends BaseResponse implements IConvertible
{
    List<AdBanner>? banners;

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

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        banners = JsonConverters.fromJson(json['banners'],'List<AdBanner>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'banners': JsonConverters.toJson(banners,'List<AdBanner>',context!)
    });

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

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

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

TypeContext _ctx = TypeContext(library: 'pecuario_backend.develsystems.com', types: <String, TypeInfo> {
    'Status': TypeInfo(TypeOf.Class, create:() => Status()),
    'BaseResponse': TypeInfo(TypeOf.Class, create:() => BaseResponse()),
    'AdBanner': TypeInfo(TypeOf.Class, create:() => AdBanner()),
    'GetBannersResponse': TypeInfo(TypeOf.Class, create:() => GetBannersResponse()),
    'List<AdBanner>': TypeInfo(TypeOf.Class, create:() => <AdBanner>[]),
    'GetBanners': TypeInfo(TypeOf.Class, create:() => GetBanners()),
});

Dart GetBanners DTOs

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

HTTP + OTHER

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

GET /api/v1/banners HTTP/1.1 
Host: pecuario-backend.develsystems.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"banners":[{"name":"String","image":"String","url":"String"}]}