tvpl.api

<back to all web services

DocumentSearchRequest

Requires Authentication
The following routes are available for this service:
POST/document/search
import Foundation
import ServiceStack

public class DocumentSearchRequest : PagingRequest, IDocumentSearchFilter, IPost
{
    public var title:String
    public var typeId:Int?
    public var groupId:Int?
    public var subjectId:Int?
    public var issuingAgencyId:Int?
    public var isUrgent:Bool?
    public var documentSearchStage:DocumentSearchStage
    public var isInternal:Bool?
    public var statusId:Int?
    public var orderBy:SearchOrderBy
    public var fromDate:Date?
    public var toDate:Date?
    public var isParty:Bool?
    public var scopeType:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case title
        case typeId
        case groupId
        case subjectId
        case issuingAgencyId
        case isUrgent
        case documentSearchStage
        case isInternal
        case statusId
        case orderBy
        case fromDate
        case toDate
        case isParty
        case scopeType
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        title = try container.decodeIfPresent(String.self, forKey: .title)
        typeId = try container.decodeIfPresent(Int.self, forKey: .typeId)
        groupId = try container.decodeIfPresent(Int.self, forKey: .groupId)
        subjectId = try container.decodeIfPresent(Int.self, forKey: .subjectId)
        issuingAgencyId = try container.decodeIfPresent(Int.self, forKey: .issuingAgencyId)
        isUrgent = try container.decodeIfPresent(Bool.self, forKey: .isUrgent)
        documentSearchStage = try container.decodeIfPresent(DocumentSearchStage.self, forKey: .documentSearchStage)
        isInternal = try container.decodeIfPresent(Bool.self, forKey: .isInternal)
        statusId = try container.decodeIfPresent(Int.self, forKey: .statusId)
        orderBy = try container.decodeIfPresent(SearchOrderBy.self, forKey: .orderBy)
        fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate)
        toDate = try container.decodeIfPresent(Date.self, forKey: .toDate)
        isParty = try container.decodeIfPresent(Bool.self, forKey: .isParty)
        scopeType = try container.decodeIfPresent(Int.self, forKey: .scopeType)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if title != nil { try container.encode(title, forKey: .title) }
        if typeId != nil { try container.encode(typeId, forKey: .typeId) }
        if groupId != nil { try container.encode(groupId, forKey: .groupId) }
        if subjectId != nil { try container.encode(subjectId, forKey: .subjectId) }
        if issuingAgencyId != nil { try container.encode(issuingAgencyId, forKey: .issuingAgencyId) }
        if isUrgent != nil { try container.encode(isUrgent, forKey: .isUrgent) }
        if documentSearchStage != nil { try container.encode(documentSearchStage, forKey: .documentSearchStage) }
        if isInternal != nil { try container.encode(isInternal, forKey: .isInternal) }
        if statusId != nil { try container.encode(statusId, forKey: .statusId) }
        if orderBy != nil { try container.encode(orderBy, forKey: .orderBy) }
        if fromDate != nil { try container.encode(fromDate, forKey: .fromDate) }
        if toDate != nil { try container.encode(toDate, forKey: .toDate) }
        if isParty != nil { try container.encode(isParty, forKey: .isParty) }
        if scopeType != nil { try container.encode(scopeType, forKey: .scopeType) }
    }
}

public class PagingRequest : Codable
{
    public var page:Int
    public var limit:Int

    required public init(){}
}

public enum DocumentSearchStage : String, Codable
{
    case All
    case AllProcessing
    case Draft
    case PendingApproval
    case IsRevisionRequested
    case PendingCompilation
    case PendingReport
    case Published
    case Active
    case InActive
}

public enum SearchOrderBy : String, Codable
{
    case UpdatedDateDesc
    case PublishDateDesc
}

public class SearchResponse : IResponseRequest, Codable
{
    public var totalCount:Int
    public var code:Int
    public var data:[DocumentSearchResultItem] = []
    public var message:String

    required public init(){}
}

public class DocumentSearchResultItem : Codable
{
    public var title:String
    public var Description:String
    public var owner:String
    public var documentPolicyId:Int?
    public var updateDocumentId:Int?
    public var effectBeginDate:Date?
    public var effectEndDate:Date?
    public var issuingAgencyId:Int?
    public var subjectId:Int?
    public var signBy:String
    public var signDate:Date?
    public var updatedAt:Date?
    public var statusId:Int?
    public var isInternal:Bool
    public var documentNumber:String
    public var documentCode:String
    public var isUrgent:Bool?
    public var id:Int
    public var reasonReturn:String
    public var accountId:Int?
    public var approverId:Int?
    // @StringLength(500)
    public var updatedBy:String

    // @StringLength(500)
    public var createdBy:String

    public var isParty:Bool?
    public var isRevisionRequested:Bool?
    public var isPrivate:Bool?
    public var departmentId:Int?
    public var publicationDate:Date?
    public var processStatusId:Int
    public var documentTypeId:Int?
    public var documentGroupId:Int?
    public var accountName:String
    public var acceptAccountName:String
    public var documentGroupText:String
    public var processStatusText:String
    public var documentTypeText:String
    public var departmentText:String
    public var statusText:String
    public var issuingAgencyText:String
    public var subjectText:String
    public var comment:String
    public var submitComment:String
    public var fullFile:String
    public var parthFile:String
    public var isActive:Bool?
    public var stepOrder:Int?
    public var stepCount:Int?

    required public init(){}
}


Swift DocumentSearchRequest 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.

POST /document/search HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DocumentSearchRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Limit>10</Limit>
  <Page>1</Page>
  <DocumentSearchStage>All</DocumentSearchStage>
  <FromDate>0001-01-01T00:00:00</FromDate>
  <GroupId>0</GroupId>
  <IsInternal>false</IsInternal>
  <IsParty>false</IsParty>
  <IsUrgent>false</IsUrgent>
  <IssuingAgencyId>0</IssuingAgencyId>
  <OrderBy>UpdatedDateDesc</OrderBy>
  <ScopeType>0</ScopeType>
  <StatusId>0</StatusId>
  <SubjectId>0</SubjectId>
  <Title>String</Title>
  <ToDate>0001-01-01T00:00:00</ToDate>
  <TypeId>0</TypeId>
</DocumentSearchRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<SearchResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Code>0</Code>
  <Data xmlns:d2p1="http://schemas.datacontract.org/2004/07/tvpl.data.Models">
    <d2p1:DocumentSearchResultItem>
      <d2p1:AcceptAccountName>String</d2p1:AcceptAccountName>
      <d2p1:AccountId>0</d2p1:AccountId>
      <d2p1:AccountName>String</d2p1:AccountName>
      <d2p1:ApproverId>0</d2p1:ApproverId>
      <d2p1:Comment>String</d2p1:Comment>
      <d2p1:CreatedBy>String</d2p1:CreatedBy>
      <d2p1:DepartmentId>0</d2p1:DepartmentId>
      <d2p1:DepartmentText>String</d2p1:DepartmentText>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:DocumentCode>String</d2p1:DocumentCode>
      <d2p1:DocumentGroupId>0</d2p1:DocumentGroupId>
      <d2p1:DocumentGroupText>String</d2p1:DocumentGroupText>
      <d2p1:DocumentNumber>String</d2p1:DocumentNumber>
      <d2p1:DocumentPolicyId>0</d2p1:DocumentPolicyId>
      <d2p1:DocumentTypeId>0</d2p1:DocumentTypeId>
      <d2p1:DocumentTypeText>String</d2p1:DocumentTypeText>
      <d2p1:EffectBeginDate>0001-01-01T00:00:00</d2p1:EffectBeginDate>
      <d2p1:EffectEndDate>0001-01-01T00:00:00</d2p1:EffectEndDate>
      <d2p1:FullFile>String</d2p1:FullFile>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:IsActive>false</d2p1:IsActive>
      <d2p1:IsInternal>false</d2p1:IsInternal>
      <d2p1:IsParty>false</d2p1:IsParty>
      <d2p1:IsPrivate>false</d2p1:IsPrivate>
      <d2p1:IsRevisionRequested>false</d2p1:IsRevisionRequested>
      <d2p1:IsUrgent>false</d2p1:IsUrgent>
      <d2p1:IssuingAgencyId>0</d2p1:IssuingAgencyId>
      <d2p1:IssuingAgencyText>String</d2p1:IssuingAgencyText>
      <d2p1:Owner>String</d2p1:Owner>
      <d2p1:ParthFile>String</d2p1:ParthFile>
      <d2p1:ProcessStatusId>0</d2p1:ProcessStatusId>
      <d2p1:ProcessStatusText>String</d2p1:ProcessStatusText>
      <d2p1:PublicationDate>0001-01-01T00:00:00</d2p1:PublicationDate>
      <d2p1:ReasonReturn>String</d2p1:ReasonReturn>
      <d2p1:SignBy>String</d2p1:SignBy>
      <d2p1:SignDate>0001-01-01T00:00:00</d2p1:SignDate>
      <d2p1:StatusId>0</d2p1:StatusId>
      <d2p1:StatusText>String</d2p1:StatusText>
      <d2p1:StepCount>0</d2p1:StepCount>
      <d2p1:StepOrder>0</d2p1:StepOrder>
      <d2p1:SubjectId>0</d2p1:SubjectId>
      <d2p1:SubjectText>String</d2p1:SubjectText>
      <d2p1:SubmitComment>String</d2p1:SubmitComment>
      <d2p1:Title>String</d2p1:Title>
      <d2p1:UpdateDocumentId>0</d2p1:UpdateDocumentId>
      <d2p1:UpdatedAt>0001-01-01T00:00:00</d2p1:UpdatedAt>
      <d2p1:UpdatedBy>String</d2p1:UpdatedBy>
    </d2p1:DocumentSearchResultItem>
  </Data>
  <Message>String</Message>
  <TotalCount>0</TotalCount>
</SearchResponse>