| POST | /api/v1/marketplace/products |
|---|
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 PublishProductResponse extends BaseResponse implements IConvertible
{
String? id;
PublishProductResponse({this.id});
PublishProductResponse.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() => "PublishProductResponse";
TypeContext? context = _ctx;
}
class PublishProduct implements IPost, IConvertible
{
String? categoryName;
String? productName;
String? supplier;
String? companyName;
int? regionId;
int? cityId;
String? description;
bool? homeDelivery;
double? price;
PublishProduct({this.categoryName,this.productName,this.supplier,this.companyName,this.regionId,this.cityId,this.description,this.homeDelivery,this.price});
PublishProduct.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
categoryName = json['categoryName'];
productName = json['productName'];
supplier = json['supplier'];
companyName = json['companyName'];
regionId = json['regionId'];
cityId = json['cityId'];
description = json['description'];
homeDelivery = json['homeDelivery'];
price = JsonConverters.toDouble(json['price']);
return this;
}
Map<String, dynamic> toJson() => {
'categoryName': categoryName,
'productName': productName,
'supplier': supplier,
'companyName': companyName,
'regionId': regionId,
'cityId': cityId,
'description': description,
'homeDelivery': homeDelivery,
'price': price
};
getTypeName() => "PublishProduct";
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()),
'PublishProductResponse': TypeInfo(TypeOf.Class, create:() => PublishProductResponse()),
'PublishProduct': TypeInfo(TypeOf.Class, create:() => PublishProduct()),
});
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.
POST /api/v1/marketplace/products HTTP/1.1
Host: pecuario-backend.develsystems.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
categoryName: String,
productName: String,
supplier: String,
companyName: String,
regionId: 0,
cityId: 0,
description: String,
homeDelivery: False,
price: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
id: String
}