| GET | /api/v1/utils/regions | ||
|---|---|---|---|
| GET | /api/v1/utils/regions/{CountryId} |
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 Region implements IConvertible
{
int? id;
// @References(typeof(Country))
int? countryId;
// @required()
// @StringLength(200)
String? name;
Region({this.id,this.countryId,this.name});
Region.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
countryId = json['countryId'];
name = json['name'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'countryId': countryId,
'name': name
};
getTypeName() => "Region";
TypeContext? context = _ctx;
}
class GetRegionsByCountryResponse extends BaseResponse implements IConvertible
{
List<Region>? regions;
GetRegionsByCountryResponse({this.regions});
GetRegionsByCountryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
regions = JsonConverters.fromJson(json['regions'],'List<Region>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'regions': JsonConverters.toJson(regions,'List<Region>',context!)
});
getTypeName() => "GetRegionsByCountryResponse";
TypeContext? context = _ctx;
}
class GetRegionsByCountry implements IGet, IConvertible
{
int? countryId;
GetRegionsByCountry({this.countryId});
GetRegionsByCountry.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
countryId = json['countryId'];
return this;
}
Map<String, dynamic> toJson() => {
'countryId': countryId
};
getTypeName() => "GetRegionsByCountry";
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()),
'Region': TypeInfo(TypeOf.Class, create:() => Region()),
'GetRegionsByCountryResponse': TypeInfo(TypeOf.Class, create:() => GetRegionsByCountryResponse()),
'List<Region>': TypeInfo(TypeOf.Class, create:() => <Region>[]),
'GetRegionsByCountry': TypeInfo(TypeOf.Class, create:() => GetRegionsByCountry()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/v1/utils/regions HTTP/1.1 Host: pecuario-backend.develsystems.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
regions:
[
{
id: 0,
countryId: 0,
name: String
}
]
}