| GET | /api/v1/dashboard |
|---|
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 AnimalCategory implements IConvertible
{
int? id;
// @required()
// @StringLength(50)
String? name;
String? alias;
int? order;
bool? enabled;
AnimalCategory({this.id,this.name,this.alias,this.order,this.enabled});
AnimalCategory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
alias = json['alias'];
order = json['order'];
enabled = json['enabled'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'alias': alias,
'order': order,
'enabled': enabled
};
getTypeName() => "AnimalCategory";
TypeContext? context = _ctx;
}
class DashboardLand implements IConvertible
{
String? id;
String? description;
String? image;
String? type;
String? price;
String? cityRegionName;
String? priceType;
DashboardLand({this.id,this.description,this.image,this.type,this.price,this.cityRegionName,this.priceType});
DashboardLand.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
description = json['description'];
image = json['image'];
type = json['type'];
price = json['price'];
cityRegionName = json['cityRegionName'];
priceType = json['priceType'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'description': description,
'image': image,
'type': type,
'price': price,
'cityRegionName': cityRegionName,
'priceType': priceType
};
getTypeName() => "DashboardLand";
TypeContext? context = _ctx;
}
class GetDashboardResponse extends BaseResponse implements IConvertible
{
List<AnimalCategory>? animalCategories;
Map<int,List<DashboardAnimal>?>? animalsByCategory;
List<DashboardLand>? lands;
String? greeting;
int? farmsCount;
GetDashboardResponse({this.animalCategories,this.animalsByCategory,this.lands,this.greeting,this.farmsCount});
GetDashboardResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
animalCategories = JsonConverters.fromJson(json['animalCategories'],'List<AnimalCategory>',context!);
animalsByCategory = JsonConverters.fromJson(json['animalsByCategory'],'Map<int,List<DashboardAnimal>?>',context!);
lands = JsonConverters.fromJson(json['lands'],'List<DashboardLand>',context!);
greeting = json['greeting'];
farmsCount = json['farmsCount'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'animalCategories': JsonConverters.toJson(animalCategories,'List<AnimalCategory>',context!),
'animalsByCategory': JsonConverters.toJson(animalsByCategory,'Map<int,List<DashboardAnimal>?>',context!),
'lands': JsonConverters.toJson(lands,'List<DashboardLand>',context!),
'greeting': greeting,
'farmsCount': farmsCount
});
getTypeName() => "GetDashboardResponse";
TypeContext? context = _ctx;
}
class GetDashboard implements IGet, IConvertible
{
int? countryId;
int? maxAnimals;
int? maxLands;
GetDashboard({this.countryId,this.maxAnimals,this.maxLands});
GetDashboard.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
countryId = json['countryId'];
maxAnimals = json['maxAnimals'];
maxLands = json['maxLands'];
return this;
}
Map<String, dynamic> toJson() => {
'countryId': countryId,
'maxAnimals': maxAnimals,
'maxLands': maxLands
};
getTypeName() => "GetDashboard";
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()),
'AnimalCategory': TypeInfo(TypeOf.Class, create:() => AnimalCategory()),
'DashboardLand': TypeInfo(TypeOf.Class, create:() => DashboardLand()),
'GetDashboardResponse': TypeInfo(TypeOf.Class, create:() => GetDashboardResponse()),
'List<AnimalCategory>': TypeInfo(TypeOf.Class, create:() => <AnimalCategory>[]),
'Map<int,List<DashboardAnimal>?>': TypeInfo(TypeOf.Class, create:() => Map<int,List<DashboardAnimal>?>()),
'List<DashboardAnimal>': TypeInfo(TypeOf.Class, create:() => <DashboardAnimal>[]),
'DashboardAnimal': TypeInfo(TypeOf.Class, create:() => DashboardAnimal()),
'List<DashboardLand>': TypeInfo(TypeOf.Class, create:() => <DashboardLand>[]),
'GetDashboard': TypeInfo(TypeOf.Class, create:() => GetDashboard()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/v1/dashboard HTTP/1.1 Host: pecuario-backend.develsystems.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"animalCategories":[{"id":0,"name":"String","alias":"String","order":0,"enabled":false}],"animalsByCategory":{"0":[{"id":"String","description":"String","image":"String","type":"String","price":"String","cityRegionName":"String","priceType":"String"}]},"lands":[{"id":"String","description":"String","image":"String","type":"String","price":"String","cityRegionName":"String","priceType":"String"}],"greeting":"String","farmsCount":0}