Pecuario.Backend

<back to all web services

GetAnimalTypesByCategory

The following routes are available for this service:
GET/api/v1/utils/animal-types/{categoryId}
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 AnimalType implements IConvertible
{
    int? id;
    // @required()
    // @StringLength(50)
    String? name;

    // @References(typeof(AnimalCategory))
    int? animalCategoryId;

    AnimalType({this.id,this.name,this.animalCategoryId});
    AnimalType.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class GetAnimalTypesByCategoryResponse extends BaseResponse implements IConvertible
{
    List<AnimalType>? animalTypes;

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

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

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

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

class GetAnimalTypesByCategory implements IGet, IConvertible
{
    int? categoryId;

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

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

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

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

Dart GetAnimalTypesByCategory DTOs

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

HTTP + CSV

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

GET /api/v1/utils/animal-types/{categoryId} HTTP/1.1 
Host: pecuario-backend.develsystems.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"animalTypes":[{"id":0,"name":"String","animalCategoryId":0}]}