| GET | /api/v1/utils/cities/{RegionId} |
|---|
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 City implements IConvertible
{
int? id;
// @References(typeof(Region))
int? regionId;
// @required()
// @StringLength(200)
String? name;
City({this.id,this.regionId,this.name});
City.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
regionId = json['regionId'];
name = json['name'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'regionId': regionId,
'name': name
};
getTypeName() => "City";
TypeContext? context = _ctx;
}
class GetCitiesByRegionResponse extends BaseResponse implements IConvertible
{
List<City>? cities;
GetCitiesByRegionResponse({this.cities});
GetCitiesByRegionResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
cities = JsonConverters.fromJson(json['cities'],'List<City>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'cities': JsonConverters.toJson(cities,'List<City>',context!)
});
getTypeName() => "GetCitiesByRegionResponse";
TypeContext? context = _ctx;
}
class GetCitiesByRegion implements IGet, IConvertible
{
int? regionId;
GetCitiesByRegion({this.regionId});
GetCitiesByRegion.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
regionId = json['regionId'];
return this;
}
Map<String, dynamic> toJson() => {
'regionId': regionId
};
getTypeName() => "GetCitiesByRegion";
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()),
'City': TypeInfo(TypeOf.Class, create:() => City()),
'GetCitiesByRegionResponse': TypeInfo(TypeOf.Class, create:() => GetCitiesByRegionResponse()),
'List<City>': TypeInfo(TypeOf.Class, create:() => <City>[]),
'GetCitiesByRegion': TypeInfo(TypeOf.Class, create:() => GetCitiesByRegion()),
});
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/utils/cities/{RegionId} HTTP/1.1
Host: pecuario-backend.develsystems.com
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"cities":[{"id":0,"regionId":0,"name":"String"}]}