| Required role: | super-admin |
| POST | /document-template |
|---|
import 'package:servicestack/servicestack.dart';
class CreateDocumentTemplateResponse implements IResponseRequest, IConvertible
{
int? insertedId;
int? code;
String? message;
CreateDocumentTemplateResponse({this.insertedId,this.code,this.message});
CreateDocumentTemplateResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
insertedId = json['insertedId'];
code = json['code'];
message = json['message'];
return this;
}
Map<String, dynamic> toJson() => {
'insertedId': insertedId,
'code': code,
'message': message
};
getTypeName() => "CreateDocumentTemplateResponse";
TypeContext? context = _ctx;
}
class DocumentElement implements IConvertible
{
int? id;
int? templateId;
// @required()
String? elementKey;
// @required()
String? tag;
int? parentId;
// @required()
String? title;
String? description;
// @required()
String? dataType;
String? templateType;
int? orderIndex;
bool? isRequired;
DocumentElement({this.id,this.templateId,this.elementKey,this.tag,this.parentId,this.title,this.description,this.dataType,this.templateType,this.orderIndex,this.isRequired});
DocumentElement.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
templateId = json['templateId'];
elementKey = json['elementKey'];
tag = json['tag'];
parentId = json['parentId'];
title = json['title'];
description = json['description'];
dataType = json['dataType'];
templateType = json['templateType'];
orderIndex = json['orderIndex'];
isRequired = json['isRequired'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'templateId': templateId,
'elementKey': elementKey,
'tag': tag,
'parentId': parentId,
'title': title,
'description': description,
'dataType': dataType,
'templateType': templateType,
'orderIndex': orderIndex,
'isRequired': isRequired
};
getTypeName() => "DocumentElement";
TypeContext? context = _ctx;
}
class DocumentElementDto extends DocumentElement implements IConvertible
{
List<DocumentElementDto>? children;
DocumentElementDto({this.children});
DocumentElementDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
children = JsonConverters.fromJson(json['children'],'List<DocumentElementDto>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'children': JsonConverters.toJson(children,'List<DocumentElementDto>',context!)
});
getTypeName() => "DocumentElementDto";
TypeContext? context = _ctx;
}
class CreateOrUpdateTemplateRequest implements IConvertible
{
int? id;
List<int>? documentIds;
String? title;
String? description;
bool? isActive;
List<DocumentElementDto>? elements;
CreateOrUpdateTemplateRequest({this.id,this.documentIds,this.title,this.description,this.isActive,this.elements});
CreateOrUpdateTemplateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
documentIds = JsonConverters.fromJson(json['documentIds'],'List<int>',context!);
title = json['title'];
description = json['description'];
isActive = json['isActive'];
elements = JsonConverters.fromJson(json['elements'],'List<DocumentElementDto>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'documentIds': JsonConverters.toJson(documentIds,'List<int>',context!),
'title': title,
'description': description,
'isActive': isActive,
'elements': JsonConverters.toJson(elements,'List<DocumentElementDto>',context!)
};
getTypeName() => "CreateOrUpdateTemplateRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
'CreateDocumentTemplateResponse': TypeInfo(TypeOf.Class, create:() => CreateDocumentTemplateResponse()),
'DocumentElement': TypeInfo(TypeOf.Class, create:() => DocumentElement()),
'DocumentElementDto': TypeInfo(TypeOf.Class, create:() => DocumentElementDto()),
'List<DocumentElementDto>': TypeInfo(TypeOf.Class, create:() => <DocumentElementDto>[]),
'CreateOrUpdateTemplateRequest': TypeInfo(TypeOf.Class, create:() => CreateOrUpdateTemplateRequest()),
});
Dart CreateOrUpdateTemplateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /document-template HTTP/1.1
Host: etc-api.vsmlab.vn
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"id":0,"documentIds":[0],"title":"String","description":"String","isActive":false,"elements":[{"children":[{"children":[{"children":null,"id":0,"templateId":0,"elementKey":"String","tag":"String","parentId":0,"title":"String","description":"String","dataType":"String","templateType":"String","orderIndex":0,"isRequired":false}],"id":0,"templateId":0,"elementKey":"String","tag":"String","parentId":0,"title":"String","description":"String","dataType":"String","templateType":"String","orderIndex":0,"isRequired":false}],"id":0,"templateId":0,"elementKey":"String","tag":"String","parentId":0,"title":"String","description":"String","dataType":"String","templateType":"String","orderIndex":0,"isRequired":false}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"insertedId":0,"code":0,"message":"String"}