Pecuario.Backend

<back to all web services

PublishAnimals

Requires Authentication
The following routes are available for this service:
POST/api/v1/marketplace/animals
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 PublishAnimalsResponse extends BaseResponse implements IConvertible
{
    String? id;

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

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

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id
    });

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

class PublishAnimals implements IPost, IConvertible
{
    String? name;
    String? phoneNumber;
    int? regionId;
    int? cityId;
    int? categoryId;
    int? purposeId;
    String? description;
    int? quantity;
    int? priceTypeId;
    double? price;

    PublishAnimals({this.name,this.phoneNumber,this.regionId,this.cityId,this.categoryId,this.purposeId,this.description,this.quantity,this.priceTypeId,this.price});
    PublishAnimals.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        phoneNumber = json['phoneNumber'];
        regionId = json['regionId'];
        cityId = json['cityId'];
        categoryId = json['categoryId'];
        purposeId = json['purposeId'];
        description = json['description'];
        quantity = json['quantity'];
        priceTypeId = json['priceTypeId'];
        price = JsonConverters.toDouble(json['price']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'phoneNumber': phoneNumber,
        'regionId': regionId,
        'cityId': cityId,
        'categoryId': categoryId,
        'purposeId': purposeId,
        'description': description,
        'quantity': quantity,
        'priceTypeId': priceTypeId,
        'price': price
    };

    getTypeName() => "PublishAnimals";
    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()),
    'PublishAnimalsResponse': TypeInfo(TypeOf.Class, create:() => PublishAnimalsResponse()),
    'PublishAnimals': TypeInfo(TypeOf.Class, create:() => PublishAnimals()),
});

Dart PublishAnimals 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.

POST /api/v1/marketplace/animals HTTP/1.1 
Host: pecuario-backend.develsystems.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"name":"String","phoneNumber":"String","regionId":0,"cityId":0,"categoryId":0,"purposeId":0,"description":"String","quantity":0,"priceTypeId":0,"price":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"id":"String"}