| POST | /equipment |
|---|
import 'package:servicestack/servicestack.dart';
class Equipment implements IConvertible
{
int? id;
// @required()
// @StringLength(500)
String? name;
// @StringLength(1000)
String? imageUrl;
String? description;
// @StringLength(50)
String? unit;
int? materialTypeId;
int? status;
bool? isDeleted;
DateTime? approvedAt;
int? approvedBy;
DateTime? createdAt;
int? createdBy;
DateTime? updatedAt;
int? updatedBy;
// @ignore()
String? materialTypeName;
// @ignore()
String? createdByName;
// @ignore()
String? approvedByName;
Equipment({this.id,this.name,this.imageUrl,this.description,this.unit,this.materialTypeId,this.status,this.isDeleted,this.approvedAt,this.approvedBy,this.createdAt,this.createdBy,this.updatedAt,this.updatedBy,this.materialTypeName,this.createdByName,this.approvedByName});
Equipment.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
imageUrl = json['imageUrl'];
description = json['description'];
unit = json['unit'];
materialTypeId = json['materialTypeId'];
status = json['status'];
isDeleted = json['isDeleted'];
approvedAt = JsonConverters.fromJson(json['approvedAt'],'DateTime',context!);
approvedBy = json['approvedBy'];
createdAt = JsonConverters.fromJson(json['createdAt'],'DateTime',context!);
createdBy = json['createdBy'];
updatedAt = JsonConverters.fromJson(json['updatedAt'],'DateTime',context!);
updatedBy = json['updatedBy'];
materialTypeName = json['materialTypeName'];
createdByName = json['createdByName'];
approvedByName = json['approvedByName'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'imageUrl': imageUrl,
'description': description,
'unit': unit,
'materialTypeId': materialTypeId,
'status': status,
'isDeleted': isDeleted,
'approvedAt': JsonConverters.toJson(approvedAt,'DateTime',context!),
'approvedBy': approvedBy,
'createdAt': JsonConverters.toJson(createdAt,'DateTime',context!),
'createdBy': createdBy,
'updatedAt': JsonConverters.toJson(updatedAt,'DateTime',context!),
'updatedBy': updatedBy,
'materialTypeName': materialTypeName,
'createdByName': createdByName,
'approvedByName': approvedByName
};
getTypeName() => "Equipment";
TypeContext? context = _ctx;
}
class CreateEquipmentRequest implements IConvertible
{
String? name;
String? imageUrl;
String? description;
String? unit;
int? materialTypeId;
CreateEquipmentRequest({this.name,this.imageUrl,this.description,this.unit,this.materialTypeId});
CreateEquipmentRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
imageUrl = json['imageUrl'];
description = json['description'];
unit = json['unit'];
materialTypeId = json['materialTypeId'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'imageUrl': imageUrl,
'description': description,
'unit': unit,
'materialTypeId': materialTypeId
};
getTypeName() => "CreateEquipmentRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
'Equipment': TypeInfo(TypeOf.Class, create:() => Equipment()),
'CreateEquipmentRequest': TypeInfo(TypeOf.Class, create:() => CreateEquipmentRequest()),
});
Dart CreateEquipmentRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /equipment HTTP/1.1
Host: etc-api.vsmlab.vn
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateEquipmentRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
<Description>String</Description>
<ImageUrl>String</ImageUrl>
<MaterialTypeId>0</MaterialTypeId>
<Name>String</Name>
<Unit>String</Unit>
</CreateEquipmentRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <Equipment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models"> <ApprovedAt>0001-01-01T00:00:00</ApprovedAt> <ApprovedBy>0</ApprovedBy> <ApprovedByName>String</ApprovedByName> <CreatedAt>0001-01-01T00:00:00</CreatedAt> <CreatedBy>0</CreatedBy> <CreatedByName>String</CreatedByName> <DeletedAt>0001-01-01T00:00:00</DeletedAt> <DeletedBy>0</DeletedBy> <Description>String</Description> <Id>0</Id> <ImageUrl>String</ImageUrl> <IsDeleted>false</IsDeleted> <MaterialTypeId>0</MaterialTypeId> <MaterialTypeName>String</MaterialTypeName> <Name>String</Name> <Status>0</Status> <Unit>String</Unit> <UpdatedAt>0001-01-01T00:00:00</UpdatedAt> <UpdatedBy>0</UpdatedBy> </Equipment>