Pecuario.Backend

<back to all web services

GetAnimalPurposes

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

    int? order;

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

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

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

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

class GetAnimalPurposesResponse extends BaseResponse implements IConvertible
{
    List<AnimalPurpose>? animalPurposes;

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

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

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

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

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

    Map<String, dynamic> toJson() => {};
    getTypeName() => "GetAnimalPurposes";
    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()),
    'AnimalPurpose': TypeInfo(TypeOf.Class, create:() => AnimalPurpose()),
    'GetAnimalPurposesResponse': TypeInfo(TypeOf.Class, create:() => GetAnimalPurposesResponse()),
    'List<AnimalPurpose>': TypeInfo(TypeOf.Class, create:() => <AnimalPurpose>[]),
    'GetAnimalPurposes': TypeInfo(TypeOf.Class, create:() => GetAnimalPurposes()),
});

Dart GetAnimalPurposes 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-purpose HTTP/1.1 
Host: pecuario-backend.develsystems.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"animalPurposes":[{"id":0,"name":"String","order":0}]}