tvpl.api

<back to all web services

GetTemplateByIdRequest

Requires Authentication
The following routes are available for this service:
GET/document-template
import 'package:servicestack/servicestack.dart';

class DocumentTemplate implements IConvertible
{
    int? id;
    // @required()
    String? title;

    String? description;
    bool? isActive;
    String? fileKey;
    String? fileUrl;
    String? fileName;
    int? fileSize;

    DocumentTemplate({this.id,this.title,this.description,this.isActive,this.fileKey,this.fileUrl,this.fileName,this.fileSize});
    DocumentTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        title = json['title'];
        description = json['description'];
        isActive = json['isActive'];
        fileKey = json['fileKey'];
        fileUrl = json['fileUrl'];
        fileName = json['fileName'];
        fileSize = json['fileSize'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'title': title,
        'description': description,
        'isActive': isActive,
        'fileKey': fileKey,
        'fileUrl': fileUrl,
        'fileName': fileName,
        'fileSize': fileSize
    };

    getTypeName() => "DocumentTemplate";
    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 DocumentTemplateDto extends DocumentTemplate implements IConvertible
{
    List<DocumentElementDto>? elements;

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

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

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

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

class DocumentTemplateResponse implements IConvertible
{
    DocumentTemplateDto? template;
    int? insertedId;
    int? code;
    String? message;

    DocumentTemplateResponse({this.template,this.insertedId,this.code,this.message});
    DocumentTemplateResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        template = JsonConverters.fromJson(json['template'],'DocumentTemplateDto',context!);
        insertedId = json['insertedId'];
        code = json['code'];
        message = json['message'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'template': JsonConverters.toJson(template,'DocumentTemplateDto',context!),
        'insertedId': insertedId,
        'code': code,
        'message': message
    };

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

class GetTemplateByIdRequest implements IConvertible
{
    int? id;

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

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

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

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

TypeContext _ctx = TypeContext(library: 'qlcn_api.vsmlab.vn', types: <String, TypeInfo> {
    'DocumentTemplate': TypeInfo(TypeOf.Class, create:() => DocumentTemplate()),
    'DocumentElement': TypeInfo(TypeOf.Class, create:() => DocumentElement()),
    'DocumentElementDto': TypeInfo(TypeOf.Class, create:() => DocumentElementDto()),
    'List<DocumentElementDto>': TypeInfo(TypeOf.Class, create:() => <DocumentElementDto>[]),
    'DocumentTemplateDto': TypeInfo(TypeOf.Class, create:() => DocumentTemplateDto()),
    'DocumentTemplateResponse': TypeInfo(TypeOf.Class, create:() => DocumentTemplateResponse()),
    'GetTemplateByIdRequest': TypeInfo(TypeOf.Class, create:() => GetTemplateByIdRequest()),
});

Dart GetTemplateByIdRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /document-template HTTP/1.1 
Host: qlcn-api.vsmlab.vn 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DocumentTemplateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Code>0</Code>
  <InsertedId>0</InsertedId>
  <Message>String</Message>
  <Template>
    <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
    <CreatedBy xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</CreatedBy>
    <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
    <FileKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</FileKey>
    <FileName xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</FileName>
    <FileSize xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</FileSize>
    <FileUrl xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</FileUrl>
    <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
    <IsActive xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsActive>
    <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
    <Elements>
      <DocumentElementDto>
        <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
        <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
        <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
        <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
        <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
        <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
        <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
        <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
        <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
        <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
        <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
        <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
        <Children>
          <DocumentElementDto>
            <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
            <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
            <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
            <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
            <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
            <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
            <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
            <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
            <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
            <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
            <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
            <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
            <Children>
              <DocumentElementDto>
                <CreatedAt xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0001-01-01T00:00:00</CreatedAt>
                <DataType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</DataType>
                <Description xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Description>
                <ElementKey xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</ElementKey>
                <Id xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</Id>
                <IsRequired xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">false</IsRequired>
                <OrderIndex xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</OrderIndex>
                <ParentId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</ParentId>
                <Tag xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Tag>
                <TemplateId xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">0</TemplateId>
                <TemplateType xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</TemplateType>
                <Title xmlns="http://schemas.datacontract.org/2004/07/tvpl.data.Models">String</Title>
                <Children i:nil="true" />
              </DocumentElementDto>
            </Children>
          </DocumentElementDto>
        </Children>
      </DocumentElementDto>
    </Elements>
  </Template>
</DocumentTemplateResponse>