tvpl.api

<back to all web services

GetTemplateByDocumentIdRequest

Requires Authentication
The following routes are available for this service:
GET/document-template/bydocument
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BasicDocument:
    # @Required()
    title: Optional[str] = None

    # @StringLength(4000)
    description: Optional[str] = None

    # @StringLength(500)
    owner: Optional[str] = None

    document_policy_id: Optional[int] = None
    update_document_id: Optional[int] = None
    effect_begin_date: Optional[datetime.datetime] = None
    effect_end_date: Optional[datetime.datetime] = None
    issuing_agency_id: Optional[int] = None
    document_type_id: Optional[int] = None
    document_group_id: Optional[int] = None
    subject_id: Optional[int] = None
    # @StringLength(500)
    sign_by: Optional[str] = None

    sign_date: Optional[datetime.datetime] = None
    status_id: Optional[int] = None
    is_internal: bool = False
    document_number: Optional[str] = None
    document_code: Optional[str] = None
    is_urgent: Optional[bool] = None
    scope_type: Optional[int] = None
    is_active: Optional[bool] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Document(BasicDocument):
    id: int = 0
    # @StringLength(500)
    reason_return: Optional[str] = None

    account_id: Optional[int] = None
    deleted_at: Optional[datetime.datetime] = None
    # @StringLength(500)
    deleted_by: Optional[str] = None

    # @StringLength(500)
    updated_by: Optional[str] = None

    created_at: Optional[datetime.datetime] = None
    # @StringLength(500)
    created_by: Optional[str] = None

    is_party: Optional[bool] = None
    is_revision_requested: bool = False
    last_updated_at: Optional[datetime.datetime] = None
    is_private: Optional[bool] = None
    department_id: Optional[int] = None
    publication_date: Optional[datetime.datetime] = None
    process_status_id: Optional[int] = None
    full_text_search_content: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentTemplate:
    id: int = 0
    # @Required()
    title: Optional[str] = None

    description: Optional[str] = None
    is_active: bool = False
    # @Ignore()
    document_ids: Optional[List[int]] = None

    # @Ignore()
    documents: Optional[List[Document]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentElement:
    id: int = 0
    template_id: int = 0
    # @Required()
    element_key: Optional[str] = None

    # @Required()
    tag: Optional[str] = None

    parent_id: Optional[int] = None
    # @Required()
    title: Optional[str] = None

    description: Optional[str] = None
    # @Required()
    data_type: Optional[str] = None

    template_type: Optional[str] = None
    order_index: int = 0
    is_required: Optional[bool] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentElementDto(DocumentElement):
    children: Optional[List[DocumentElementDto]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentTemplateDto(DocumentTemplate):
    elements: Optional[List[DocumentElementDto]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DocumentTemplateResponse:
    template: Optional[DocumentTemplateDto] = None
    inserted_id: int = 0
    code: int = 0
    message: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetTemplateByDocumentIdRequest:
    document_id: int = 0

Python GetTemplateByDocumentIdRequest DTOs

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

HTTP + JSV

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

GET /document-template/bydocument HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	template: 
	{
		elements: 
		[
			{
				children: 
				[
					{
						children: 
						[
							{
								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
			}
		],
		id: 0,
		title: String,
		description: String,
		isActive: False,
		documentIds: 
		[
			0
		],
		documents: 
		[
			{
				id: 0,
				reasonReturn: String,
				accountId: 0,
				deletedAt: "0001-01-01T00:00:00.0000000+07:06",
				deletedBy: String,
				updatedBy: String,
				createdAt: "0001-01-01T00:00:00.0000000+07:06",
				createdBy: String,
				isParty: False,
				isRevisionRequested: False,
				lastUpdatedAt: "0001-01-01T00:00:00.0000000+07:06",
				isPrivate: False,
				departmentId: 0,
				publicationDate: "0001-01-01T00:00:00.0000000+07:06",
				processStatusId: 0,
				fullTextSearchContent: String,
				title: String,
				description: String,
				owner: String,
				documentPolicyId: 0,
				updateDocumentId: 0,
				effectBeginDate: "0001-01-01T00:00:00.0000000+07:06",
				effectEndDate: "0001-01-01T00:00:00.0000000+07:06",
				issuingAgencyId: 0,
				documentTypeId: 0,
				documentGroupId: 0,
				subjectId: 0,
				signBy: String,
				signDate: "0001-01-01T00:00:00.0000000+07:06",
				statusId: 0,
				isInternal: False,
				documentNumber: String,
				documentCode: String,
				isUrgent: False,
				scopeType: 0,
				isActive: False
			}
		]
	},
	insertedId: 0,
	code: 0,
	message: String
}